From: jenkins-bot Date: Thu, 2 Aug 2018 02:44:38 +0000 (+0000) Subject: Merge "Test ApiQuerySiteinfo" X-Git-Tag: 1.34.0-rc.0~4585 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=62c9cce4bd0f70db6ecc1416de8d36c98d7d1c08;hp=-c;p=lhc%2Fweb%2Fwiklou.git Merge "Test ApiQuerySiteinfo" --- 62c9cce4bd0f70db6ecc1416de8d36c98d7d1c08 diff --combined includes/api/ApiQuerySiteinfo.php index 7d4b55f1e0,90435c5ee5..c65dfa543a --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@@ -54,8 -54,7 +54,7 @@@ class ApiQuerySiteinfo extends ApiQuery $fit = $this->appendMagicWords( $p ); break; case 'interwikimap': - $filteriw = $params['filteriw'] ?? false; - $fit = $this->appendInterwikiMap( $p, $filteriw ); + $fit = $this->appendInterwikiMap( $p, $params['filteriw'] ); break; case 'dbrepllag': $fit = $this->appendDbReplLagInfo( $p, $params['showalldb'] ); @@@ -112,7 -111,7 +111,7 @@@ $fit = $this->appendUploadDialog( $p ); break; default: - ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" ); + ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" ); // @codeCoverageIgnore } if ( !$fit ) { // Abuse siprop as a query-continue parameter @@@ -145,7 -144,7 +144,7 @@@ $data['phpversion'] = PHP_VERSION; $data['phpsapi'] = PHP_SAPI; if ( defined( 'HHVM_VERSION' ) ) { - $data['hhvmversion'] = HHVM_VERSION; + $data['hhvmversion'] = HHVM_VERSION; // @codeCoverageIgnore } $data['dbtype'] = $config->get( 'DBtype' ); $data['dbversion'] = $this->getDB()->getServerVersion(); @@@ -229,12 -228,6 +228,6 @@@ $tz = $config->get( 'Localtimezone' ); $offset = $config->get( 'LocalTZoffset' ); - if ( is_null( $tz ) ) { - $tz = 'UTC'; - $offset = 0; - } elseif ( is_null( $offset ) ) { - $offset = 0; - } $data['timezone'] = $tz; $data['timeoffset'] = intval( $offset ); $data['articlepath'] = $config->get( 'ArticlePath' ); @@@ -377,13 -370,13 +370,13 @@@ } protected function appendInterwikiMap( $property, $filter ) { - $local = null; if ( $filter === 'local' ) { $local = 1; } elseif ( $filter === '!local' ) { $local = 0; - } elseif ( $filter ) { - ApiBase::dieDebug( __METHOD__, "Unknown filter=$filter" ); + } else { + // $filter === null + $local = null; } $params = $this->extractRequestParams(); @@@ -663,13 -656,13 +656,13 @@@ $url = $config->get( 'RightsUrl' ); } $text = $config->get( 'RightsText' ); - if ( !$text && $title ) { + if ( $title && !strlen( $text ) ) { $text = $title->getPrefixedText(); } $data = [ - 'url' => $url ?: '', - 'text' => $text ?: '' + 'url' => strlen( $url ) ? $url : '', + 'text' => strlen( $text ) ? $text : '', ]; return $this->getResult()->addValue( 'query', $property, $data ); @@@ -790,7 -783,12 +783,12 @@@ public function appendExtensionTags( $property ) { global $wgParser; $wgParser->firstCallInit(); - $tags = array_map( [ $this, 'formatParserTags' ], $wgParser->getTags() ); + $tags = array_map( + function ( $item ) { + return "<$item>"; + }, + $wgParser->getTags() + ); ApiResult::setArrayType( $tags, 'BCarray' ); ApiResult::setIndexedTagName( $tags, 't' ); @@@ -808,7 -806,7 +806,7 @@@ } public function appendVariables( $property ) { - $variables = MagicWord::getVariableIDs(); + $variables = MediaWikiServices::getInstance()->getMagicWordFactory()->getVariableIDs(); ApiResult::setArrayType( $variables, 'BCarray' ); ApiResult::setIndexedTagName( $variables, 'v' ); @@@ -835,10 -833,6 +833,6 @@@ return $this->getResult()->addValue( 'query', $property, $config ); } - private function formatParserTags( $item ) { - return "<{$item}>"; - } - public function appendSubscribedHooks( $property ) { $hooks = $this->getConfig()->get( 'Hooks' ); $myWgHooks = $hooks;