From 727e45c97a6ca83626a05f0ad42f3d80a2c95138 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 10 Jan 2011 10:39:02 -0800 Subject: [PATCH] Add indeces to the userLoginLog to help with cleanup. Fixes bug #12008 --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.10.6-7.10.7.pl | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9f353fff2..79cb4ed32 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/docs/upgrades/upgrade_7.10.6-7.10.7.pl b/docs/upgrades/upgrade_7.10.6-7.10.7.pl index edf4dabcf..90847d0c2 100644 --- a/docs/upgrades/upgrade_7.10.6-7.10.7.pl +++ b/docs/upgrades/upgrade_7.10.6-7.10.7.pl @@ -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 -------------------------------- #----------------------------------------------------------------------------