mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Import new XE functions clearStatCache() and invalidateOpcache()
xpressengine/xe-core 23ec7b7 라이믹스는 Storage 클래스에서 파일을 쓸 때마다 opcache와 stat cache를 자동으로 비워주고 있으므로 이런 조치가 필요하지 않으나, XE와의 호환성을 위해 동일한 함수를 제공함. 사용을 권장하지 않음.
This commit is contained in:
parent
cfe5ae01d3
commit
b25ce87ae5
1 changed files with 58 additions and 0 deletions
|
|
@ -818,6 +818,64 @@ class FileHandler
|
|||
$path = self::getRealPath($path);
|
||||
return Rhymix\Framework\Storage::isDirectory($path) && Rhymix\Framework\Storage::isWritable($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* Clears file status cache
|
||||
*
|
||||
* @param string|array $target filename or directory
|
||||
* @param boolean $include include files in the directory
|
||||
*/
|
||||
public static function clearStatCache($target, $include = false)
|
||||
{
|
||||
foreach(is_array($target) ? $target : array($target) as $target_item)
|
||||
{
|
||||
$target_item = self::getRealPath($target_item);
|
||||
if($include && self::isDir($target_item))
|
||||
{
|
||||
self::clearStatCache(self::readDir($target_item, '', false, true), $include);
|
||||
}
|
||||
else
|
||||
{
|
||||
clearstatcache(true, $target_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* Invalidates a cached script of OPcache
|
||||
*
|
||||
* @param string|array $target filename or directory
|
||||
* @param boolean $force force
|
||||
*/
|
||||
public static function invalidateOpcache($target, $force = true)
|
||||
{
|
||||
static $opcache = null;
|
||||
|
||||
if($opcache === null)
|
||||
{
|
||||
$opcache = function_exists('opcache_invalidate');
|
||||
}
|
||||
if($opcache === false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(is_array($target) ? $target : array($target) as $target_item)
|
||||
{
|
||||
if(substr($target_item, -4) === '.php')
|
||||
{
|
||||
opcache_invalidate(self::getRealPath($target_item), $force);
|
||||
}
|
||||
elseif($path = self::isDir($target_item))
|
||||
{
|
||||
self::invalidateOpcache(self::readDir($path, '', false, true), $force);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file FileHandler.class.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue