$data[ApiResult::META_BC_BOOLS][] = 'variantarticlepath';
$data['server'] = $config->get( 'Server' );
$data['servername'] = $config->get( 'ServerName' );
- $data['wikiid'] = wfWikiID();
+ $data['wikiid'] = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
$data['time'] = wfTimestamp( TS_ISO_8601, time() );
$data['misermode'] = (bool)$config->get( 'MiserMode' );
$data = [
ApiResult::META_TYPE => 'assoc',
];
+ $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
foreach (
MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces()
as $ns => $title
) {
$data[$ns] = [
'id' => (int)$ns,
- 'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
+ 'case' => $nsInfo->isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
];
ApiResult::setContentValue( $data[$ns], 'name', $title );
- $canonical = MWNamespace::getCanonicalName( $ns );
+ $canonical = $nsInfo->getCanonicalName( $ns );
- $data[$ns]['subpages'] = MWNamespace::hasSubpages( $ns );
+ $data[$ns]['subpages'] = $nsInfo->hasSubpages( $ns );
if ( $canonical ) {
$data[$ns]['canonical'] = strtr( $canonical, '_', ' ' );
}
- $data[$ns]['content'] = MWNamespace::isContent( $ns );
- $data[$ns]['nonincludable'] = MWNamespace::isNonincludable( $ns );
+ $data[$ns]['content'] = $nsInfo->isContent( $ns );
+ $data[$ns]['nonincludable'] = $nsInfo->isNonincludable( $ns );
- $contentmodel = MWNamespace::getNamespaceContentModel( $ns );
+ $contentmodel = $nsInfo->getNamespaceContentModel( $ns );
if ( $contentmodel ) {
$data[$ns]['defaultcontentmodel'] = $contentmodel;
}
}
$data = [
- 'url' => strlen( $url ) ? $url : '',
- 'text' => strlen( $text ) ? $text : '',
+ 'url' => (string)$url,
+ 'text' => (string)$text,
];
return $this->getResult()->addValue( 'query', $property, $data );
}
public function appendExtensionTags( $property ) {
- global $wgParser;
$tags = array_map(
function ( $item ) {
return "<$item>";
},
- $wgParser->getTags()
+ MediaWikiServices::getInstance()->getParser()->getTags()
);
ApiResult::setArrayType( $tags, 'BCarray' );
ApiResult::setIndexedTagName( $tags, 't' );
}
public function appendFunctionHooks( $property ) {
- global $wgParser;
- $hooks = $wgParser->getFunctionHooks();
+ $hooks = MediaWikiServices::getInstance()->getParser()->getFunctionHooks();
ApiResult::setArrayType( $hooks, 'BCarray' );
ApiResult::setIndexedTagName( $hooks, 'h' );