* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Give information about the version of MediaWiki, PHP, the DB and extensions
*
* @param string|null $par
*/
public function execute( $par ) {
- global $IP, $wgExtensionCredits;
+ global $IP;
+ $config = $this->getConfig();
+ $extensionCredits = $config->get( 'ExtensionCredits' );
$this->setHeaders();
$this->outputHeader();
if ( isset( $parts[1] ) ) {
$extName = str_replace( '_', ' ', $parts[1] );
// Find it!
- foreach ( $wgExtensionCredits as $group => $extensions ) {
+ foreach ( $extensionCredits as $group => $extensions ) {
foreach ( $extensions as $ext ) {
if ( isset( $ext['name'] ) && ( $ext['name'] === $extName ) ) {
$extNode = &$ext;
'Victor Vasiliev', 'Rotem Liss', 'Platonides', 'Antoine Musso',
'Timo Tijhof', 'Daniel Kinzler', 'Jeroen De Dauw', 'Brad Jorsch',
'Bartosz DziewoĆski', 'Ed Sanders', 'Moriel Schottlender',
+ 'Kunal Mehta', 'James D. Forrester', 'Brian Wolff', 'Adam Shorland',
$othersLink, $translatorsLink
];
* @return string Wikitext
*/
public function getExtensionCredits() {
- global $wgExtensionCredits;
+ $config = $this->getConfig();
+ $extensionCredits = $config->get( 'ExtensionCredits' );
if (
- count( $wgExtensionCredits ) === 0 ||
+ count( $extensionCredits ) === 0 ||
// Skins are displayed separately, see getSkinCredits()
- ( count( $wgExtensionCredits ) === 1 && isset( $wgExtensionCredits['skin'] ) )
+ ( count( $extensionCredits ) === 1 && isset( $extensionCredits['skin'] ) )
) {
return '';
}
Xml::openElement( 'table', [ 'class' => 'wikitable plainlinks', 'id' => 'sv-ext' ] );
// Make sure the 'other' type is set to an array.
- if ( !array_key_exists( 'other', $wgExtensionCredits ) ) {
- $wgExtensionCredits['other'] = [];
+ if ( !array_key_exists( 'other', $extensionCredits ) ) {
+ $extensionCredits['other'] = [];
}
// Find all extensions that do not have a valid type and give them the type 'other'.
- foreach ( $wgExtensionCredits as $type => $extensions ) {
+ foreach ( $extensionCredits as $type => $extensions ) {
if ( !array_key_exists( $type, $extensionTypes ) ) {
- $wgExtensionCredits['other'] = array_merge( $wgExtensionCredits['other'], $extensions );
+ $extensionCredits['other'] = array_merge( $extensionCredits['other'], $extensions );
}
}
* @return string HTML output
*/
protected function getParserTags() {
- global $wgParser;
-
- $tags = $wgParser->getTags();
+ $tags = MediaWikiServices::getInstance()->getParser()->getTags();
if ( count( $tags ) ) {
$out = Html::rawElement(
* @return string HTML output
*/
protected function getParserFunctionHooks() {
- global $wgParser;
-
- $fhooks = $wgParser->getFunctionHooks();
+ $fhooks = MediaWikiServices::getInstance()->getParser()->getFunctionHooks();
if ( count( $fhooks ) ) {
$out = Html::rawElement(
'h2',
* @return string
*/
protected function getExtensionCategory( $type, $message ) {
- global $wgExtensionCredits;
+ $config = $this->getConfig();
+ $extensionCredits = $config->get( 'ExtensionCredits' );
$out = '';
- if ( array_key_exists( $type, $wgExtensionCredits ) && count( $wgExtensionCredits[$type] ) > 0 ) {
+ if ( array_key_exists( $type, $extensionCredits ) && count( $extensionCredits[$type] ) > 0 ) {
$out .= $this->openExtType( $message, 'credits-' . $type );
- usort( $wgExtensionCredits[$type], [ $this, 'compare' ] );
+ usort( $extensionCredits[$type], [ $this, 'compare' ] );
- foreach ( $wgExtensionCredits[$type] as $extension ) {
+ foreach ( $extensionCredits[$type] as $extension ) {
$out .= $this->getCreditsForExtension( $type, $extension );
}
}
[ 'class' => 'mw-version-ext-name' ]
);
} else {
- $extensionNameLink = $extensionName;
+ $extensionNameLink = htmlspecialchars( $extensionName );
}
// ... and the version information
$vcsDate = null;
if ( isset( $extension['version'] ) ) {
- $canonicalVersion = $out->parseInline( $extension['version'] );
+ $canonicalVersion = $out->parseInlineAsInterface( $extension['version'] );
}
if ( isset( $extension['path'] ) ) {
if ( isset( $extension['name'] ) ) {
$licenseName = null;
if ( isset( $extension['license-name'] ) ) {
- $licenseName = new HtmlArmor( $out->parseInline( $extension['license-name'] ) );
+ $licenseName = new HtmlArmor( $out->parseInlineAsInterface( $extension['license-name'] ) );
} elseif ( $this->getExtLicenseFileName( $extensionPath ) ) {
$licenseName = $this->msg( 'version-ext-license' )->text();
}
} else {
$description = '';
}
- $description = $out->parseInline( $description );
+ $description = $out->parseInlineAsInterface( $description );
// ... now get the authors for this extension
$authors = $extension['author'] ?? [];
$ret[] = Html::closeElement( 'table' );
return implode( "\n", $ret );
- } else {
- return '';
}
+
+ return '';
}
private function openExtType( $text = null, $name = null ) {
$list[] = $text;
} elseif ( substr( $item, -5 ) == ' ...]' ) {
$hasOthers = true;
- $list[] = $this->getOutput()->parseInline(
+ $list[] = $this->getOutput()->parseInlineAsInterface(
substr( $item, 0, -4 ) . $this->msg( 'version-poweredby-others' )->text() . "]"
);
} else {
- $list[] = $this->getOutput()->parseInline( $item );
+ $list[] = $this->getOutput()->parseInlineAsInterface( $item );
}
}
* @return string Wikitext
*/
public function getEntryPointInfo() {
- global $wgArticlePath, $wgScriptPath;
- $scriptPath = $wgScriptPath ?: "/";
+ $config = $this->getConfig();
+ $scriptPath = $config->get( 'ScriptPath' ) ?: '/';
+
$entryPoints = [
- 'version-entrypoints-articlepath' => $wgArticlePath,
+ 'version-entrypoints-articlepath' => $config->get( 'ArticlePath' ),
'version-entrypoints-scriptpath' => $scriptPath,
'version-entrypoints-index-php' => wfScript( 'index' ),
'version-entrypoints-api-php' => wfScript( 'api' ),
foreach ( $entryPoints as $message => $value ) {
$url = wfExpandUrl( $value, PROTO_RELATIVE );
$out .= Html::openElement( 'tr' ) .
- // ->text() looks like it should be ->parse(), but this function
+ // ->plain() looks like it should be ->parse(), but this function
// returns wikitext, not HTML, boo
- Html::rawElement( 'td', [], $this->msg( $message )->text() ) .
+ Html::rawElement( 'td', [], $this->msg( $message )->plain() ) .
Html::rawElement( 'td', [], Html::rawElement( 'code', [], "[$url $value]" ) ) .
Html::closeElement( 'tr' );
}