Expire Caches for Redirected Links
[[!redirect foo]] should expire all pages which reference "foo". Sounds simple, but this was a really gnarly bug to fix.
This commit is contained in:
parent
ea6b04271b
commit
0943b7e510
5 changed files with 15 additions and 18 deletions
|
@ -179,7 +179,12 @@ class PageRenderer
|
|||
references.build :referenced_name => redirected_page_name,
|
||||
:link_type => WikiReference::REDIRECTED_PAGE
|
||||
end
|
||||
|
||||
|
||||
# ugly hack: store these in a thread-local variable, so that the cache-sweeper has access to it.
|
||||
Thread.current[:page_redirects] ?
|
||||
Thread.current[:page_redirects].update({ @revision.page.name => redirects}) :
|
||||
Thread.current[:page_redirects] = { @revision.page.name => redirects}
|
||||
|
||||
categories = rendering_result.find_chunks(Category).map { |cat| cat.list }.flatten
|
||||
categories.each do |category|
|
||||
references.build :referenced_name => category, :link_type => WikiReference::CATEGORY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue