Clear opcode caches after writing to the config file, fixes #3372

This commit is contained in:
Michael Gapczynski 2013-05-25 11:25:43 -04:00
parent c62f230ddb
commit 0a29d2029a
2 changed files with 20 additions and 1 deletions

View File

@ -187,7 +187,7 @@ class OC_Config{
}
// Prevent others not to read the config
@chmod($filename, 0640);
OC_Util::clearOpcodeCache();
return true;
}
}

View File

@ -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);
}
}
}