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 ===
$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() ) );
}
public function getAllowedParams() {
return array(
'from' => null,
+ 'to' => null,
'prefix' => null,
'dir' => array(
ApiBase::PARAM_DFLT => 'ascending',
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',
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() ) );
}
return array(
'continue' => null,
'from' => null,
+ 'to' => null,
'prefix' => null,
'unique' => false,
'prop' => array(
$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(
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() ) );
public function getAllowedParams() {
return array(
'from' => null,
+ 'to' => null,
'prefix' => null,
'group' => array(
ApiBase::PARAM_TYPE => User::getAllGroups()
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(
$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() ) );
public function getAllowedParams() {
return array (
'from' => null,
+ 'to' => null,
'prefix' => null,
'minsize' => array(
ApiBase::PARAM_TYPE => 'integer',
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',
// 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 );
'filter' => array(),
'lang' => null,
'from' => null,
+ 'to' => null,
);
}
'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',
);
}
}
$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() ) );
return array(
'from' => null,
+ 'to' => null,
'prefix' => null,
'namespace' => array(
ApiBase::PARAM_DFLT => 0,
$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',