X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRandompage.php;h=c4ea005a5525f65f3a60e5d655191d50402acd0a;hb=1dd54d80af8403c0f36746f482a46ffb41fb28ed;hp=e3b567d7fe69c28a9235ee93745794d876661e88;hpb=ce079cf6ad79ca8d3360817f809b219d166f9153;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialRandompage.php b/includes/specials/SpecialRandompage.php index e3b567d7fe..c4ea005a55 100644 --- a/includes/specials/SpecialRandompage.php +++ b/includes/specials/SpecialRandompage.php @@ -22,6 +22,8 @@ * @author Rob Church , Ilmari Karonen */ +use MediaWiki\MediaWikiServices; + /** * Special page to direct the user to a random page * @@ -33,7 +35,8 @@ class RandomPage extends SpecialPage { protected $extra = []; // Extra SQL statements public function __construct( $name = 'Randompage' ) { - $this->namespaces = MWNamespace::getContentNamespaces(); + $this->namespaces = MediaWikiServices::getInstance()->getNamespaceInfo()-> + getContentNamespaces(); parent::__construct( $name ); } @@ -54,12 +57,11 @@ class RandomPage extends SpecialPage { } public function execute( $par ) { - global $wgContLang; - if ( is_string( $par ) ) { // Testing for stringiness since we want to catch // the empty string to mean main namespace only. - $this->setNamespace( $wgContLang->getNsIndex( $par ) ); + $this->setNamespace( + MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $par ) ); } $title = $this->getRandomTitle(); @@ -85,17 +87,17 @@ class RandomPage extends SpecialPage { * @return string */ private function getNsList() { - global $wgContLang; + $contLang = MediaWikiServices::getInstance()->getContentLanguage(); $nsNames = []; foreach ( $this->namespaces as $n ) { if ( $n === NS_MAIN ) { $nsNames[] = $this->msg( 'blanknamespace' )->plain(); } else { - $nsNames[] = $wgContLang->getNsText( $n ); + $nsNames[] = $contLang->getNsText( $n ); } } - return $wgContLang->commaList( $nsNames ); + return $contLang->commaList( $nsNames ); } /**