Skip to content

Commit

Permalink
add opcache clear to our normal clearcache operation. (#4507)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigh authored Oct 4, 2020
1 parent 383027e commit 6467129
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Zikula/CoreBundle/CacheClearer.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ public function doClear(): void
$this->logger->notice(sprintf('Cache cleared: %s', $cacheType));
}
}
if (function_exists('opcache_reset') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
// This is a brute force clear of _all_ the cached files
// because simply clearing the files in $this->cachesToClear isn't enough.
// Perhaps if we could discern exactly which files to invalidate, we could
// take a more precise approach with @opcache_invalidate($file, true).
@opcache_reset();
$this->logger->notice('OPCache cleared!');
}
// the cache must be warmed after deleting files
$this->warmer->warmUp($this->cacheDir);
}
Expand Down

0 comments on commit 6467129

Please sign in to comment.