r23585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23584‎ | r23585 | r23586 >
Date:09:25, 30 June 2007
Author:catrope
Status:old
Tags:
Comment:
Merging r23584 into apiedit branch
Modified paths:
  • /branches/apiedit/phase3/RELEASE-NOTES (modified) (history)
  • /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_flags = false, $fld_timestamp = false,
 45+ private $fld_ids = false, $fld_lastid = false, $fld_flags = false, $fld_timestamp = false,
4646 $fld_comment = false, $fld_user = false, $fld_content = false;
4747
4848 public function execute() {
@@ -78,10 +78,13 @@
7979 $this->addFields('rev_page');
8080
8181 // Optional fields
82 - $this->fld_ids = isset ($prop['ids']);
 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);
8386 // $this->addFieldsIf('rev_text_id', $this->fld_ids); // should this be exposed?
8487 $this->fld_flags = $this->addFieldsIf('rev_minor_edit', isset ($prop['flags']));
85 - $this->fld_timestamp = $this->addFieldsIf('rev_timestamp', isset ($prop['timestamp']));
 88+ $this->fld_timestamp = $this->addFieldsIf('rev_timestamp', isset ($prop['timestamp']) || $this->fld_lastid);
8689 $this->fld_comment = $this->addFieldsIf('rev_comment', isset ($prop['comment']));
8790
8891 if (isset ($prop['user'])) {
@@ -180,7 +183,21 @@
181184 $this->setContinueEnumParameter('startid', intval($row->rev_id));
182185 break;
183186 }
 187+ $rowArr = $this->extractRowInfo($row);
184188
 189+ if($this->fld_lastid) {
 190+ $this->resetQueryParams();
 191+ $this->addTables('revision');
 192+ $this->addFields('rev_id');
 193+ $this->addWhereFld('rev_page', $rowArr['pageid']);
 194+ $this->addWhere("rev_timestamp < '{$row->rev_timestamp}'");
 195+ $this->addOption('LIMIT', 1);
 196+ $this->addOption('ORDER BY', 'rev_timestamp DESC');
 197+ $res2 = $this->select(__METHOD__);
 198+ $row2 = $db->fetchObject($res2);
 199+ $rowArr['lastid'] = $row2->rev_id;
 200+ }
 201+
185202 $this->getResult()->addValue(
186203 array (
187204 'query',
@@ -188,7 +205,7 @@
189206 intval($row->rev_page),
190207 'revisions'),
191208 null,
192 - $this->extractRowInfo($row));
 209+ $rowArr);
193210 }
194211 $db->freeResult($res);
195212
@@ -245,6 +262,7 @@
246263 ApiBase :: PARAM_DFLT => 'ids|timestamp|flags|comment|user',
247264 ApiBase :: PARAM_TYPE => array (
248265 'ids',
 266+ 'lastid',
249267 'flags',
250268 'timestamp',
251269 'user',
Index: branches/apiedit/phase3/RELEASE-NOTES
@@ -286,6 +286,7 @@
287287 * (bug 10260) Show page protection status
288288 * (bug 10392) Include MediaWiki version details in version output
289289 * (bug 10411) Site language in meta=siteinfo
 290+* (bug 10297) include previous revision ID in prop=revisions
290291
291292 == Maintenance script changes since 1.10 ==
292293

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r23584Adding rvprop=lastid parameter to prop=revisions that lists revid of...catrope09:23, 30 June 2007

Status & tagging log