aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiQueryQueryPage.php
diff options
context:
space:
mode:
authorKunal Mehta <legoktm@member.fsf.org>2016-02-17 01:09:32 -0800
committerKunal Mehta <legoktm@member.fsf.org>2016-02-17 01:33:00 -0800
commit6e9b4f0e9ce4ccd6089c18b205065ef7fa077484 (patch)
tree58645fbce5c12d01b0d0fa87e338d4745e08920d /includes/api/ApiQueryQueryPage.php
parent2fd379fa95f223c6b3f3c8eff6de068eca9e1a1a (diff)
downloadmediawikicore-6e9b4f0e9ce4ccd6089c18b205065ef7fa077484.tar.gz
mediawikicore-6e9b4f0e9ce4ccd6089c18b205065ef7fa077484.zip
Convert all array() syntax to []
Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
Diffstat (limited to 'includes/api/ApiQueryQueryPage.php')
-rw-r--r--includes/api/ApiQueryQueryPage.php36
1 files changed, 18 insertions, 18 deletions
diff --git a/includes/api/ApiQueryQueryPage.php b/includes/api/ApiQueryQueryPage.php
index 650ac8fef91d..9ba757c0784c 100644
--- a/includes/api/ApiQueryQueryPage.php
+++ b/includes/api/ApiQueryQueryPage.php
@@ -36,7 +36,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
parent::__construct( $query, $moduleName, 'qp' );
// Build mapping from special page names to QueryPage classes
$uselessQueryPages = $this->getConfig()->get( 'APIUselessQueryPages' );
- $this->qpMap = array();
+ $this->qpMap = [];
foreach ( QueryPage::getPages() as $page ) {
if ( !in_array( $page[1], $uselessQueryPages ) ) {
$this->qpMap[$page[1]] = $page[0];
@@ -65,7 +65,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
$this->dieUsageMsg( 'specialpage-cantexecute' );
}
- $r = array( 'name' => $params['page'] );
+ $r = [ 'name' => $params['page'] ];
if ( $qp->isCached() ) {
if ( !$qp->isCacheable() ) {
$r['disabled'] = true;
@@ -78,7 +78,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
$r['maxresults'] = $this->getConfig()->get( 'QueryCacheLimit' );
}
}
- $result->addValue( array( 'query' ), $this->getModuleName(), $r );
+ $result->addValue( [ 'query' ], $this->getModuleName(), $r );
if ( $qp->isCached() && !$qp->isCacheable() ) {
// Disabled query page, don't run the query
@@ -87,7 +87,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
$res = $qp->doQuery( $params['offset'], $params['limit'] + 1 );
$count = 0;
- $titles = array();
+ $titles = [];
foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
// We've had enough
@@ -97,19 +97,19 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
$title = Title::makeTitle( $row->namespace, $row->title );
if ( is_null( $resultPageSet ) ) {
- $data = array( 'value' => $row->value );
+ $data = [ 'value' => $row->value ];
if ( $qp->usesTimestamps() ) {
$data['timestamp'] = wfTimestamp( TS_ISO_8601, $row->value );
}
self::addTitleInfo( $data, $title );
foreach ( $row as $field => $value ) {
- if ( !in_array( $field, array( 'namespace', 'title', 'value', 'qc_type' ) ) ) {
+ if ( !in_array( $field, [ 'namespace', 'title', 'value', 'qc_type' ] ) ) {
$data['databaseResult'][$field] = $value;
}
}
- $fit = $result->addValue( array( 'query', $this->getModuleName(), 'results' ), null, $data );
+ $fit = $result->addValue( [ 'query', $this->getModuleName(), 'results' ], null, $data );
if ( !$fit ) {
$this->setContinueEnumParameter( 'offset', $params['offset'] + $count - 1 );
break;
@@ -120,7 +120,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
}
if ( is_null( $resultPageSet ) ) {
$result->addIndexedTagName(
- array( 'query', $this->getModuleName(), 'results' ),
+ [ 'query', $this->getModuleName(), 'results' ],
'page'
);
} else {
@@ -139,30 +139,30 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
}
public function getAllowedParams() {
- return array(
- 'page' => array(
+ return [
+ 'page' => [
ApiBase::PARAM_TYPE => array_keys( $this->qpMap ),
ApiBase::PARAM_REQUIRED => true
- ),
- 'offset' => array(
+ ],
+ 'offset' => [
ApiBase::PARAM_DFLT => 0,
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
- ),
- 'limit' => array(
+ ],
+ 'limit' => [
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_TYPE => 'limit',
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
- ),
- );
+ ],
+ ];
}
protected function getExamplesMessages() {
- return array(
+ return [
'action=query&list=querypage&qppage=Ancientpages'
=> 'apihelp-query+querypage-example-ancientpages',
- );
+ ];
}
public function getHelpUrls() {