http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70584
Revision: 70584 Author: soxred93 Date: 2010-08-06 18:58:10 +0000 (Fri, 06 Aug 2010) Log Message: ----------- * (bug 24677) axto= parameters added to allcategories, allimages, alllinks, allmessages, allpages, and allusers Modified Paths: -------------- trunk/phase3/RELEASE-NOTES trunk/phase3/includes/api/ApiQueryAllCategories.php trunk/phase3/includes/api/ApiQueryAllLinks.php trunk/phase3/includes/api/ApiQueryAllUsers.php trunk/phase3/includes/api/ApiQueryAllimages.php trunk/phase3/includes/api/ApiQueryAllmessages.php trunk/phase3/includes/api/ApiQueryAllpages.php Modified: trunk/phase3/RELEASE-NOTES =================================================================== --- trunk/phase3/RELEASE-NOTES 2010-08-06 18:56:46 UTC (rev 70583) +++ trunk/phase3/RELEASE-NOTES 2010-08-06 18:58:10 UTC (rev 70584) @@ -326,6 +326,8 @@ 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 === Modified: trunk/phase3/includes/api/ApiQueryAllCategories.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllCategories.php 2010-08-06 18:56:46 UTC (rev 70583) +++ trunk/phase3/includes/api/ApiQueryAllCategories.php 2010-08-06 18:58:10 UTC (rev 70584) @@ -59,9 +59,13 @@ $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 @@ public function getAllowedParams() { return array( 'from' => null, + 'to' => null, 'prefix' => null, 'dir' => array( ApiBase::PARAM_DFLT => 'ascending', @@ -158,6 +163,7 @@ 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', Modified: trunk/phase3/includes/api/ApiQueryAllLinks.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllLinks.php 2010-08-06 18:56:46 UTC (rev 70583) +++ trunk/phase3/includes/api/ApiQueryAllLinks.php 2010-08-06 18:58:10 UTC (rev 70584) @@ -92,6 +92,9 @@ 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 @@ return array( 'continue' => null, 'from' => null, + 'to' => null, 'prefix' => null, 'unique' => false, 'prop' => array( @@ -189,6 +193,7 @@ $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( Modified: trunk/phase3/includes/api/ApiQueryAllUsers.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllUsers.php 2010-08-06 18:56:46 UTC (rev 70583) +++ trunk/phase3/includes/api/ApiQueryAllUsers.php 2010-08-06 18:58:10 UTC (rev 70584) @@ -61,6 +61,9 @@ 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 @@ public function getAllowedParams() { return array( 'from' => null, + 'to' => null, 'prefix' => null, 'group' => array( ApiBase::PARAM_TYPE => User::getAllGroups() @@ -218,6 +222,7 @@ 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( Modified: trunk/phase3/includes/api/ApiQueryAllimages.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllimages.php 2010-08-06 18:56:46 UTC (rev 70583) +++ trunk/phase3/includes/api/ApiQueryAllimages.php 2010-08-06 18:58:10 UTC (rev 70584) @@ -78,9 +78,13 @@ $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 @@ public function getAllowedParams() { return array ( 'from' => null, + 'to' => null, 'prefix' => null, 'minsize' => array( ApiBase::PARAM_TYPE => 'integer', @@ -183,6 +188,7 @@ 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', Modified: trunk/phase3/includes/api/ApiQueryAllmessages.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllmessages.php 2010-08-06 18:56:46 UTC (rev 70583) +++ trunk/phase3/includes/api/ApiQueryAllmessages.php 2010-08-06 18:58:10 UTC (rev 70584) @@ -76,12 +76,17 @@ // 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 @@ 'filter' => array(), 'lang' => null, 'from' => null, + 'to' => null, ); } @@ -173,6 +179,7 @@ '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', ); } Modified: trunk/phase3/includes/api/ApiQueryAllpages.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllpages.php 2010-08-06 18:56:46 UTC (rev 70583) +++ trunk/phase3/includes/api/ApiQueryAllpages.php 2010-08-06 18:58:10 UTC (rev 70584) @@ -70,9 +70,12 @@ } $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 @@ return array( 'from' => null, + 'to' => null, 'prefix' => null, 'namespace' => array( ApiBase::PARAM_DFLT => 0, @@ -253,6 +257,7 @@ $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', _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs