~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/script/maint/cleancache.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
MoinMoin - cleancache script
4
4
 
5
5
@copyright: 2005-2007 MoinMoin:ThomasWaldmann,
6
 
            2007-2009 MoinMoin:ReimarBauer
 
6
            2007-2008 MoinMoin:ReimarBauer
7
7
@license: GNU GPL, see COPYING for details.
8
8
"""
9
9
 
10
 
from MoinMoin import caching, i18n, user
 
10
from MoinMoin import caching
11
11
from MoinMoin.Page import Page
12
12
from MoinMoin.script import MoinScript
13
13
 
19
19
and /data/cache directories
20
20
 
21
21
You will usually do this after changing MoinMoin code, by either upgrading
22
 
version, installing or removing macros or changing the regex expression for dicts or groups.
23
 
This often makes the text_html file invalid, so you have to remove it (the wiki will recreate it automatically).
 
22
version, installing or removing macros or changing the regex expression for dicts.
 
23
This often makes the text_html and dict files invalid, so you have to remove them
 
24
(the wiki will recreate them automatically).
24
25
 
25
 
text_html is the name of the cache file used for compiled pages formatted by the wiki text to html formatter.
 
26
text_html is the name of the cache file used for compiled pages formatted
 
27
by the wiki text to html formatter, A dict file does cache the pages which
 
28
do fit to the page_group_regex variable.
26
29
 
27
30
Detailed Instructions:
28
31
======================
29
32
General syntax: moin [options] maint cleancache
30
33
 
31
34
[options] usually should be:
32
 
    --config-dir=/path/to/my/cfg/ --wiki-url=http://wiki.example.org/
 
35
    --config-dir=/path/to/my/cfg/ --wiki-url=wiki.example.org/
33
36
"""
34
37
 
35
38
    def __init__(self, argv, def_values):
53
56
            ('charts', 'pagehits'),
54
57
            ('charts', 'useragents'),
55
58
            ('user', 'name2id'),
 
59
            ('wikidicts', 'dicts_groups'),
56
60
        ]
57
61
        for arena, key in arena_key_list:
58
62
            caching.CacheEntry(request, arena, key, scope='wiki').remove()
59
63
 
60
 
        # clean dict and groups related cache
61
 
        arena_scope_list =  [('pagedicts', 'wiki'),
62
 
                             ('pagegroups', 'wiki'),
63
 
        ]
64
 
        for arena, scope in arena_scope_list:
65
 
            for key in caching.get_cache_list(request, arena, scope):
66
 
                caching.CacheEntry(request, arena, key, scope=scope).remove()
67
 
 
68
 
        # clean drafts of users
69
 
        uids = user.getUserList(request)
70
 
        for key in uids:
71
 
            caching.CacheEntry(request, 'drafts', key, scope='wiki').remove()
72
 
 
73
 
        # clean language cache files
74
 
        wiki_languages = i18n.wikiLanguages().keys()
75
 
        for key in wiki_languages:
76
 
            caching.CacheEntry(request, 'i18n', key, scope='wiki').remove()