-
-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.x] Add UrlInvalidated
event to fire after a url has been invalidated
#8902
[4.x] Add UrlInvalidated
event to fire after a url has been invalidated
#8902
Conversation
UrlInvalidated
event to fire after an url has been invalidatedUrlInvalidated
event to fire after a url has been invalidated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the url property just concatenate domain and url.
Doing url($url)
didn't work because it always based it on whatever the current request.
So if you've got site configured on multiple domains or subdomains, and you invalidate it while on one of them, the url would be wrong for the other.
'sites' => [
'default' => ['url' => 'http://domain.com'],
'another' => ['url' => 'http://another.com'],
],
While in the CP (which is domain.com) and you invalidate an entry in another
, the event would have this:
UrlInvalidated {
domain: 'http://another.com',
url: '/my-entry',
fullUrl: 'http://domain.com/my-entry', // wrong
}
Since the event has the domain and url already, I just combined them.
UrlInvalidated {
url: 'http://another.com/my-entry'
}
The domain and relative url aren't really important so I removed those. If someone needs them we can add them later.
Cool. Thanks for the changes. |
This PR adds a
UrlInvalidated
event which fires after a URL has been removed from the static cache. This allows a developer to write some logic as a result, for example re-caching the URL.eg.