4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/refinerycms_varnish/page_extension.rb', line 4
def self.included(base)
base.after_save :purge_page
base.after_destroy :purge_page
base.class_eval do
private
def purge_page
if ((self.respond_to?(:title_changed?) and self.title_changed?) or self.link_url_changed?) and self.
ActionController::Base.purge "/", true
elsif self.link_url and self.link_url.starts_with?("/")
ActionController::Base.purge self.link_url
else
ActionController::Base.purge "/#{self.slug.name}"
end
if (path = RefinerySetting.find_or_set(:always_purge_path, '')).size > 0
ActionController::Base.purge path
end
end
end
end
|