Add indeces to the userLoginLog to help with cleanup. Fixes bug #12008

This commit is contained in:
Colin Kuskie 2011-01-10 10:39:02 -08:00
parent 702d00bb63
commit 727e45c97a
2 changed files with 21 additions and 0 deletions

View file

@ -26,6 +26,7 @@
- fixed #11975: Cannot paste threads: "Cannot call method isa()"
- fixed #11976: Use Container URL in search gives user Permission Denied
- fixed #11985: Search.pl should warn on bad assets
- fixed #12008: Activity CleanLoginHistory is too slow
7.10.6
- fixed #11974: Toolbar icons unclickable in Webkit using HTML5

View file

@ -32,6 +32,7 @@ my $session = start(); # this line required
# upgrade functions go here
addEmailIndexToProfile( $session );
addIndecesToUserLoginLog($session);
finish($session); # this line required
@ -55,6 +56,25 @@ sub addEmailIndexToProfile {
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addIndecesToUserLoginLog {
my $session = shift;
print "\tAdd indeces to userLoginLog to speed cleanup... " unless $quiet;
# and here's our code
my $sth = $session->db->read('SHOW CREATE TABLE userLoginLog');
my ($field,$stmt) = $sth->array;
$sth->finish;
unless ($stmt =~ m/KEY `userId`/i) {
$session->db->write("ALTER TABLE userLoginLog ADD INDEX userId (userId)");
}
unless ($stmt =~ m/KEY `timeStamp`/i) {
$session->db->write("ALTER TABLE userLoginLog ADD INDEX timeStamp (timeStamp)");
}
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------