From: Marius Hoch Date: Mon, 19 Sep 2016 19:01:56 +0000 (+0200) Subject: Fix SQLite $wgObjectCaches definition + b/c handling X-Git-Tag: 1.31.0-rc.0~5474^2 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=2d16cb60693660ede0dc0eeff0970539a1053721;p=lhc%2Fweb%2Fwiklou.git Fix SQLite $wgObjectCaches definition + b/c handling Follow-up to 47e816c69c197fec86c344256d81d7c8f781b880 Change-Id: Id94857a7c8726871cf826a34b5cf10cb465b7125 --- diff --git a/includes/installer/SqliteInstaller.php b/includes/installer/SqliteInstaller.php index 6024331494..9bf87f4d5f 100644 --- a/includes/installer/SqliteInstaller.php +++ b/includes/installer/SqliteInstaller.php @@ -319,6 +319,7 @@ EOT; 'type' => 'sqlite', 'dbname' => 'wikicache', 'tablePrefix' => '', + 'dbDirectory' => \$wgSQLiteDataDir, 'flags' => 0 ] ];"; diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index 1e0013ff99..ea237aa735 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -183,8 +183,25 @@ class ObjectCache { $params['reportDupes'] = isset( $params['reportDupes'] ) ? $params['reportDupes'] : true; + // Do b/c logic for SqlBagOStuff + if ( is_subclass_of( $class, SqlBagOStuff::class ) ) { + if ( isset( $params['server'] ) && !isset( $params['servers'] ) ) { + $params['servers'] = [ $params['server'] ]; + unset( $param['server'] ); + } + // In the past it was not required to set 'dbDirectory' in $wgObjectCaches + if ( isset( $params['servers'] ) ) { + foreach ( $params['servers'] as &$server ) { + if ( $server['type'] === 'sqlite' && !isset( $server['dbDirectory'] ) ) { + $server['dbDirectory'] = MediaWikiServices::getInstance() + ->getMainConfig()->get( 'SQLiteDataDir' ); + } + } + } + } + // Do b/c logic for MemcachedBagOStuff - if ( is_subclass_of( $class, 'MemcachedBagOStuff' ) ) { + if ( is_subclass_of( $class, MemcachedBagOStuff::class ) ) { if ( !isset( $params['servers'] ) ) { $params['servers'] = $GLOBALS['wgMemCachedServers']; }