From: Michael Gapczynski Date: Sat, 25 May 2013 15:25:43 +0000 (-0400) Subject: Clear opcode caches after writing to the config file, fixes #3372 X-Git-Tag: v6.0.0alpha2~634^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0a29d2029a719d42f347edb95bd6486c2ab842a8;p=nextcloud-server.git Clear opcode caches after writing to the config file, fixes #3372 --- diff --git a/lib/config.php b/lib/config.php index 9b87d4ce4e5..3cbb89fb981 100644 --- a/lib/config.php +++ b/lib/config.php @@ -187,7 +187,7 @@ class OC_Config{ } // Prevent others not to read the config @chmod($filename, 0640); - + OC_Util::clearOpcodeCache(); return true; } } diff --git a/lib/util.php b/lib/util.php index f30cdf6a534..a7ed0379294 100755 --- a/lib/util.php +++ b/lib/util.php @@ -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); + } + } }