mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
Immediately invalidate PHP scripts from opcache if modified or deleted
This commit is contained in:
parent
d300db933e
commit
8d6068ab2b
2 changed files with 14 additions and 9 deletions
|
|
@ -156,6 +156,10 @@ class FileHandler
|
|||
|
||||
@file_put_contents($filename, $buff, $flags|LOCK_EX);
|
||||
@chmod($filename, 0644);
|
||||
if(function_exists('opcache_invalidate') && substr($filename, -4) === '.php')
|
||||
{
|
||||
@opcache_invalidate($filename, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -166,7 +170,16 @@ class FileHandler
|
|||
*/
|
||||
public static function removeFile($filename)
|
||||
{
|
||||
return (($filename = self::exists($filename)) !== FALSE) && @unlink($filename);
|
||||
if(($filename = self::exists($filename)) === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$status = @unlink($filename);
|
||||
if(function_exists('opcache_invalidate') && substr($filename, -4) === '.php')
|
||||
{
|
||||
@opcache_invalidate($filename, true);
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue