Checkout of Instiki Trunk 1/21/2007.
This commit is contained in:
commit
69b62b6f33
1138 changed files with 139586 additions and 0 deletions
29
app/controllers/revision_sweeper.rb
Normal file
29
app/controllers/revision_sweeper.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require_dependency 'cache_sweeping_helper'
|
||||
|
||||
class RevisionSweeper < ActionController::Caching::Sweeper
|
||||
|
||||
include CacheSweepingHelper
|
||||
|
||||
observe Revision, Page
|
||||
|
||||
def after_save(record)
|
||||
if record.is_a?(Revision)
|
||||
expire_caches(record.page)
|
||||
end
|
||||
end
|
||||
|
||||
def after_delete(record)
|
||||
if record.is_a?(Page)
|
||||
expire_caches(record)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def expire_caches(page)
|
||||
expire_cached_summary_pages(page.web)
|
||||
pages_to_expire = ([page.name] + WikiReference.pages_that_reference(page.name)).uniq
|
||||
pages_to_expire.each { |page_name| expire_cached_page(page.web, page_name) }
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue