X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Ftitle%2FNaiveImportTitleFactory.php;h=4da939511c0fa80668acc5c72644aa64fe61fdf4;hb=8ef70696d8f1fd2687c09b42c62fb9d285cfc78f;hp=43c662e71d4abdd773fe72fc31fd4dcecab522f4;hpb=4e90d55fdc9d31d93e24cf05687eb7d180806f44;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/title/NaiveImportTitleFactory.php b/includes/title/NaiveImportTitleFactory.php index 43c662e71d..4da939511c 100644 --- a/includes/title/NaiveImportTitleFactory.php +++ b/includes/title/NaiveImportTitleFactory.php @@ -16,9 +16,10 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @license GPL 2+ */ +use MediaWiki\MediaWikiServices; + /** * A class to convert page titles on a foreign wiki (ForeignTitle objects) into * page titles on the local wiki (Title objects), using a default namespace @@ -40,8 +41,6 @@ class NaiveImportTitleFactory implements ImportTitleFactory { * @return Title|null */ public function createTitleFromForeignTitle( ForeignTitle $foreignTitle ) { - global $wgContLang; - if ( $foreignTitle->isNamespaceIdKnown() ) { $foreignNs = $foreignTitle->getNamespaceId(); @@ -54,7 +53,8 @@ class NaiveImportTitleFactory implements ImportTitleFactory { // Do we have a local namespace by the same name as the foreign // namespace? - $targetNs = $wgContLang->getNsIndex( $foreignTitle->getNamespaceName() ); + $targetNs = MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( + $foreignTitle->getNamespaceName() ); if ( $targetNs !== false ) { return Title::makeTitleSafe( $targetNs, $foreignTitle->getText() ); }