Use service framework to access Disambiguator extension, not hard-coded class

The Hooks::isDisambiguationPage() method is deprecated in any case.

Change-Id: Id2a10f2f1be0e38ddb8ebef5d5babb3daac3ce9a
This commit is contained in:
C. Scott Ananian 2024-02-02 15:16:15 -05:00
parent 71de06a682
commit 703e142c59

View file

@ -4,7 +4,6 @@ namespace RelatedArticles;
use IContextSource;
use MediaWiki\Config\Config;
use MediaWiki\Extension\Disambiguator\Hooks as DisambiguatorHooks;
use MediaWiki\Hook\BeforePageDisplayHook;
use MediaWiki\Hook\MakeGlobalVariablesScriptHook;
use MediaWiki\Hook\OutputPageParserOutputHook;
@ -54,8 +53,12 @@ class Hooks implements
* @return bool
*/
private static function isDisambiguationPage( Title $title ) {
return \ExtensionRegistry::getInstance()->isLoaded( 'Disambiguator' ) &&
DisambiguatorHooks::isDisambiguationPage( $title );
$services = MediaWikiServices::getInstance();
if ( !$services->hasService( 'DisambiguatorLookup' ) ) {
return false;
}
return $services->getService( 'DisambiguatorLookup' )
->isDisambiguationPage( $title );
}
/**