From 36171312ef0e1b9acdea876f300dca8f3ad9982e Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Thu, 5 Nov 2015 17:27:47 -0800 Subject: [PATCH] LocalisationCache: try harder to use LCStoreCDB When the LocalisationCache class is set to 'detect', we prefer LCStoreCDB if $wgCacheDirectory is set, but we default to LCStoreDB otherwise. Rather than give up, we should try wfTempDir(), since any directory that meets its criteria is also suitable for LCStoreCDB. Change-Id: Id3e2d2b18ddb423647bf2e893bcf942722c0e097 --- includes/cache/LocalisationCache.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index fa5e288f8a..03841d6ac0 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -209,7 +209,17 @@ class LocalisationCache { $storeClass = 'LCStoreStaticArray'; break; case 'detect': - $storeClass = $wgCacheDirectory ? 'LCStoreCDB' : 'LCStoreDB'; + if ( !empty( $conf['storeDirectory'] ) ) { + $storeClass = 'LCStoreCDB'; + } else { + $cacheDir = $wgCacheDirectory ?: wfTempDir(); + if ( $cacheDir ) { + $storeConf['directory'] = $cacheDir; + $storeClass = 'LCStoreCDB'; + } else { + $storeClass = 'LCStoreDB'; + } + } break; default: throw new MWException( -- 2.20.1