X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2FGenderCache.php;h=eedc3c6f04ca2c97c6b65995b21d02a1d673b42e;hb=e73328601d51674e8fef89c3db12b30ceafd702f;hp=7228814d4702edf3eace6108473b4576f4e618b8;hpb=f506a05aaa035b96537b33244b0f18b093048e97;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/GenderCache.php b/includes/cache/GenderCache.php index 7228814d47..eedc3c6f04 100644 --- a/includes/cache/GenderCache.php +++ b/includes/cache/GenderCache.php @@ -34,6 +34,13 @@ class GenderCache { protected $misses = 0; protected $missLimit = 1000; + /** @var NamespaceInfo */ + private $nsInfo; + + public function __construct( NamespaceInfo $nsInfo = null ) { + $this->nsInfo = $nsInfo ?? MediaWikiServices::getInstance()->getNamespaceInfo(); + } + /** * @deprecated in 1.28 see MediaWikiServices::getInstance()->getGenderCache() * @return GenderCache @@ -97,7 +104,7 @@ class GenderCache { public function doLinkBatch( $data, $caller = '' ) { $users = []; foreach ( $data as $ns => $pagenames ) { - if ( !MWNamespace::hasGenderDistinction( $ns ) ) { + if ( !$this->nsInfo->hasGenderDistinction( $ns ) ) { continue; } foreach ( array_keys( $pagenames ) as $username ) { @@ -122,7 +129,7 @@ class GenderCache { if ( !$titleObj ) { continue; } - if ( !MWNamespace::hasGenderDistinction( $titleObj->getNamespace() ) ) { + if ( !$this->nsInfo->hasGenderDistinction( $titleObj->getNamespace() ) ) { continue; } $users[] = $titleObj->getText();