diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-22 08:16:30 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-22 08:16:30 +0400 |
commit | c5cffeff1ff9d476473e337c7a86a2b48d50981c (patch) | |
tree | a6fbc4d2e57e0ca6fd157ae194fb666871835628 /core | |
parent | 34c2171002b28726e793819d3a1255f6fb1f02f6 (diff) |
Try to fix build w/ opcache...
Diffstat (limited to 'core')
-rw-r--r-- | core/CacheFile.php | 6 | ||||
-rw-r--r-- | core/Filesystem.php | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/core/CacheFile.php b/core/CacheFile.php index 496e4c14e2..e37959781e 100644 --- a/core/CacheFile.php +++ b/core/CacheFile.php @@ -186,7 +186,11 @@ class CacheFile */ public function deleteAll() { - Filesystem::unlinkRecursive($this->cachePath, $deleteRootToo = false); + $beforeUnlink = function ($path) use ($self) { + $self->opCacheInvalidate($path); + }; + + Filesystem::unlinkRecursive($this->cachePath, $deleteRootToo = false, $beforeUnlink); } private function opCacheInvalidate($filepath) diff --git a/core/Filesystem.php b/core/Filesystem.php index 34b66ed777..51bdc5fee8 100644 --- a/core/Filesystem.php +++ b/core/Filesystem.php @@ -192,8 +192,9 @@ class Filesystem * * @param string $dir Directory name * @param boolean $deleteRootToo Delete specified top-level directory as well + * @param Closure|false $beforeUnlink A closure to execute before unlinking. */ - public static function unlinkRecursive($dir, $deleteRootToo) + public static function unlinkRecursive($dir, $deleteRootToo, $beforeUnlink = false) { if (!$dh = @opendir($dir)) { return; @@ -203,8 +204,13 @@ class Filesystem continue; } - if (!@unlink($dir . '/' . $obj)) { - self::unlinkRecursive($dir . '/' . $obj, true); + $path = $dir . '/' . $obj; + if ($beforeUnlink) { + $beforeUnlink($path); + } + + if (!@unlink($path)) { + self::unlinkRecursive($path, true); } } closedir($dh); |