r34767 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34766‎ | r34767 | r34768 >
Date:22:17, 13 May 2008
Author:aaron
Status:old
Tags:
Comment:
* Totally redo index use.
* log_id is live
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryLogEvents.php
@@ -40,8 +40,6 @@
4141 }
4242
4343 public function execute() {
44 - throw new MWException( "This query breaks database servers. It will be restored to service when it works reliably." );
45 -
4644 $params = $this->extractRequestParams();
4745 $db = $this->getDB();
4846
@@ -67,7 +65,7 @@
6866 array( 'log_namespace=page_namespace',
6967 'log_title=page_title'))));
7068 $this->addWhere('user_id=log_user');
71 - $this->addOption('USE INDEX', array('logging' => 'times'));
 69+ $this->addOption('USE INDEX', array('logging' => 'times')); // default, may change
7270
7371 $this->addFields(array (
7472 'log_type',
@@ -75,8 +73,7 @@
7674 'log_timestamp',
7775 ));
7876
79 - // FIXME: Fake out log_id for now until the column is live on Wikimedia
80 - // $this->addFieldsIf('log_id', $this->fld_ids);
 77+ $this->addFieldsIf('log_id', $this->fld_ids);
8178 $this->addFieldsIf('page_id', $this->fld_ids);
8279 $this->addFieldsIf('log_user', $this->fld_user);
8380 $this->addFieldsIf('user_name', $this->fld_user);
@@ -86,7 +83,12 @@
8784 $this->addFieldsIf('log_params', $this->fld_details);
8885
8986 $this->addWhereFld('log_deleted', 0);
90 - $this->addWhereFld('log_type', $params['type']);
 87+
 88+ if( !is_null($params['type']) ) {
 89+ $this->addWhereFld('log_type', $params['type']);
 90+ $this->addOption('USE INDEX', array('logging' => array('type_time')));
 91+ }
 92+
9193 $this->addWhereRange('log_timestamp', $params['dir'], $params['start'], $params['end']);
9294
9395 $limit = $params['limit'];
@@ -100,6 +102,7 @@
101103 if (!$userid)
102104 $this->dieUsage("User name $user not found", 'param_user');
103105 $this->addWhereFld('log_user', $userid);
 106+ $this->addOption('USE INDEX', array('logging' => array('user_time','page_time')));
104107 }
105108
106109 $title = $params['title'];
@@ -109,6 +112,7 @@
110113 $this->dieUsage("Bad title value '$title'", 'param_title');
111114 $this->addWhereFld('log_namespace', $titleObj->getNamespace());
112115 $this->addWhereFld('log_title', $titleObj->getDBkey());
 116+ $this->addOption('USE INDEX', array('logging' => array('user_time','page_time')));
113117 }
114118
115119 $data = array ();

Follow-up revisions

RevisionCommit summaryAuthorDate
r42536* Fix r41814: totally broken use of empty(), ignores conditions that compare ...tstarling08:13, 25 October 2008

Status & tagging log