]> git.agnieray.net Git - galette.git/commitdiff
Do not rely on preferences for cache key on install; fixes #1236
authorJohan Cwiklinski <johan@x-tnd.be>
Sat, 2 Mar 2019 11:58:39 +0000 (12:58 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sat, 2 Mar 2019 11:58:39 +0000 (12:58 +0100)
galette/includes/dependencies.php

index ca1a41ab312a45ae3e489780c245842f406261df..dfa4aa826ad627d367885a6a614a5eaf2029c962 100644 (file)
@@ -402,19 +402,20 @@ $container['fields_config'] = function ($c) {
 
 $container['cache'] = function ($c) {
     $adapter  = null;
-    if (function_exists('apcu_fetch')) {
-        $adapter = (version_compare(PHP_VERSION, '7.0.0') >= 0) ? 'apcu' : 'apc';
-    } elseif (function_exists('wincache_ucache_add')) {
+    if (function_exists('wincache_ucache_add')) {
         //since APCu is not known to work on windows
         $adapter = 'wincache';
+    } elseif (function_exists('apcu_fetch')) {
+        $adapter = (version_compare(PHP_VERSION, '7.0.0') >= 0) ? 'apcu' : 'apc';
     }
     if ($adapter !== null) {
+        $uuid = $c->get('mode') !== 'INSTALL' ? $c->get('preferences')->pref_instance_uuid : '_install';
         $cache = Zend\Cache\StorageFactory::factory([
             'adapter'   => $adapter,
             'options'   => [
                 'namespace' => str_replace(
                     ['%version', '%uuid'],
-                    [GALETTE_VERSION, $c->get('preferences')->pref_instance_uuid],
+                    [GALETTE_VERSION, $uuid],
                     'galette_%version_%uuid'
                 )
             ]