Cache Source View
Also, fix a cache-sweeping bug reported, long ago, by Toby Bartels.
This commit is contained in:
parent
1613973929
commit
dc3d202665
|
@ -2,7 +2,7 @@ module CacheSweepingHelper
|
||||||
|
|
||||||
def expire_cached_page(web, page_name)
|
def expire_cached_page(web, page_name)
|
||||||
expire_action :controller => 'wiki', :web => web.address,
|
expire_action :controller => 'wiki', :web => web.address,
|
||||||
:action => %w(show published s5 tex print history), :id => page_name
|
:action => %w(show published s5 tex print history source), :id => page_name
|
||||||
expire_action :controller => 'wiki', :web => web.address,
|
expire_action :controller => 'wiki', :web => web.address,
|
||||||
:action => 'show', :id => page_name, :mode => 'diff'
|
:action => 'show', :id => page_name, :mode => 'diff'
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,8 @@ class RevisionSweeper < ActionController::Caching::Sweeper
|
||||||
observe Revision, Page
|
observe Revision, Page
|
||||||
|
|
||||||
def before_save(record)
|
def before_save(record)
|
||||||
if record.is_a?(Revision)
|
if record.is_a?(Revision)
|
||||||
|
expire_cached_page(record.page.web, record.page.name)
|
||||||
expire_cached_revisions(record.page)
|
expire_cached_revisions(record.page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
before_filter :load_page
|
before_filter :load_page
|
||||||
before_filter :dnsbl_check, :only => [:edit, :new, :save, :export_html, :export_markup]
|
before_filter :dnsbl_check, :only => [:edit, :new, :save, :export_html, :export_markup]
|
||||||
caches_action :show, :published, :authors, :tex, :s5, :print, :recently_revised, :list, :file_list,
|
caches_action :show, :published, :authors, :tex, :s5, :print, :recently_revised, :list, :file_list, :source,
|
||||||
:history, :revision, :atom_with_content, :atom_with_headlines, :if => Proc.new { |c| c.send(:do_caching?) }
|
:history, :revision, :atom_with_content, :atom_with_headlines, :if => Proc.new { |c| c.send(:do_caching?) }
|
||||||
cache_sweeper :revision_sweeper
|
cache_sweeper :revision_sweeper
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ class WikiController < ApplicationController
|
||||||
return text if text.length <= length
|
return text if text.length <= length
|
||||||
len = length - truncate_string.length
|
len = length - truncate_string.length
|
||||||
t = ''
|
t = ''
|
||||||
text.split.collect do | word|
|
text.split.collect do |word|
|
||||||
if t.length + word.length <= len
|
if t.length + word.length <= len
|
||||||
t << word + ' '
|
t << word + ' '
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue