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