X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Ftitle%2FNaiveForeignTitleFactory.php;h=307050b7ee9fdd321145202227fc076b469773e1;hb=5264862bc1224fbb2eec487155aa0253af1fa777;hp=44cf90d8da29f244d10d6ba961d5f671c8513af6;hpb=577f3d79115173f4dd16bb46f6d0ef2c82b55add;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/title/NaiveForeignTitleFactory.php b/includes/title/NaiveForeignTitleFactory.php index 44cf90d8da..307050b7ee 100644 --- a/includes/title/NaiveForeignTitleFactory.php +++ b/includes/title/NaiveForeignTitleFactory.php @@ -18,6 +18,8 @@ * @file */ +use MediaWiki\MediaWikiServices; + /** * A parser that translates page titles on a foreign wiki into ForeignTitle * objects, with no knowledge of the namespace setup on the foreign site. @@ -42,8 +44,6 @@ class NaiveForeignTitleFactory implements ForeignTitleFactory { public function createForeignTitle( $title, $ns = null ) { $pieces = explode( ':', $title, 2 ); - global $wgContLang; - /** * Can we assume that the part of the page title before the colon is a * namespace name? @@ -56,9 +56,10 @@ class NaiveForeignTitleFactory implements ForeignTitleFactory { * ID, we fall back to using the local wiki's namespace names to resolve * this -- better than nothing, and mimics the old crappy behavior */ - $isNamespacePartValid = is_null( $ns ) ? - ( $wgContLang->getNsIndex( $pieces[0] ) !== false ) : - $ns != 0; + $isNamespacePartValid = is_null( $ns ) + ? MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $pieces[0] ) !== + false + : $ns != 0; if ( count( $pieces ) === 2 && $isNamespacePartValid ) { list( $namespaceName, $pageName ) = $pieces;