* (bug 27670) Ordering by timestamp (and usage of start and end) isn't as clear in...
authorSam Reed <reedy@users.mediawiki.org>
Sat, 12 Mar 2011 23:39:15 +0000 (23:39 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 12 Mar 2011 23:39:15 +0000 (23:39 +0000)
where dir = (newer|older)

Will look at doing (asc|desc)(ending)?

includes/api/ApiQueryBase.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQueryProtectedTitles.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryRevisions.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryWatchlist.php

index e49da10..483c99a 100644 (file)
@@ -440,6 +440,14 @@ abstract class ApiQueryBase extends ApiBase {
                return substr( $this->keyToTitle( $keyPart . 'x' ), 0, - 1 );
        }
 
+       public function getDirectionDescription( $p = '', $extraDirText = '' ) {
+               return array(
+                               "In which direction to enumerate{$extraDirText}",
+                               " newer          - List oldest first. Note: {$p}start has to be before {$p}end.",
+                               " older          - List newest first (default). Note: {$p}start has to be later than {$p}end.",
+                       );
+       }
+
        /**
         * @param $query String
         * @param $protocol String
index 477d979..584a049 100644 (file)
@@ -278,7 +278,7 @@ class ApiQueryBlocks extends ApiQueryBase {
                return array(
                        'start' => 'The timestamp to start enumerating from',
                        'end' => 'The timestamp to stop enumerating at',
-                       'dir' => 'The direction in which to enumerate',
+                       'dir' => $this->getDirectionDescription( $this->getModulePrefix() ),
                        'ids' => 'Pipe-separated list of block IDs to list (optional)',
                        'users' => 'Pipe-separated list of users to search for (optional)',
                        'ip' => array(  'Get all blocks applying to this IP or CIDR range, including range blocks.',
index 230b9de..c4b410c 100644 (file)
@@ -314,7 +314,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                return array(
                        'start' => 'The timestamp to start enumerating from (1,2)',
                        'end' => 'The timestamp to stop enumerating at (1,2)',
-                       'dir' => 'The direction in which to enumerate (1,2)',
+                       'dir' => $this->getDirectionDescription( $this->getModulePrefix(), ' (1,2)' ),
                        'limit' => 'The maximum amount of revisions to list',
                        'prop' => array(
                                'Which properties to get',
index 34dcc59..4240181 100644 (file)
@@ -402,7 +402,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                        'action' => "Filter log actions to only this type. Overrides {$this->getModulePrefix()}type",
                        'start' => 'The timestamp to start enumerating from',
                        'end' => 'The timestamp to end enumerating',
-                       'dir' => 'In which direction to enumerate',
+                       'dir' => $this->getDirectionDescription( $p ),
                        'user' => 'Filter entries to those made by the given user',
                        'title' => 'Filter entries to those related to a page',
                        'limit' => 'How many total event entries to return',
index 66162c2..32249a7 100644 (file)
@@ -203,7 +203,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
                        'namespace' => 'Only list titles in these namespaces',
                        'start' => 'Start listing at this protection timestamp',
                        'end' => 'Stop listing at this protection timestamp',
-                       'dir' => 'The direction in which to list',
+                       'dir' => $this->getDirectionDescription( $this->getModulePrefix() ),
                        'limit' => 'How many total pages to return',
                        'prop' => array(
                                'Which properties to get',
index 3cc2283..7699301 100644 (file)
@@ -582,10 +582,11 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
        }
 
        public function getParamDescription() {
+               $p = $this->getModulePrefix();
                return array(
                        'start' => 'The timestamp to start enumerating from',
                        'end' => 'The timestamp to end enumerating',
-                       'dir' => 'In which direction to enumerate',
+                       'dir' => $this->getDirectionDescription( $p ),
                        'namespace' => 'Filter log entries to only this namespace(s)',
                        'user' => 'Only list changes by this user',
                        'excludeuser' => 'Don\'t list changes by this user',
@@ -608,7 +609,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        'token' => 'Which tokens to obtain for each change',
                        'show' => array(
                                'Show only items that meet this criteria.',
-                               "For example, to see only minor edits done by logged-in users, set {$this->getModulePrefix()}show=minor|!anon"
+                               "For example, to see only minor edits done by logged-in users, set {$p}show=minor|!anon"
                        ),
                        'type' => 'Which types of changes to show',
                        'limit' => 'How many total changes to return',
index 8caa868..c17ea06 100644 (file)
@@ -614,7 +614,7 @@ class ApiQueryRevisions extends ApiQueryBase {
                        'endid' => 'Stop revision enumeration on this revid (enum)',
                        'start' => 'From which revision timestamp to start enumeration (enum)',
                        'end' => 'Enumerate up to this timestamp (enum)',
-                       'dir' => 'Direction of enumeration - towards "newer" or "older" revisions (enum)',
+                       'dir' => $this->getDirectionDescription( $p ),
                        'user' => 'Only include revisions made by user',
                        'excludeuser' => 'Exclude revisions made by user',
                        'expandtemplates' => 'Expand templates in revision content',
index c0cb76e..1e94bb1 100644 (file)
@@ -422,7 +422,7 @@ class ApiQueryContributions extends ApiQueryBase {
                        'continue' => 'When more results are available, use this to continue',
                        'user' => 'The users to retrieve contributions for',
                        'userprefix' => "Retrieve contibutions for all users whose names begin with this value. Overrides {$p}user",
-                       'dir' => 'The direction to search (older or newer)',
+                       'dir' => $this->getDirectionDescription( $p ),
                        'namespace' => 'Only list contributions in these namespaces',
                        'prop' => array(
                                'Include additional pieces of information',
index 5367e6a..0cc53a3 100644 (file)
@@ -364,6 +364,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
        }
 
        public function getParamDescription() {
+               $p = $this->getModulePrefix();
                return array(
                        'allrev' => 'Include multiple revisions of the same page within given timeframe',
                        'start' => 'The timestamp to start enumerating from',
@@ -371,7 +372,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        'namespace' => 'Filter changes to only the given namespace(s)',
                        'user' => 'Only list changes by this user',
                        'excludeuser' => 'Don\'t list changes by this user',
-                       'dir' => 'In which direction to enumerate pages',
+                       'dir' => $this->getDirectionDescription( $p ),
                        'limit' => 'How many total results to return per request',
                        'prop' => array(
                                'Which additional items to get (non-generator mode only).',
@@ -389,7 +390,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        ),
                        'show' => array(
                                'Show only items that meet this criteria.',
-                               "For example, to see only minor edits done by logged-in users, set {$this->getModulePrefix()}show=minor|!anon"
+                               "For example, to see only minor edits done by logged-in users, set {$p}show=minor|!anon"
                        ),
                        'owner' => 'The name of the user whose watchlist you\'d like to access',
                        'token' => 'Give a security token (settable in preferences) to allow access to another user\'s watchlist'