Merge "Rename BlockRestriction -> BlockRestrictionStore and wire it up as a service"
[lhc/web/wiklou.git] / includes / ServiceWiring.php
index d39a0c7..832cee8 100644 (file)
@@ -39,6 +39,7 @@
 
 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
 use MediaWiki\Auth\AuthManager;
+use MediaWiki\Block\BlockRestrictionStore;
 use MediaWiki\Config\ConfigRepository;
 use MediaWiki\Interwiki\ClassicInterwikiLookup;
 use MediaWiki\Interwiki\InterwikiLookup;
@@ -62,6 +63,7 @@ use MediaWiki\Storage\BlobStore;
 use MediaWiki\Storage\BlobStoreFactory;
 use MediaWiki\Storage\NameTableStoreFactory;
 use MediaWiki\Storage\SqlBlobStore;
+use MediaWiki\Storage\PageEditStash;
 
 return [
        'ActorMigration' => function ( MediaWikiServices $services ) : ActorMigration {
@@ -83,6 +85,12 @@ return [
                );
        },
 
+       'BlockRestrictionStore' => function ( MediaWikiServices $services ) : BlockRestrictionStore {
+               return new BlockRestrictionStore(
+                       $services->getDBLoadBalancer()
+               );
+       },
+
        'CommentStore' => function ( MediaWikiServices $services ) : CommentStore {
                return new CommentStore(
                        $services->getContentLanguage(),
@@ -350,6 +358,20 @@ return [
                );
        },
 
+       'PageEditStash' => function ( MediaWikiServices $services ) : PageEditStash {
+               $config = $services->getMainConfig();
+
+               return new PageEditStash(
+                       ObjectCache::getLocalClusterInstance(),
+                       $services->getDBLoadBalancer(),
+                       LoggerFactory::getInstance( 'StashEdit' ),
+                       $services->getStatsdDataFactory(),
+                       defined( 'MEDIAWIKI_JOB_RUNNER' ) || $config->get( 'CommandLineMode' )
+                               ? PageEditStash::INITIATOR_JOB_OR_CLI
+                               : PageEditStash::INITIATOR_USER
+               );
+       },
+
        'Parser' => function ( MediaWikiServices $services ) : Parser {
                return $services->getParserFactory()->create();
        },
@@ -443,8 +465,17 @@ return [
                        $config,
                        LoggerFactory::getInstance( 'resourceloader' )
                );
+
                $rl->addSource( $config->get( 'ResourceLoaderSources' ) );
+
+               // Core modules, then extension/skin modules
                $rl->register( include "$IP/resources/Resources.php" );
+               $rl->register( $config->get( 'ResourceModules' ) );
+               Hooks::run( 'ResourceLoaderRegisterModules', [ &$rl ] );
+
+               if ( $config->get( 'EnableJavaScriptTest' ) === true ) {
+                       $rl->registerTestModules();
+               }
 
                return $rl;
        },