From eaac77881f0618845bb88d63e24838e1243aea31 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 8 Mar 2018 14:52:49 -0700 Subject: [PATCH] Force clearing PHP `clearstatcache` and `opcache-reset` on `Cache::clear()` --- CHANGELOG.md | 1 + system/src/Grav/Common/Cache.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b22a76af6..676fd9e7bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * Vendor library updated to latest * Improved `Session` initialization * Added ability to set a `theme_var()` option in page frontmatter + * Force clearing PHP `clearstatcache` and `opcache-reset` on `Cache::clear()` 1. [](#bugfix) * Fixed issue with image alt tag always getting empted out unless set in markdown * Fixed issue with remote PHP version determination for Grav updates [#1883](https://github.com/getgrav/grav/issues/1883) diff --git a/system/src/Grav/Common/Cache.php b/system/src/Grav/Common/Cache.php index a44c407cad..71eb29ff75 100644 --- a/system/src/Grav/Common/Cache.php +++ b/system/src/Grav/Common/Cache.php @@ -429,6 +429,14 @@ public static function clearCache($remove = 'standard') $output[] = ''; } + // Clear stat cache + @clearstatcache(); + + // Clear opcache + if (function_exists('opcache_reset')) { + @opcache_reset(); + } + return $output; }