mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-08 19:42:15 +09:00
Merge pull request #45 from kijin/fix/opcache-invalidate
PHP 5.5 이상에서 설정 변경시 즉시 적용되지 않는 문제 해결
This commit is contained in:
commit
aa165a073b
2 changed files with 14 additions and 9 deletions
8
classes/cache/CacheFile.class.php
vendored
8
classes/cache/CacheFile.class.php
vendored
|
|
@ -78,10 +78,6 @@ class CacheFile extends CacheBase
|
||||||
$content[] = 'if(!defined(\'__XE__\')) { exit(); }';
|
$content[] = 'if(!defined(\'__XE__\')) { exit(); }';
|
||||||
$content[] = 'return \'' . addslashes(serialize($obj)) . '\';';
|
$content[] = 'return \'' . addslashes(serialize($obj)) . '\';';
|
||||||
FileHandler::writeFile($cache_file, implode(PHP_EOL, $content));
|
FileHandler::writeFile($cache_file, implode(PHP_EOL, $content));
|
||||||
if(function_exists('opcache_invalidate'))
|
|
||||||
{
|
|
||||||
@opcache_invalidate($cache_file, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -145,10 +141,6 @@ class CacheFile extends CacheBase
|
||||||
function _delete($_key)
|
function _delete($_key)
|
||||||
{
|
{
|
||||||
$cache_file = $this->getCacheFileName($_key);
|
$cache_file = $this->getCacheFileName($_key);
|
||||||
if(function_exists('opcache_invalidate'))
|
|
||||||
{
|
|
||||||
@opcache_invalidate($cache_file, true);
|
|
||||||
}
|
|
||||||
FileHandler::removeFile($cache_file);
|
FileHandler::removeFile($cache_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,10 @@ class FileHandler
|
||||||
|
|
||||||
@file_put_contents($filename, $buff, $flags|LOCK_EX);
|
@file_put_contents($filename, $buff, $flags|LOCK_EX);
|
||||||
@chmod($filename, 0644);
|
@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)
|
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