MDL-40415 add explicit OPcache support
This commit is contained in:
@@ -142,6 +142,7 @@ class core_component {
|
||||
@chmod($cachefile, $CFG->filepermissions);
|
||||
}
|
||||
@unlink($cachefile.'.tmp'); // Just in case anything fails (race condition).
|
||||
self::invalidate_opcode_php_cache($cachefile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,4 +736,21 @@ $cache = '.var_export($cache, true).';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate opcode cache for given file, this is intended for
|
||||
* php files that are stored in dataroot.
|
||||
*
|
||||
* Note: we need it here because this class must be self-contained.
|
||||
*
|
||||
* @param string $file
|
||||
*/
|
||||
public static function invalidate_opcode_php_cache($file) {
|
||||
if (function_exists('opcache_invalidate')) {
|
||||
if (!file_exists($file)) {
|
||||
return;
|
||||
}
|
||||
opcache_invalidate($file, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user