INDEX use fixes
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 25 Feb 2009 04:33:44 +0000 (04:33 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 25 Feb 2009 04:33:44 +0000 (04:33 +0000)
includes/api/ApiQueryLogEvents.php

index 5d491fc..33c5cb5 100644 (file)
@@ -94,8 +94,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
 
                $limit = $params['limit'];
                $this->addOption('LIMIT', $limit +1);
-               
-               $index = false;
+
                $user = $params['user'];
                if (!is_null($user)) {
                        $userid = User::idFromName($user);
@@ -114,7 +113,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                        $this->addWhereFld('log_title', $titleObj->getDBkey());
 
                        // Use the title index in preference to the user index if there is a conflict
-                       $index = 'page_time';
+                       $index = is_null($user) ? 'page_time' : array('page_time','user_time');
                }
                if ( $index ) {
                        $this->addOption( 'USE INDEX', array( 'logging' => $index ) );