mediawiki-extensions-Popups/includes/ServiceWiring.php
Fomafix 7e3a444a99 Use service 'GadgetsRepo' instead of deprecated GadgetRepo::singleton()
The service is optional to support with and without extension Gadgets.

Change-Id: I41d1516e185ceb5c49b38361360a3adad1a333de
2024-07-03 07:19:28 +00:00

39 lines
1.2 KiB
PHP

<?php
use MediaWiki\Config\Config;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
use Popups\PopupsContext;
use Popups\PopupsGadgetsIntegration;
use Psr\Log\LoggerInterface;
/**
* @codeCoverageIgnore
*/
return [
'Popups.Config' => static function ( MediaWikiServices $services ): Config {
return $services->getService( 'ConfigFactory' )
->makeConfig( PopupsContext::EXTENSION_NAME );
},
'Popups.GadgetsIntegration' => static function ( MediaWikiServices $services ): PopupsGadgetsIntegration {
return new PopupsGadgetsIntegration(
$services->getService( 'Popups.Config' ),
ExtensionRegistry::getInstance()->isLoaded( 'Gadgets' ) ?
$services->getService( 'GadgetsRepo' ) :
null
);
},
'Popups.Logger' => static function ( MediaWikiServices $services ): LoggerInterface {
return LoggerFactory::getInstance( PopupsContext::LOGGER_CHANNEL );
},
'Popups.Context' => static function ( MediaWikiServices $services ): PopupsContext {
return new PopupsContext(
$services->getService( 'Popups.Config' ),
ExtensionRegistry::getInstance(),
$services->getService( 'Popups.GadgetsIntegration' ),
$services->getSpecialPageFactory(),
$services->getUserOptionsLookup()
);
}
];