r83797 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83796‎ | r83797 | r83798 >
Date:23:39, 12 March 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 27670) Ordering by timestamp (and usage of start and end) isn't as clear in auto generated document, as it is on mw.org

where dir = (newer|older)

Will look at doing (asc|desc)(ending)?
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBlocks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryProtectedTitles.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -582,10 +582,11 @@
583583 }
584584
585585 public function getParamDescription() {
 586+ $p = $this->getModulePrefix();
586587 return array(
587588 'start' => 'The timestamp to start enumerating from',
588589 'end' => 'The timestamp to end enumerating',
589 - 'dir' => 'In which direction to enumerate',
 590+ 'dir' => $this->getDirectionDescription( $p ),
590591 'namespace' => 'Filter log entries to only this namespace(s)',
591592 'user' => 'Only list changes by this user',
592593 'excludeuser' => 'Don\'t list changes by this user',
@@ -608,7 +609,7 @@
609610 'token' => 'Which tokens to obtain for each change',
610611 'show' => array(
611612 'Show only items that meet this criteria.',
612 - "For example, to see only minor edits done by logged-in users, set {$this->getModulePrefix()}show=minor|!anon"
 613+ "For example, to see only minor edits done by logged-in users, set {$p}show=minor|!anon"
613614 ),
614615 'type' => 'Which types of changes to show',
615616 'limit' => 'How many total changes to return',
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -314,7 +314,7 @@
315315 return array(
316316 'start' => 'The timestamp to start enumerating from (1,2)',
317317 'end' => 'The timestamp to stop enumerating at (1,2)',
318 - 'dir' => 'The direction in which to enumerate (1,2)',
 318+ 'dir' => $this->getDirectionDescription( $this->getModulePrefix(), ' (1,2)' ),
319319 'limit' => 'The maximum amount of revisions to list',
320320 'prop' => array(
321321 'Which properties to get',
Index: trunk/phase3/includes/api/ApiQueryBase.php
@@ -440,6 +440,14 @@
441441 return substr( $this->keyToTitle( $keyPart . 'x' ), 0, - 1 );
442442 }
443443
 444+ public function getDirectionDescription( $p = '', $extraDirText = '' ) {
 445+ return array(
 446+ "In which direction to enumerate{$extraDirText}",
 447+ " newer - List oldest first. Note: {$p}start has to be before {$p}end.",
 448+ " older - List newest first (default). Note: {$p}start has to be later than {$p}end.",
 449+ );
 450+ }
 451+
444452 /**
445453 * @param $query String
446454 * @param $protocol String
Index: trunk/phase3/includes/api/ApiQueryBlocks.php
@@ -278,7 +278,7 @@
279279 return array(
280280 'start' => 'The timestamp to start enumerating from',
281281 'end' => 'The timestamp to stop enumerating at',
282 - 'dir' => 'The direction in which to enumerate',
 282+ 'dir' => $this->getDirectionDescription( $this->getModulePrefix() ),
283283 'ids' => 'Pipe-separated list of block IDs to list (optional)',
284284 'users' => 'Pipe-separated list of users to search for (optional)',
285285 'ip' => array( 'Get all blocks applying to this IP or CIDR range, including range blocks.',
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php
@@ -402,7 +402,7 @@
403403 'action' => "Filter log actions to only this type. Overrides {$this->getModulePrefix()}type",
404404 'start' => 'The timestamp to start enumerating from',
405405 'end' => 'The timestamp to end enumerating',
406 - 'dir' => 'In which direction to enumerate',
 406+ 'dir' => $this->getDirectionDescription( $p ),
407407 'user' => 'Filter entries to those made by the given user',
408408 'title' => 'Filter entries to those related to a page',
409409 'limit' => 'How many total event entries to return',
Index: trunk/phase3/includes/api/ApiQueryProtectedTitles.php
@@ -203,7 +203,7 @@
204204 'namespace' => 'Only list titles in these namespaces',
205205 'start' => 'Start listing at this protection timestamp',
206206 'end' => 'Stop listing at this protection timestamp',
207 - 'dir' => 'The direction in which to list',
 207+ 'dir' => $this->getDirectionDescription( $this->getModulePrefix() ),
208208 'limit' => 'How many total pages to return',
209209 'prop' => array(
210210 'Which properties to get',
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -364,6 +364,7 @@
365365 }
366366
367367 public function getParamDescription() {
 368+ $p = $this->getModulePrefix();
368369 return array(
369370 'allrev' => 'Include multiple revisions of the same page within given timeframe',
370371 'start' => 'The timestamp to start enumerating from',
@@ -371,7 +372,7 @@
372373 'namespace' => 'Filter changes to only the given namespace(s)',
373374 'user' => 'Only list changes by this user',
374375 'excludeuser' => 'Don\'t list changes by this user',
375 - 'dir' => 'In which direction to enumerate pages',
 376+ 'dir' => $this->getDirectionDescription( $p ),
376377 'limit' => 'How many total results to return per request',
377378 'prop' => array(
378379 'Which additional items to get (non-generator mode only).',
@@ -389,7 +390,7 @@
390391 ),
391392 'show' => array(
392393 'Show only items that meet this criteria.',
393 - "For example, to see only minor edits done by logged-in users, set {$this->getModulePrefix()}show=minor|!anon"
 394+ "For example, to see only minor edits done by logged-in users, set {$p}show=minor|!anon"
394395 ),
395396 'owner' => 'The name of the user whose watchlist you\'d like to access',
396397 'token' => 'Give a security token (settable in preferences) to allow access to another user\'s watchlist'
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -614,7 +614,7 @@
615615 'endid' => 'Stop revision enumeration on this revid (enum)',
616616 'start' => 'From which revision timestamp to start enumeration (enum)',
617617 'end' => 'Enumerate up to this timestamp (enum)',
618 - 'dir' => 'Direction of enumeration - towards "newer" or "older" revisions (enum)',
 618+ 'dir' => $this->getDirectionDescription( $p ),
619619 'user' => 'Only include revisions made by user',
620620 'excludeuser' => 'Exclude revisions made by user',
621621 'expandtemplates' => 'Expand templates in revision content',
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -422,7 +422,7 @@
423423 'continue' => 'When more results are available, use this to continue',
424424 'user' => 'The users to retrieve contributions for',
425425 'userprefix' => "Retrieve contibutions for all users whose names begin with this value. Overrides {$p}user",
426 - 'dir' => 'The direction to search (older or newer)',
 426+ 'dir' => $this->getDirectionDescription( $p ),
427427 'namespace' => 'Only list contributions in these namespaces',
428428 'prop' => array(
429429 'Include additional pieces of information',

Sign-offs

UserFlagDate
Krinkleinspected23:47, 12 March 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r83799* (bug 27670) Ordering by timestamp (and usage of start and end) isn't as cle...reedy00:07, 13 March 2011
r83854Fix undefined $p from r83797reedy21:33, 13 March 2011

Comments

#Comment by Duplicatebug (talk | contribs)   12:50, 13 March 2011

You removed the (enum) from prop=revisions.

#Comment by Reedy (talk | contribs)   16:38, 13 March 2011

I'm not sure how much this matters... It's implied by having multiple limited options to do it

#Comment by Duplicatebug (talk | contribs)   19:27, 15 April 2011

The enum is necessary, because the api dies for dir=newer on a list of titles. The description says "Get data about a set of pages (last revision), by setting titles or pageids parameter.". But with dir=newer you whould get the first revision.

Status & tagging log