mw.widgets.TitleWidget: Don't mark optional fields as invalid when empty
[lhc/web/wiklou.git] / includes / ServiceWiring.php
index ee92cbf..ba576d5 100644 (file)
@@ -46,7 +46,7 @@ use MediaWiki\Preferences\DefaultPreferencesFactory;
 use MediaWiki\Shell\CommandFactory;
 use MediaWiki\Storage\BlobStoreFactory;
 use MediaWiki\Storage\NameTableStore;
-use MediaWiki\Storage\RevisionStore;
+use MediaWiki\Storage\RevisionStoreFactory;
 use MediaWiki\Storage\SqlBlobStore;
 use Wikimedia\ObjectFactory;
 
@@ -188,29 +188,8 @@ return [
                );
        },
 
-       'CryptRand' => function ( MediaWikiServices $services ) {
-               $secretKey = $services->getMainConfig()->get( 'SecretKey' );
-               return new CryptRand(
-                       [
-                               // To try vary the system information of the state a bit more
-                               // by including the system's hostname into the state
-                               'wfHostname',
-                               // It's mostly worthless but throw the wiki's id into the data
-                               // for a little more variance
-                               'wfWikiID',
-                               // If we have a secret key set then throw it into the state as well
-                               function () use ( $secretKey ) {
-                                       return $secretKey ?: '';
-                               }
-                       ],
-                       // The config file is likely the most often edited file we know should
-                       // be around so include its stat info into the state.
-                       // The constant with its location will almost always be defined, as
-                       // WebStart.php defines MW_CONFIG_FILE to $IP/LocalSettings.php unless
-                       // being configured with MW_CONFIG_CALLBACK (e.g. the installer).
-                       defined( 'MW_CONFIG_FILE' ) ? [ MW_CONFIG_FILE ] : [],
-                       LoggerFactory::getInstance( 'CryptRand' )
-               );
+       'CryptRand' => function () {
+               return new CryptRand();
        },
 
        'CryptHKDF' => function ( MediaWikiServices $services ) {
@@ -231,9 +210,7 @@ return [
                        $cache = ObjectCache::getLocalClusterInstance();
                }
 
-               return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ),
-                       $cache, $context, $services->getCryptRand()
-               );
+               return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ), $cache, $context );
        },
 
        'MediaHandlerFactory' => function ( MediaWikiServices $services ) {
@@ -415,9 +392,7 @@ return [
                foreach ( $config['paths'] as $prefix => $serviceConfig ) {
                        $class = $serviceConfig['class'];
                        // Merge in the global defaults
-                       $constructArg = isset( $serviceConfig['options'] )
-                               ? $serviceConfig['options']
-                               : [];
+                       $constructArg = $serviceConfig['options'] ?? [];
                        $constructArg += $config['global'];
                        // Make the VRS service available at the mount point
                        $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
@@ -488,22 +463,27 @@ return [
        },
 
        'RevisionStore' => function ( MediaWikiServices $services ) {
+               return $services->getRevisionStoreFactory()->getRevisionStore();
+       },
+
+       'RevisionStoreFactory' => function ( MediaWikiServices $services ) {
                /** @var SqlBlobStore $blobStore */
                $blobStore = $services->getService( '_SqlBlobStore' );
+               $config = $services->getMainConfig();
 
-               $store = new RevisionStore(
+               $store = new RevisionStoreFactory(
                        $services->getDBLoadBalancer(),
                        $blobStore,
                        $services->getMainWANObjectCache(),
                        $services->getCommentStore(),
-                       $services->getActorMigration()
+                       $services->getContentModelStore(),
+                       $services->getSlotRoleStore(),
+                       $services->getMainConfig()->get( 'MultiContentRevisionSchemaMigrationStage' ),
+                       $services->getActorMigration(),
+                       LoggerFactory::getInstance( 'RevisionStore' ),
+                       $config->get( 'ContentHandlerUseDB' )
                );
 
-               $store->setLogger( LoggerFactory::getInstance( 'RevisionStore' ) );
-
-               $config = $services->getMainConfig();
-               $store->setContentHandlerUseDB( $config->get( 'ContentHandlerUseDB' ) );
-
                return $store;
        },
 
@@ -562,6 +542,24 @@ return [
                );
        },
 
+       'ChangeTagDefStore' => function ( MediaWikiServices $services ) {
+               return new NameTableStore(
+                       $services->getDBLoadBalancer(),
+                       $services->getMainWANObjectCache(),
+                       LoggerFactory::getInstance( 'NameTableSqlStore' ),
+                       'change_tag_def',
+                       'ctd_id',
+                       'ctd_name',
+                       null,
+                       false,
+                       function ( $insertFields ) {
+                               $insertFields['ctd_user_defined'] = 0;
+                               $insertFields['ctd_count'] = 0;
+                               return $insertFields;
+                       }
+               );
+       },
+
        'PreferencesFactory' => function ( MediaWikiServices $services ) {
                global $wgContLang;
                $authManager = AuthManager::singleton();