From: Timo Tijhof Date: Wed, 4 Jun 2014 19:22:14 +0000 (+0200) Subject: Installer: Disable broken CACHE_DB after backend is disabled X-Git-Tag: 1.31.0-rc.0~15472^2~1 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=7263871639a72989f87ca3a1851c4eb16e382d7c;p=lhc%2Fweb%2Fwiklou.git Installer: Disable broken CACHE_DB after backend is disabled We're currently not hitting any code that calls wfGetCache(), but this seems like a good thing to do and would allow us to re-use more code instead of duplicating a large method just because it has a call to wfGetCache() somewhere. This is already done for DB access and LocalisationCache in general by the installer, but via SqlBagOStuff it can still cause an exception from LBFactoryFake. Change-Id: I69c1e34365c1d7503aea8ef47942d20c34318e85 --- diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 17c5ab230b..88478f4037 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -351,10 +351,23 @@ abstract class Installer { public function __construct() { global $wgMessagesDirs, $wgUser; - // Disable the i18n cache and LoadBalancer + // Disable the i18n cache Language::getLocalisationCache()->disableBackend(); + // Disable LoadBalancer and wfGetDB etc. LBFactory::disableBackend(); + // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and + // SqlBagOStuff will then throw since we just disabled wfGetDB) + $GLOBALS['wgMemc'] = new EmptyBagOStuff; + ObjectCache::clear(); + $emptyCache = array( 'class' => 'EmptyBagOStuff' ); + $GLOBALS['wgObjectCaches'] = array( + CACHE_NONE => $emptyCache, + CACHE_DB => $emptyCache, + CACHE_ANYTHING => $emptyCache, + CACHE_MEMCACHED => $emptyCache, + ); + // Load the installer's i18n. $wgMessagesDirs['MediawikiInstaller'] = __DIR__ . '/i18n'; @@ -389,7 +402,7 @@ abstract class Installer { $this->compiledDBs = $compiledDBs; $this->parserTitle = Title::newFromText( 'Installer' ); - $this->parserOptions = new ParserOptions; // language will be wrong :( + $this->parserOptions = new ParserOptions; // language will be wrong :( $this->parserOptions->setEditSection( false ); }