]> source.dussan.org Git - nextcloud-server.git/commitdiff
Clear opcode caches after writing to the config file, fixes #3372
authorMichael Gapczynski <mtgap@owncloud.com>
Sat, 25 May 2013 15:25:43 +0000 (11:25 -0400)
committerMichael Gapczynski <mtgap@owncloud.com>
Sat, 25 May 2013 15:25:43 +0000 (11:25 -0400)
lib/config.php
lib/util.php

index 9b87d4ce4e52988eca8886d915e8856218f7e9f7..3cbb89fb98138c0de2398a2eaf924ed1d5189ff5 100644 (file)
@@ -187,7 +187,7 @@ class OC_Config{
                }
                // Prevent others not to read the config
                @chmod($filename, 0640);
-
+               OC_Util::clearOpcodeCache();
                return true;
        }
 }
index f30cdf6a5346c93c52fbf0ec9ea5f1403cd82d44..a7ed03792949ccaddcab759dcfe130579bd0892b 100755 (executable)
@@ -822,5 +822,24 @@ class OC_Util {
                return $theme;
        }
 
+       /**
+        * Clear the opcode cache if one exists
+        * This is necessary for writing to the config file
+        * in case the opcode cache doesn't revalidate files
+        */
+       public static function clearOpcodeCache() {
+               // APC
+               if (function_exists('apc_clear_cache')) {
+                       apc_clear_cache();
+               }
+               // Zend Opcache
+               if (function_exists('accelerator_reset')) {
+                       accelerator_reset();
+               }
+               // XCache
+               if (function_exists('xcache_clear_cache')) {
+                       xcache_clear_cache(XC_TYPE_VAR, 0);
+               }
+       }
 
 }