2007-01-22 07:43:50 -06:00
|
|
|
module CacheSweepingHelper
|
|
|
|
|
|
|
|
def expire_cached_page(web, page_name)
|
|
|
|
expire_action :controller => 'wiki', :web => web.address,
|
2009-12-13 21:09:12 -06:00
|
|
|
:action => %w(show published s5 tex print history source), :id => page_name
|
2007-01-22 07:43:50 -06:00
|
|
|
expire_action :controller => 'wiki', :web => web.address,
|
2009-03-31 23:37:21 -05:00
|
|
|
:action => 'show', :id => page_name, :mode => 'diff'
|
2007-01-22 07:43:50 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
def expire_cached_summary_pages(web)
|
2009-03-05 21:42:41 -06:00
|
|
|
categories = WikiReference.all(:conditions => "link_type = 'C'")
|
2007-01-22 07:43:50 -06:00
|
|
|
%w(recently_revised list).each do |action|
|
|
|
|
expire_action :controller => 'wiki', :web => web.address, :action => action
|
|
|
|
categories.each do |category|
|
|
|
|
expire_action :controller => 'wiki', :web => web.address, :action => action, :category => category.referenced_name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-01-10 22:33:30 -06:00
|
|
|
%w(authors atom_with_content atom_with_headlines file_list).each do |action|
|
2007-04-13 17:04:03 -05:00
|
|
|
expire_action :controller => 'wiki', :web => web.address, :action => action
|
|
|
|
end
|
2009-01-10 22:33:30 -06:00
|
|
|
|
|
|
|
%w(file_name created_at).each do |sort_order|
|
|
|
|
expire_action :controller => 'wiki', :web => web.address, :action => 'file_list', :sort_order => sort_order
|
|
|
|
end
|
2007-01-22 07:43:50 -06:00
|
|
|
end
|
|
|
|
|
2009-03-31 23:37:21 -05:00
|
|
|
def expire_cached_revisions(page)
|
2009-09-04 00:09:39 -05:00
|
|
|
page.revisions.count.times do |i|
|
2009-03-31 23:37:21 -05:00
|
|
|
revno = i+1
|
|
|
|
expire_action :controller => 'wiki', :web => page.web.address,
|
|
|
|
:action => 'revision', :id => page.name, :rev => revno
|
|
|
|
expire_action :controller => 'wiki', :web => page.web.address,
|
|
|
|
:action => 'revision', :id => page.name, :rev => revno, :mode => 'diff'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-03-08 21:57:21 -06:00
|
|
|
end
|