From 74c005d39c19ac81aeaf0103799237229384288c Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 7 Dec 2016 14:48:00 -0700 Subject: [PATCH] Added new `onBeforeCacheClear` event --- CHANGELOG.md | 2 ++ system/src/Grav/Common/Cache.php | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4a7da838..f018b458d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,13 @@ * New retina Media image derivatives array support (`![](image.jpg?derivatives=[640,1024,1440])`) [#1147](https://github.com/getgrav/grav/pull/1147) * Added stream support for images (`![Sepia Image](image://image.jpg?sepia)`) * Added stream support for links (`[Download PDF](user://data/pdf/my.pdf)`) + * Added new `onBeforeCacheClear` event to add custom paths to cache clearing process 1. [](#improved) * Added alias `selfupdate` to the `self-upgrade` `bin/gpm` CLI command * Synced `webserver-configs/htaccess.txt` with `.htaccess` * Use permissions field in group details. * Updated vendor libraries + * Added a warning on GPM update to update Grav first if needed [#1194](https://github.com/getgrav/grav/pull/1194) 1. [](#bugfix) * Fix page collections problem with `@page.modular` [#1178](https://github.com/getgrav/grav/pull/1178) * Fix issue with using a multiple taxonomy filter of which one had no results, thanks to @hughbris [#1184](https://github.com/getgrav/grav/issues/1184) diff --git a/system/src/Grav/Common/Cache.php b/system/src/Grav/Common/Cache.php index 048260527..208e3d91e 100644 --- a/system/src/Grav/Common/Cache.php +++ b/system/src/Grav/Common/Cache.php @@ -11,7 +11,7 @@ namespace Grav\Common; use \Doctrine\Common\Cache as DoctrineCache; use Grav\Common\Config\Config; use Grav\Common\Filesystem\Folder; -use Grav\Common\Grav; +use RocketTheme\Toolbox\Event\Event; /** * The GravCache object is used throughout Grav to store and retrieve cached data. @@ -356,6 +356,8 @@ class Cache extends Getters $remove_paths = self::$standard_remove; } + // Clearing cache event to add paths to clear + Grav::instance()->fireEvent('onBeforeCacheClear', new Event(['paths' => &$remove_paths])); foreach ($remove_paths as $stream) {