From: Aryeh Gregor Date: Mon, 30 Jul 2018 17:42:42 +0000 (+0300) Subject: Update LinkHolderArray to use ContentLanguage X-Git-Tag: 1.34.0-rc.0~4489^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=03bf3273e2ae768563d2a8320c9c760964270ada;hp=81c60356ff5836e68ea23a24e915baf3493d7283;p=lhc%2Fweb%2Fwiklou.git Update LinkHolderArray to use ContentLanguage Bug: T200246 Change-Id: Ic954f7752fda8e2a1f34a64b85cce27774014666 --- diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index 66fd723384..f4856be96d 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -282,8 +282,6 @@ class LinkHolderArray { return; } - global $wgContLang; - $colours = []; $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $output = $this->parent->getOutput(); @@ -364,7 +362,7 @@ class LinkHolderArray { } # Do a second query for different language variants of links and categories - if ( $wgContLang->hasVariants() ) { + if ( $this->parent->getContentLanguage()->hasVariants() ) { $this->doVariants( $colours ); } @@ -452,7 +450,6 @@ class LinkHolderArray { * @param array &$colours */ protected function doVariants( &$colours ) { - global $wgContLang; $linkBatch = new LinkBatch(); $variantMap = []; // maps $pdbkey_Variant => $keys (of link holders) $output = $this->parent->getOutput(); @@ -480,7 +477,8 @@ class LinkHolderArray { } // Now do the conversion and explode string to text of titles - $titlesAllVariants = $wgContLang->autoConvertToAllVariants( rtrim( $titlesToBeConverted, "\0" ) ); + $titlesAllVariants = $this->parent->getContentLanguage()-> + autoConvertToAllVariants( rtrim( $titlesToBeConverted, "\0" ) ); $allVariantsName = array_keys( $titlesAllVariants ); foreach ( $titlesAllVariants as &$titlesVariant ) { $titlesVariant = explode( "\0", $titlesVariant ); @@ -521,7 +519,7 @@ class LinkHolderArray { foreach ( $output->getCategoryLinks() as $category ) { $categoryTitle = Title::makeTitleSafe( NS_CATEGORY, $category ); $linkBatch->addObj( $categoryTitle ); - $variants = $wgContLang->autoConvertToAllVariants( $category ); + $variants = $this->parent->getContentLanguage()->autoConvertToAllVariants( $category ); foreach ( $variants as $variant ) { if ( $variant !== $category ) { $variantTitle = Title::makeTitleSafe( NS_CATEGORY, $variant );