Yet more formatting updates for yet more API classes
Change-Id: Iaa1cfaaffc7c55bb7670dfbff3f063cf22434f09
This commit is contained in:
parent
56aba313f6
commit
d45bb99e8c
10 changed files with 49 additions and 34 deletions
|
|
@ -172,10 +172,10 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
$ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
|
||||
$op = ( $dir == 'newer' ? '>' : '<' );
|
||||
$this->addWhere( "ar_namespace $op $ns OR " .
|
||||
"(ar_namespace = $ns AND " .
|
||||
"(ar_title $op $title OR " .
|
||||
"(ar_title = $title AND " .
|
||||
"ar_timestamp $op= $ts)))" );
|
||||
"(ar_namespace = $ns AND " .
|
||||
"(ar_title $op $title OR " .
|
||||
"(ar_title = $title AND " .
|
||||
"ar_timestamp $op= $ts)))" );
|
||||
}
|
||||
|
||||
$this->addOption( 'LIMIT', $limit + 1 );
|
||||
|
|
@ -188,7 +188,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
$this->addOption( 'ORDER BY', array(
|
||||
'ar_title' . $sort,
|
||||
'ar_timestamp' . $sort
|
||||
));
|
||||
) );
|
||||
}
|
||||
} else {
|
||||
if ( $mode == 'revs' ) {
|
||||
|
|
@ -385,6 +385,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
|
||||
public function getDescription() {
|
||||
$p = $this->getModulePrefix();
|
||||
|
||||
return array(
|
||||
'List deleted revisions.',
|
||||
'Operates in three modes:',
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
|
|||
$result = $this->getResult();
|
||||
$count = 0;
|
||||
foreach ( $res as $row ) {
|
||||
if ( ++ $count > $limit ) {
|
||||
if ( ++$count > $limit ) {
|
||||
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
|
||||
$this->setContinueEnumParameter( 'offset', $offset + $limit );
|
||||
break;
|
||||
|
|
@ -140,7 +140,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
|
|||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
$result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ),
|
||||
$this->getModulePrefix() );
|
||||
$this->getModulePrefix() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -186,6 +186,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
|
|||
$protocols[] = substr( $p, 0, strpos( $p, ':' ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $protocols;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ class ApiQueryExternalLinks extends ApiQueryBase {
|
|||
|
||||
public function getParamDescription() {
|
||||
$p = $this->getModulePrefix();
|
||||
|
||||
return array(
|
||||
'limit' => 'How many links to return',
|
||||
'offset' => 'When more results are available, use this to continue',
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
|
|||
|
||||
public function getParamDescription() {
|
||||
$p = $this->getModulePrefix();
|
||||
|
||||
return array(
|
||||
'prop' => array(
|
||||
'Which repository properties to get (there may be more available on some wikis):',
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ class ApiQueryFilearchive extends ApiQueryBase {
|
|||
}
|
||||
if ( $fld_metadata ) {
|
||||
$file['metadata'] = $row->fa_metadata
|
||||
? ApiQueryImageInfo::processMetaData( unserialize( $row->fa_metadata ), $result )
|
||||
: null;
|
||||
? ApiQueryImageInfo::processMetaData( unserialize( $row->fa_metadata ), $result )
|
||||
: null;
|
||||
}
|
||||
if ( $fld_bitdepth ) {
|
||||
$file['bitdepth'] = $row->fa_bits;
|
||||
|
|
|
|||
|
|
@ -92,14 +92,14 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
|
|||
$this->addOption( 'ORDER BY', array(
|
||||
'iwl_title' . $sort,
|
||||
'iwl_from' . $sort
|
||||
));
|
||||
) );
|
||||
}
|
||||
} else {
|
||||
$this->addOption( 'ORDER BY', array(
|
||||
'iwl_prefix' . $sort,
|
||||
'iwl_title' . $sort,
|
||||
'iwl_from' . $sort
|
||||
));
|
||||
) );
|
||||
}
|
||||
|
||||
$this->addOption( 'LIMIT', $params['limit'] + 1 );
|
||||
|
|
@ -111,7 +111,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
|
|||
$count = 0;
|
||||
$result = $this->getResult();
|
||||
foreach ( $res as $row ) {
|
||||
if ( ++ $count > $params['limit'] ) {
|
||||
if ( ++$count > $params['limit'] ) {
|
||||
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
|
||||
// Continue string preserved in case the redirect query doesn't pass the limit
|
||||
$this->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" );
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@ class ApiQueryIWLinks extends ApiQueryBase {
|
|||
$this->addOption( 'ORDER BY', 'iwl_from' . $sort );
|
||||
} else {
|
||||
$this->addOption( 'ORDER BY', array(
|
||||
'iwl_from' . $sort,
|
||||
'iwl_title' . $sort
|
||||
));
|
||||
'iwl_from' . $sort,
|
||||
'iwl_title' . $sort
|
||||
) );
|
||||
}
|
||||
} else {
|
||||
// Don't order by iwl_from if it's constant in the WHERE clause
|
||||
|
|
@ -91,10 +91,10 @@ class ApiQueryIWLinks extends ApiQueryBase {
|
|||
$this->addOption( 'ORDER BY', 'iwl_prefix' . $sort );
|
||||
} else {
|
||||
$this->addOption( 'ORDER BY', array(
|
||||
'iwl_from' . $sort,
|
||||
'iwl_prefix' . $sort,
|
||||
'iwl_title' . $sort
|
||||
));
|
||||
'iwl_from' . $sort,
|
||||
'iwl_prefix' . $sort,
|
||||
'iwl_title' . $sort
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
if ( !$h ) {
|
||||
$this->setWarning( 'Could not create thumbnail because ' .
|
||||
$image->getName() . ' does not have an associated image handler' );
|
||||
|
||||
return $thumbParams;
|
||||
}
|
||||
|
||||
|
|
@ -278,6 +279,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
// handlers.
|
||||
$this->setWarning( "Could not parse {$p}urlparam for " . $image->getName()
|
||||
. '. Using only width and height' );
|
||||
|
||||
return $thumbParams;
|
||||
}
|
||||
|
||||
|
|
@ -389,7 +391,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
$uploadwarning = isset( $prop['uploadwarning'] );
|
||||
|
||||
if ( ( $url || $sha1 || $meta || $mime || $mediatype || $archive || $bitdepth )
|
||||
&& $file->isDeleted( File::DELETED_FILE ) ) {
|
||||
&& $file->isDeleted( File::DELETED_FILE )
|
||||
) {
|
||||
$vals['filehidden'] = '';
|
||||
|
||||
//Early return, tidier than indenting all following things one level
|
||||
|
|
@ -505,6 +508,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
}
|
||||
}
|
||||
$result->setIndexedTagName( $retval, 'metadata' );
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
|
@ -521,11 +525,13 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
if ( $start === null ) {
|
||||
$start = $img->getTimestamp();
|
||||
}
|
||||
|
||||
return $img->getOriginalTitle()->getDBkey() . '|' . $start;
|
||||
}
|
||||
|
||||
public function getAllowedParams() {
|
||||
global $wgContLang;
|
||||
|
||||
return array(
|
||||
'prop' => array(
|
||||
ApiBase::PARAM_ISMULTI => true,
|
||||
|
|
@ -634,6 +640,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
*/
|
||||
public function getParamDescription() {
|
||||
$p = $this->getModulePrefix();
|
||||
|
||||
return array(
|
||||
'prop' => self::getPropertyDescriptions( array(), $p ),
|
||||
'urlwidth' => array( "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
|
||||
|
|
@ -646,10 +653,10 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
'start' => 'Timestamp to start listing from',
|
||||
'end' => 'Timestamp to stop listing at',
|
||||
'metadataversion' => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
|
||||
"Defaults to '1' for backwards compatibility" ),
|
||||
"Defaults to '1' for backwards compatibility" ),
|
||||
'extmetadatalanguage' => array( 'What language to fetch extmetadata in. This affects both which',
|
||||
'translation to fetch, if multiple are available, as well as how things',
|
||||
'like numbers and various values are formatted.' ),
|
||||
'translation to fetch, if multiple are available, as well as how things',
|
||||
'like numbers and various values are formatted.' ),
|
||||
'extmetadatamultilang' => 'If translations for extmetadata property are available, fetch all of them.',
|
||||
'continue' => 'If the query response includes a continue value, use it here to get another page of results',
|
||||
'localonly' => 'Look only for files in the local repository',
|
||||
|
|
@ -773,6 +780,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
)
|
||||
),
|
||||
);
|
||||
|
||||
return array_diff_key( $props, array_flip( $filter ) );
|
||||
}
|
||||
|
||||
|
|
@ -786,6 +794,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
|
||||
public function getPossibleErrors() {
|
||||
$p = $this->getModulePrefix();
|
||||
|
||||
return array_merge( parent::getPossibleErrors(), array(
|
||||
array( 'code' => "{$p}urlwidth", 'info' => "{$p}urlheight cannot be used without {$p}urlwidth" ),
|
||||
array( 'code' => 'urlparam', 'info' => "Invalid value for {$p}urlparam" ),
|
||||
|
|
|
|||
|
|
@ -79,9 +79,9 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
|
|||
$this->addOption( 'ORDER BY', 'il_to' . $sort );
|
||||
} else {
|
||||
$this->addOption( 'ORDER BY', array(
|
||||
'il_from' . $sort,
|
||||
'il_to' . $sort
|
||||
));
|
||||
'il_from' . $sort,
|
||||
'il_to' . $sort
|
||||
) );
|
||||
}
|
||||
$this->addOption( 'LIMIT', $params['limit'] + 1 );
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
'watch' => array( 'ApiQueryInfo', 'getWatchToken' ),
|
||||
);
|
||||
wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) );
|
||||
|
||||
return $this->tokenFunctions;
|
||||
}
|
||||
|
||||
|
|
@ -333,8 +334,8 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
), $pageid, $pageInfo );
|
||||
if ( !$fit ) {
|
||||
$this->setContinueEnumParameter( 'continue',
|
||||
$title->getNamespace() . '|' .
|
||||
$title->getText() );
|
||||
$title->getNamespace() . '|' .
|
||||
$title->getText() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -465,7 +466,7 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
$this->resetQueryParams();
|
||||
$this->addTables( 'page_restrictions' );
|
||||
$this->addFields( array( 'pr_page', 'pr_type', 'pr_level',
|
||||
'pr_expiry', 'pr_cascade' ) );
|
||||
'pr_expiry', 'pr_cascade' ) );
|
||||
$this->addWhereFld( 'pr_page', array_keys( $this->titles ) );
|
||||
|
||||
$res = $this->select( __METHOD__ );
|
||||
|
|
@ -556,8 +557,8 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
$this->resetQueryParams();
|
||||
$this->addTables( array( 'page_restrictions', 'page', 'templatelinks' ) );
|
||||
$this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
|
||||
'page_title', 'page_namespace',
|
||||
'tl_title', 'tl_namespace' ) );
|
||||
'page_title', 'page_namespace',
|
||||
'tl_title', 'tl_namespace' ) );
|
||||
$this->addWhere( $lb->constructSet( 'tl', $db ) );
|
||||
$this->addWhere( 'pr_page = page_id' );
|
||||
$this->addWhere( 'pr_page = tl_from' );
|
||||
|
|
@ -580,7 +581,7 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
$this->resetQueryParams();
|
||||
$this->addTables( array( 'page_restrictions', 'page', 'imagelinks' ) );
|
||||
$this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
|
||||
'page_title', 'page_namespace', 'il_to' ) );
|
||||
'page_title', 'page_namespace', 'il_to' ) );
|
||||
$this->addWhere( 'pr_page = page_id' );
|
||||
$this->addWhere( 'pr_page = il_from' );
|
||||
$this->addWhereFld( 'pr_cascade', 1 );
|
||||
|
|
@ -633,10 +634,10 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
foreach ( $res as $row ) {
|
||||
if ( MWNamespace::isTalk( $row->page_namespace ) ) {
|
||||
$this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] =
|
||||
intval( $row->page_id );
|
||||
intval( $row->page_id );
|
||||
} else {
|
||||
$this->subjectids[MWNamespace::getTalk( $row->page_namespace )][$row->page_title] =
|
||||
intval( $row->page_id );
|
||||
intval( $row->page_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -761,6 +762,7 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
if ( !is_null( $params['token'] ) ) {
|
||||
return 'private';
|
||||
}
|
||||
|
||||
return 'public';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue