r47450 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47449‎ | r47450 | r47451 >
Date:15:26, 18 February 2009
Author:catrope
Status:deferred
Tags:
Comment:
* API: (bug 17529) rvend ignored when rvstartid is specified
* To fix this, make the prop=revisions query slightly less performance-zealous and allow WHERE rev_timestamp <= 'foo' when sorting and rangescanning by rev_id
* Make adding ORDER BY in ApiQueryBase::addWhereRange() optional
* Move a RELEASE-NOTES entry to the right section
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryBase.php
@@ -183,8 +183,9 @@
184184 * this is the lower boundary, otherwise it's the upper boundary
185185 * @param $end string Value to end the list at. If $dir == 'newer' this
186186 * is the upper boundary, otherwise it's the lower boundary
 187+ * @param $sort bool If false, don't add an ORDER BY clause
187188 */
188 - protected function addWhereRange($field, $dir, $start, $end) {
 189+ protected function addWhereRange($field, $dir, $start, $end, $sort = true) {
189190 $isDirNewer = ($dir === 'newer');
190191 $after = ($isDirNewer ? '>=' : '<=');
191192 $before = ($isDirNewer ? '<=' : '>=');
@@ -196,11 +197,13 @@
197198 if (!is_null($end))
198199 $this->addWhere($field . $before . $db->addQuotes($end));
199200
200 - $order = $field . ($isDirNewer ? '' : ' DESC');
201 - if (!isset($this->options['ORDER BY']))
202 - $this->addOption('ORDER BY', $order);
203 - else
204 - $this->addOption('ORDER BY', $this->options['ORDER BY'] . ', ' . $order);
 201+ if ($sort) {
 202+ $order = $field . ($isDirNewer ? '' : ' DESC');
 203+ if (!isset($this->options['ORDER BY']))
 204+ $this->addOption('ORDER BY', $order);
 205+ else
 206+ $this->addOption('ORDER BY', $this->options['ORDER BY'] . ', ' . $order);
 207+ }
205208 }
206209
207210 /**
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -176,9 +176,14 @@
177177 if (is_null($params['startid']) && is_null($params['endid']))
178178 $this->addWhereRange('rev_timestamp', $params['dir'],
179179 $params['start'], $params['end']);
180 - else
 180+ else {
181181 $this->addWhereRange('rev_id', $params['dir'],
182182 $params['startid'], $params['endid']);
 183+ // One of start and end can be set
 184+ // If neither is set, this does nothing
 185+ $this->addWhereRange('rev_timestamp', $params['dir'],
 186+ $params['start'], $params['end'], false);
 187+ }
183188
184189 // must manually initialize unset limit
185190 if (is_null($limit))
Index: trunk/phase3/RELEASE-NOTES
@@ -189,6 +189,7 @@
190190 * File dupe messages for remote repos are now shown only once.
191191 * (bug 14980) Messages 'shareduploadwiki' and 'shareduploadwiki-desc' are now
192192 used as a parameter in 'sharedupload' for easier styling and customization.
 193+* (bug 17482) Formatting error in Special:Preferences#Misc (Opera)
193194
194195 == API changes in 1.15 ==
195196 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
@@ -223,7 +224,7 @@
224225 * Added mainmodule and pagesetmodule parameters to action=paraminfo
225226 * (bug 17502) meta=siteinfo&siprop=namespacealiases no longer lists namespace
226227 aliases already listed in siprop=namespaces
227 -* (bug 17482) Formatting error in Special:Preferences#Misc (Opera)
 228+* (bug 17529) rvend ignored when rvstartid is specified
228229
229230 === Languages updated in 1.15 ===
230231

Status & tagging log