Cache Sweeping
Expire cached revisions of deleted pages. Tweak the appearance of "history" page a bit.
This commit is contained in:
parent
69bfc1028b
commit
98918954e0
|
@ -4,7 +4,7 @@ module CacheSweepingHelper
|
|||
expire_action :controller => 'wiki', :web => web.address,
|
||||
:action => %w(show published s5 tex print history), :id => page_name
|
||||
expire_action :controller => 'wiki', :web => web.address,
|
||||
:action => %w(show published), :id => page_name, :mode => 'diff'
|
||||
:action => 'show', :id => page_name, :mode => 'diff'
|
||||
end
|
||||
|
||||
def expire_cached_summary_pages(web)
|
||||
|
@ -25,4 +25,14 @@ module CacheSweepingHelper
|
|||
end
|
||||
end
|
||||
|
||||
def expire_cached_revisions(page)
|
||||
page.revisions.length.times do |i|
|
||||
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
|
||||
|
||||
end
|
||||
|
|
|
@ -25,6 +25,7 @@ class WebSweeper < ActionController::Caching::Sweeper
|
|||
elsif record.is_a?(Page)
|
||||
expire_cached_page(record.web, record.name)
|
||||
expire_cached_summary_pages(record.web)
|
||||
expire_cached_revisions(record)
|
||||
else
|
||||
expire_cached_summary_pages(record.web)
|
||||
end
|
||||
|
|
|
@ -12,8 +12,10 @@
|
|||
"Revision #{@revision_numbers[rev.id]}" )
|
||||
) %>
|
||||
<%- if @revision_numbers[rev.id] > 1 -%>
|
||||
<span class="views">
|
||||
(<%= link_to_revision(rev.page, @revision_numbers[rev.id],
|
||||
text="diff", mode='diff') %>)
|
||||
</span>
|
||||
<%- end -%>
|
||||
<div class="byline" style="margin-bottom: 0px">
|
||||
by <%= link_to_page(rev.author) %>
|
||||
|
|
|
@ -9,9 +9,11 @@
|
|||
<li>
|
||||
<%= link_to_existing_page page %>
|
||||
<%- if page.revisions.length > 1 %>
|
||||
<span class="views">
|
||||
(<%= link_to_revision(page, page.revisions.length, text='diff',
|
||||
mode='diff') %>)
|
||||
(<%= link_to_history(page, text='history') %>)
|
||||
</span>
|
||||
<%- end -%>
|
||||
<div class="byline" style="margin-bottom: 0px">
|
||||
by <%= link_to_page(page.author) %>
|
||||
|
|
Loading…
Reference in a new issue