r23743 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23742‎ | r23743 | r23744 >
Date:16:56, 5 July 2007
Author:catrope
Status:old
Tags:
Comment:
apiedt: API: Removing rvprop=lastid altogether, as it's not technically feasible.
Modified paths:
  • /branches/apiedit/phase3/includes/api/ApiQueryRevisions.php (modified) (history)

Diff [purge]

Index: branches/apiedit/phase3/includes/api/ApiQueryRevisions.php
@@ -41,7 +41,7 @@
4242 parent :: __construct($query, $moduleName, 'rv');
4343 }
4444
45 - private $fld_ids = false, $fld_lastid = false, $fld_flags = false, $fld_timestamp = false,
 45+ private $fld_ids = false, $fld_flags = false, $fld_timestamp = false,
4646 $fld_comment = false, $fld_user = false, $fld_content = false;
4747
4848 public function execute() {
@@ -78,13 +78,10 @@
7979 $this->addFields('rev_page');
8080
8181 // Optional fields
82 - // lastid automatically sets ids and timestamp
83 - // because it needs them internally
84 - $this->fld_lastid = isset ($prop['lastid']);
85 - $this->fld_ids = isset ($prop['ids']) || $this->fld_lastid;
 82+ $this->fld_ids = isset ($prop['ids']);
8683 // $this->addFieldsIf('rev_text_id', $this->fld_ids); // should this be exposed?
8784 $this->fld_flags = $this->addFieldsIf('rev_minor_edit', isset ($prop['flags']));
88 - $this->fld_timestamp = $this->addFieldsIf('rev_timestamp', isset ($prop['timestamp']) || $this->fld_lastid);
 85+ $this->fld_timestamp = $this->addFieldsIf('rev_timestamp', isset ($prop['timestamp']));
8986 $this->fld_comment = $this->addFieldsIf('rev_comment', isset ($prop['comment']));
9087
9188 if (isset ($prop['user'])) {
@@ -185,20 +182,6 @@
186183 }
187184 $rowArr = $this->extractRowInfo($row);
188185
189 - if($this->fld_lastid) {
190 - // Queries in loops are EVIL, FIXME
191 - $this->resetQueryParams();
192 - $this->addTables('revision');
193 - $this->addFields('rev_id');
194 - $this->addWhereFld('rev_page', $rowArr['pageid']);
195 - $this->addWhere("rev_timestamp < '{$row->rev_timestamp}'");
196 - $this->addOption('LIMIT', 1);
197 - $this->addOption('ORDER BY', 'rev_timestamp DESC');
198 - $res2 = $this->select(__METHOD__);
199 - $row2 = $db->fetchObject($res2);
200 - $rowArr['lastid'] = $row2->rev_id;
201 - }
202 -
203186 $this->getResult()->addValue(
204187 array (
205188 'query',
@@ -263,7 +246,6 @@
264247 ApiBase :: PARAM_DFLT => 'ids|timestamp|flags|comment|user',
265248 ApiBase :: PARAM_TYPE => array (
266249 'ids',
267 - 'lastid',
268250 'flags',
269251 'timestamp',
270252 'user',

Status & tagging log