r23584 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23583‎ | r23584 | r23585 >
Date:09:23, 30 June 2007
Author:catrope
Status:old
Tags:
Comment:
Adding rvprop=lastid parameter to prop=revisions that lists revid of
previous revision (bug 10297)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)

Diff [purge]

Index: trunk/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: trunk/phase3/RELEASE-NOTES
@@ -287,6 +287,7 @@
288288 * (bug 10392) Include MediaWiki version details in version output
289289 * (bug 10411) Site language in meta=siteinfo
290290 * (bug 10391) action=help doesn't return help if format is fancy markup
 291+* (bug 10297) include previous revision ID in prop=revisions
291292
292293 == Maintenance script changes since 1.10 ==
293294

Follow-up revisions

RevisionCommit summaryAuthorDate
r23585Merging r23584 into apiedit branchcatrope09:25, 30 June 2007
r23596API: Reverted back to r23531 for the reasons listed in bug 10297yurik06:45, 1 July 2007
r23662Merged revisions 23581-23661 via svnmerge from...david03:01, 3 July 2007
r23982Removed incorrect line - bug 10297 is still open.yurik00:20, 11 July 2007
r24096Merged revisions 23910-24094 via svnmerge from...david22:38, 14 July 2007

Status & tagging log