* (bug 24677) axto= parameters added to allcategories, allimages, alllinks, allmessag...
authorX! <soxred93@users.mediawiki.org>
Fri, 6 Aug 2010 18:58:10 +0000 (18:58 +0000)
committerX! <soxred93@users.mediawiki.org>
Fri, 6 Aug 2010 18:58:10 +0000 (18:58 +0000)
RELEASE-NOTES
includes/api/ApiQueryAllCategories.php
includes/api/ApiQueryAllLinks.php
includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryAllimages.php
includes/api/ApiQueryAllmessages.php
includes/api/ApiQueryAllpages.php

index 8b77262..8f00131 100644 (file)
@@ -326,6 +326,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   the parameter, the API will automatically throw an error.
 * (bug 24665) When starttimestamp is not specified, fake it by setting it to NOW, not to 
   the timestamp of the last edit
+* (bug 24677) axto= parameters added to allcategories, allimages, alllinks, allmessages, 
+  allpages, and allusers
 
 === Languages updated in 1.17 ===
 
index afdc52d..a549294 100644 (file)
@@ -59,9 +59,13 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                $this->addTables( 'category' );
                $this->addFields( 'cat_title' );
 
-               $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
+               $fromdir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
+               $todir = ( $params['dir'] != 'descending' ? 'older' : 'newer' );
                $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
