comparison MoinMoin/script/maint/cleancache.py @ 2940:d54b7635a9a7

refactor maint cleancache
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 05 Nov 2007 22:57:18 +0100
parents c0366b467edf
children 2572688e031a
comparison
equal deleted inserted replaced
2939:6259bb49366c 2940:d54b7635a9a7
11 11
12 text_html is the name of the cache file used for compiled pages formatted 12 text_html is the name of the cache file used for compiled pages formatted
13 by the wiki text to html formatter, A dict file does cache the pages which 13 by the wiki text to html formatter, A dict file does cache the pages which
14 do fit to the page_group_regex variable. 14 do fit to the page_group_regex variable.
15 15
16 @copyright: 2005-2006 MoinMoin:ThomasWaldmann 16 @copyright: 2005-2007 MoinMoin:ThomasWaldmann,
17 2007 MoinMoin:ReimarBauer 17 2007 MoinMoin:ReimarBauer
18 @license: GNU GPL, see COPYING for details. 18 @license: GNU GPL, see COPYING for details.
19 """ 19 """
20 20
21 import os
22 from MoinMoin import caching 21 from MoinMoin import caching
23 from MoinMoin.Page import Page 22 from MoinMoin.Page import Page
24 from MoinMoin.script import MoinScript 23 from MoinMoin.script import MoinScript
25 24
26 class PluginScript(MoinScript): 25 class PluginScript(MoinScript):
29 28
30 def mainloop(self): 29 def mainloop(self):
31 self.init_request() 30 self.init_request()
32 request = self.request 31 request = self.request
33 32
34 key = 'text_html' 33 # clean page scope cache entries
34 keys = ['text_html', 'pagelinks', ]
35 pages = request.rootpage.getPageList(user='') 35 pages = request.rootpage.getPageList(user='')
36
37 for pagename in pages: 36 for pagename in pages:
38 arena = Page(request, pagename) 37 arena = Page(request, pagename)
39 caching.CacheEntry(request, arena, key, scope='item').remove() 38 for key in keys:
40 caching.CacheEntry(request, arena, "pagelinks", scope='item').remove() 39 caching.CacheEntry(request, arena, key, scope='item').remove()
41 40
42 # cleans the name2id 41 # clean wiki scope cache entries
43 caching.CacheEntry(request, 'user', 'name2id', scope='wiki').remove() 42 arena_key_list = [
44 # cleans the wikidicts 43 ('user', 'name2id'),
45 caching.CacheEntry(request, 'wikidicts', 'dicts_groups', scope='wiki').remove() 44 ('wikidicts', 'dicts_groups'),
46 # cleans i18n meta 45 ]
47 caching.CacheEntry(request, 'i18n', 'meta', scope='wiki').remove() 46 for arena, key in arena_key_list:
47 caching.CacheEntry(request, arena, key, scope='wiki').remove()
48 48