aelvan / VarnishPurge-Craft

Craft plugin for purging Varnish when elements are saved.
MIT License
33 stars 11 forks source link

URI changes not purged #17

Open timkelty opened 7 years ago

timkelty commented 7 years ago

Since you're using elements.onSaveElement, the element's URI ends up being the newly saved one.

If the URI is being changed, the old one will remain varnished until manually cleared. I added the following to address:

            craft()->on('elements.onBeforeSaveElement', function (Event $event) {
                craft()->varnishpurge->purgeElement($event->params['element'], false);
            });