-               $this->addWhereRange( 'cat_title', $dir, $from, null );
+               $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
+               $this->addWhereRange( 'cat_title', $fromdir, $from, null );
+               $this->addWhereRange( 'cat_title', $todir, $to, null );
+
                if ( isset( $params['prefix'] ) ) {
                        $this->addWhere( 'cat_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                }
@@ -132,6 +136,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
        public function getAllowedParams() {
                return array(
                        'from' => null,
+                       'to' => null,
                        'prefix' => null,
                        'dir' => array(
                                ApiBase::PARAM_DFLT => 'ascending',
@@ -158,6 +163,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
        public function getParamDescription() {
                return array(
                        'from' => 'The category to start enumerating from',
+                       'to' => 'The category to stop enumerating at',
                        'prefix' => 'Search for all category titles that begin with this value',
                        'dir' => 'Direction to sort in',
                        'limit' => 'How many categories to return',
index 40c63f8..cb62438 100644 (file)
@@ -92,6 +92,9 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                if ( !is_null( $params['from'] ) ) {
                        $this->addWhere( 'pl_title>=' . $db->addQuotes( $this->titlePartToKey( $params['from'] ) ) );
                }
+               if ( !is_null( $params['to'] ) ) {
+                       $this->addWhere( 'pl_title<=' . $db->addQuotes( $this->titlePartToKey( $params['to'] ) ) );
+               }
                if ( isset( $params['prefix'] ) ) {
                        $this->addWhere( 'pl_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                }
@@ -161,6 +164,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                return array(
                        'continue' => null,
                        'from' => null,
+                       'to' => null,
                        'prefix' => null,
                        'unique' => false,
                        'prop' => array(
@@ -189,6 +193,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                $p = $this->getModulePrefix();
                return array(
                        'from' => 'The page title to start enumerating from',
+                       'to' => 'The page title to stop enumerating at',
                        'prefix' => 'Search for all page titles that begin with this value',
                        'unique' => "Only show unique links. Cannot be used with generator or {$p}prop=ids",
                        'prop' => array(
index 1f4d858..8ff0ead 100644 (file)
@@ -61,6 +61,9 @@ class ApiQueryAllUsers extends ApiQueryBase {
                if ( !is_null( $params['from'] ) ) {
                        $this->addWhere( 'u1.user_name >= ' . $db->addQuotes( $this->keyToTitle( $params['from'] ) ) );
                }
+               if ( !is_null( $params['to'] ) ) {
+                       $this->addWhere( 'u1.user_name <= ' . $db->addQuotes( $this->keyToTitle( $params['to'] ) ) );
+               }
 
                if ( !is_null( $params['prefix'] ) ) {
                        $this->addWhere( 'u1.user_name' . $db->buildLike( $this->keyToTitle( $params['prefix'] ), $db->anyString() ) );
@@ -191,6 +194,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
        public function getAllowedParams() {
                return array(
                        'from' => null,
+                       'to' => null,
                        'prefix' => null,
                        'group' => array(
                                ApiBase::PARAM_TYPE => User::getAllGroups()
@@ -218,6 +222,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
        public function getParamDescription() {
                return array(
                        'from' => 'The user name to start enumerating from',
+                       'to' => 'The user name to stop enumerating at',
                        'prefix' => 'Search for all page titles that begin with this value',
                        'group' => 'Limit users to a given group name',
                        'prop' => array(
index a63edec..863cd59 100644 (file)
@@ -78,9 +78,13 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
                $params = $this->extractRequestParams();
 
                // Image filters
-               $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
+               $fromdir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
+               $todir = ( $params['dir'] != 'descending' ? 'older' : 'newer' );
                $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
-               $this->addWhereRange( 'img_name', $dir, $from, null );
+               $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
+               $this->addWhereRange( 'img_name', $fromdir, $from, null );
+               $this->addWhereRange( 'img_name', $todir, $to, null );
+
                if ( isset( $params['prefix'] ) )
                        $this->addWhere( 'img_name' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
 
@@ -149,6 +153,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
        public function getAllowedParams() {
                return array (
                        'from' => null,
+                       'to' => null,
                        'prefix' => null,
                        'minsize' => array(
                                ApiBase::PARAM_TYPE => 'integer',
@@ -183,6 +188,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
        public function getParamDescription() {
                return array(
                        'from' => 'The image title to start enumerating from',
+                       'to' => 'The image title to stop enumerating at',
                        'prefix' => 'Search for all image titles that begin with this value',
                        'dir' => 'The direction in which to list',
                        'minsize' => 'Limit to images with at least this many bytes',
index 39b736b..b84d3f6 100644 (file)
@@ -76,12 +76,17 @@ class ApiQueryAllmessages extends ApiQueryBase {
 
                // Get all requested messages and print the result
                $skip = !is_null( $params['from'] );
+               $useto = !is_null( $params['to'] );
                $result = $this->getResult();
                foreach ( $messages_target as $message ) {
                        // Skip all messages up to $params['from']
                        if ( $skip && $message === $params['from'] ) {
                                $skip = false;
                        }
+                       
+                       if( $useto && $message > $params['to'] ) {
+                               break;
+                       }
 
                        if ( !$skip ) {
                                $a = array( 'name' => $message );
@@ -160,6 +165,7 @@ class ApiQueryAllmessages extends ApiQueryBase {
                        'filter' => array(),
                        'lang' => null,
                        'from' => null,
+                       'to' => null,
                );
        }
 
@@ -173,6 +179,7 @@ class ApiQueryAllmessages extends ApiQueryBase {
                        'filter' => 'Return only messages that contain this string',
                        'lang' => 'Return messages in this language',
                        'from' => 'Return messages starting at this message',
+                       'to' => 'Return messages ending at this message',
                );
        }
 
index 571264a..7b2a474 100644 (file)
@@ -70,9 +70,12 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                }
 
                $this->addWhereFld( 'page_namespace', $params['namespace'] );
-               $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
+               $fromdir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
+               $todir = ( $params['dir'] != 'descending' ? 'older' : 'newer' );
                $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
-               $this->addWhereRange( 'page_title', $dir, $from, null );
+               $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
+               $this->addWhereRange( 'page_title', $fromdir, $from, null );
+               $this->addWhereRange( 'page_title', $todir, $to, null );
 
                if ( isset( $params['prefix'] ) ) {
                        $this->addWhere( 'page_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
@@ -189,6 +192,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
 
                return array(
                        'from' => null,
+                       'to' => null,
                        'prefix' => null,
                        'namespace' => array(
                                ApiBase::PARAM_DFLT => 0,
@@ -253,6 +257,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                $p = $this->getModulePrefix();
                return array(
                        'from' => 'The page title to start enumerating from',
+                       'to' => 'The page title to stop enumerating at',
                        'prefix' => 'Search for all page titles that begin with this value',
                        'namespace' => 'The namespace to enumerate',
                        'filterredir' => 'Which pages to list',