Merge "Improve "selfmove" message's wording"
[lhc/web/wiklou.git] / includes / db / MWLBFactory.php
index 0186222..5196ac2 100644 (file)
@@ -33,9 +33,12 @@ abstract class MWLBFactory {
        /**
         * @param array $lbConf Config for LBFactory::__construct()
         * @param Config $mainConfig Main config object from MediaWikiServices
+        * @param ConfiguredReadOnlyMode $readOnlyMode
         * @return array
         */
-       public static function applyDefaultConfig( array $lbConf, Config $mainConfig ) {
+       public static function applyDefaultConfig( array $lbConf, Config $mainConfig,
+               ConfiguredReadOnlyMode $readOnlyMode
+       ) {
                global $wgCommandLineMode;
 
                static $typesWithSchema = [ 'postgres', 'msssql' ];
@@ -55,10 +58,12 @@ abstract class MWLBFactory {
                        'errorLogger' => [ MWExceptionHandler::class, 'logException' ],
                        'cliMode' => $wgCommandLineMode,
                        'hostname' => wfHostname(),
-                       // TODO: replace the global wfConfiguredReadOnlyReason() with a service.
-                       'readOnlyReason' => wfConfiguredReadOnlyReason(),
+                       'readOnlyReason' => $readOnlyMode->getReason(),
                ];
 
+               // When making changes here, remember to also specify MediaWiki-specific options
+               // for Database classes in the relevant Installer subclass.
+               // Such as MysqlInstaller::openConnection and PostgresInstaller::openConnectionWithParams.
                if ( $lbConf['class'] === 'LBFactorySimple' ) {
                        if ( isset( $lbConf['servers'] ) ) {
                                // Server array is already explicitly configured; leave alone
@@ -144,7 +149,7 @@ abstract class MWLBFactory {
                }
                $cCache = ObjectCache::getLocalClusterInstance();
                if ( $cCache->getQoS( $cCache::ATTR_EMULATION ) > $cCache::QOS_EMULATION_SQL ) {
-                       $lbConf['memCache'] = $cCache;
+                       $lbConf['memStash'] = $cCache;
                }
                $wCache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                if ( $wCache->getQoS( $wCache::ATTR_EMULATION ) > $wCache::QOS_EMULATION_SQL ) {