Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Prevent purge after resave entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Stark committed May 3, 2019
1 parent 48f53b7 commit 674d880
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/EventRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 674d880

Please sign in to comment.