r49999 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49998‎ | r49999 | r50000 >
Date:11:30, 28 April 2009
Author:catrope
Status:ok (Comments)
Tags:
Comment:
API: Fix list=deletedrevs paging bug pointed out by Splarka on IRC
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -139,16 +139,20 @@
140140 $this->getDB()->addQuotes($params['excludeuser']));
141141 }
142142
143 - if(!is_null($params['continue']) && $mode == 'all')
 143+ if(!is_null($params['continue']) && ($mode == 'all' || $mode == 'revs'))
144144 {
145145 $cont = explode('|', $params['continue']);
146 - if(count($cont) != 2)
 146+ if(count($cont) != 3)
147147 $this->dieUsage("Invalid continue param. You should pass the original value returned by the previous query", "badcontinue");
148 - $title = $this->getDB()->strencode($this->titleToKey($cont[0]));
149 - $ts = $this->getDB()->strencode($cont[1]);
150 - $this->addWhere("ar_title > '$title' OR " .
 148+ $ns = intval($cont[0]);
 149+ $title = $this->getDB()->strencode($this->titleToKey($cont[1]));
 150+ $ts = $this->getDB()->strencode($cont[2]);
 151+ $op = ($params['dir'] == 'newer' ? '>' : '<');
 152+ $this->addWhere("ar_namespace $op $ns OR " .
 153+ "(ar_namespace = $ns AND " .
 154+ "(ar_title $op '$title' OR " .
151155 "(ar_title = '$title' AND " .
152 - "ar_timestamp >= '$ts')");
 156+ "ar_timestamp = '$ts')))");
153157 }
154158
155159 $this->addOption('LIMIT', $limit + 1);
@@ -182,9 +186,9 @@
183187 if(++$count > $limit)
184188 {
185189 // We've had enough
186 - if($mode == 'all')
187 - $this->setContinueEnumParameter('continue', $this->keyToTitle($row->ar_title) . '|' .
188 - $row->ar_timestamp);
 190+ if($mode == 'all' || $mode == 'revs')
 191+ $this->setContinueEnumParameter('continue', intval($row->ar_namespace) . '|' .
 192+ $this->keyToTitle($row->ar_title) . '|' . $row->ar_timestamp);
189193 else
190194 $this->setContinueEnumParameter('start', wfTimestamp(TS_ISO_8601, $row->ar_timestamp));
191195 break;
@@ -227,9 +231,9 @@
228232 }
229233 if(!$fit)
230234 {
231 - if($mode == 'all')
232 - $this->setContinueEnumParameter('continue', $this->keyToTitle($row->ar_title) . '|' .
233 - $row->ar_timestamp);
 235+ if($mode == 'all' || $mode == 'revs')
 236+ $this->setContinueEnumParameter('continue', intval($row->ar_namespace) . '|' .
 237+ $this->keyToTitle($row->ar_title) . '|' . $row->ar_timestamp);
234238 else
235239 $this->setContinueEnumParameter('start', wfTimestamp(TS_ISO_8601, $row->ar_timestamp));
236240 break;

Follow-up revisions

RevisionCommit summaryAuthorDate
r50220API backports:...tstarling14:07, 5 May 2009

Comments

#Comment by Tim Starling (talk | contribs)   13:01, 5 May 2009

Can you explain the bug and provide a rationale for backporting?

Status & tagging log