mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 08:50:33 +00:00
Inject service SpecialPageFactory
Change-Id: Ia38b468741bdfd5bab5bb34df79bf01d549498a9
This commit is contained in:
parent
4874172242
commit
56d8a8df55
|
@ -24,6 +24,7 @@ use Config;
|
|||
use ExtensionRegistry;
|
||||
use MediaWiki\Extension\BetaFeatures\BetaFeatures;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\SpecialPage\SpecialPageFactory;
|
||||
use MediaWiki\User\UserOptionsLookup;
|
||||
use Title;
|
||||
|
||||
|
@ -95,6 +96,11 @@ class PopupsContext {
|
|||
*/
|
||||
private $gadgetsIntegration;
|
||||
|
||||
/**
|
||||
* @var SpecialPageFactory
|
||||
*/
|
||||
private $specialPageFactory;
|
||||
|
||||
/**
|
||||
* @var UserOptionsLookup
|
||||
*/
|
||||
|
@ -104,6 +110,7 @@ class PopupsContext {
|
|||
* @param Config $config Mediawiki configuration
|
||||
* @param ExtensionRegistry $extensionRegistry MediaWiki extension registry
|
||||
* @param PopupsGadgetsIntegration $gadgetsIntegration Gadgets integration helper
|
||||
* @param SpecialPageFactory $specialPageFactory
|
||||
* @param UserOptionsLookup $userOptionsLookup
|
||||
* events
|
||||
*/
|
||||
|
@ -111,10 +118,12 @@ class PopupsContext {
|
|||
Config $config,
|
||||
ExtensionRegistry $extensionRegistry,
|
||||
PopupsGadgetsIntegration $gadgetsIntegration,
|
||||
SpecialPageFactory $specialPageFactory,
|
||||
UserOptionsLookup $userOptionsLookup
|
||||
) {
|
||||
$this->extensionRegistry = $extensionRegistry;
|
||||
$this->gadgetsIntegration = $gadgetsIntegration;
|
||||
$this->specialPageFactory = $specialPageFactory;
|
||||
$this->userOptionsLookup = $userOptionsLookup;
|
||||
|
||||
$this->config = $config;
|
||||
|
@ -241,7 +250,7 @@ class PopupsContext {
|
|||
|
||||
if ( $title->isSpecialPage() ) {
|
||||
// it's special page, translate it to canonical name
|
||||
[ $name, $subpage ] = MediaWikiServices::getInstance()->getSpecialPageFactory()
|
||||
[ $name, $subpage ] = $this->specialPageFactory
|
||||
->resolveAlias( $canonicalTitle->getText() );
|
||||
|
||||
if ( $name !== null ) {
|
||||
|
|
|
@ -27,6 +27,7 @@ return [
|
|||
$services->getService( 'Popups.Config' ),
|
||||
ExtensionRegistry::getInstance(),
|
||||
$services->getService( 'Popups.GadgetsIntegration' ),
|
||||
$services->getSpecialPageFactory(),
|
||||
$services->getUserOptionsLookup()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -50,12 +50,13 @@ class PopupsContextTest extends MediaWikiIntegrationTestCase {
|
|||
$integration->method( 'conflictsWithNavPopupsGadget' )
|
||||
->willReturn( false );
|
||||
}
|
||||
$userOptionsLookup = MediaWikiServices::getInstance()->getUserOptionsLookup();
|
||||
$services = MediaWikiServices::getInstance();
|
||||
return new PopupsContext(
|
||||
$config,
|
||||
$registry,
|
||||
$integration,
|
||||
$userOptionsLookup
|
||||
$services->getSpecialPageFactory(),
|
||||
$services->getUserOptionsLookup()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue