From 674d8807677fb7ace655575fb5e23e0be805ee45 Mon Sep 17 00:00:00 2001 From: Oliver Stark Date: Fri, 3 May 2019 14:20:36 +0200 Subject: [PATCH] Prevent purge after resave entries --- CHANGELOG.md | 3 +++ composer.json | 2 +- src/EventRegistrar.php | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd72652..6622aa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## [1.5.1] - 2019-05-03 +- Prevent purge on resaving + ## [1.5.0] - 2019-03-12 - Added support for multiple varnish servers (@larsboldt) - Fixed a bug when using `keyPrefix` diff --git a/composer.json b/composer.json index fdc47e2..47f0054 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "ostark/upper", "description": "A cache plugin for Craft - supporting multiple Edge Caches", "type": "craft-plugin", - "version": "1.5.0", + "version": "1.5.1", "keywords": [ "craft", "cms", diff --git a/src/EventRegistrar.php b/src/EventRegistrar.php index e394e8c..d400331 100644 --- a/src/EventRegistrar.php +++ b/src/EventRegistrar.php @@ -202,6 +202,11 @@ protected static function handleUpdateEvent(Event $event) return; } + // Prevent purge on resaving + if (property_exists($event->element, 'resaving') && $event->element->resaving === true) { + return; + } + if ($event->element instanceof \craft\elements\GlobalSet && is_string($event->element->handle)) { $tags[] = $event->element->handle; } elseif ($event->element instanceof \craft\elements\Asset && $event->isNew) {