Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.script.maint.cleancache.PluginScript Class Reference
Inheritance diagram for MoinMoin.script.maint.cleancache.PluginScript:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.script.maint.cleancache.PluginScript:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def mainloop
def init_request
def run
def logRuntime

Public Attributes

 request
 argv
 def_values
 parser
 args

Detailed Description

\
Purpose:
========
This script allows you to globally delete all the cache files in data/pages/PageName/cache/
and /data/cache directories

You will usually do this after changing MoinMoin code, by either upgrading
version, installing or removing macros or changing the regex expression for dicts or groups.
This often makes the text_html file invalid, so you have to remove it (the wiki will recreate it automatically).

text_html is the name of the cache file used for compiled pages formatted by the wiki text to html formatter.

Detailed Instructions:
======================
General syntax: moin [options] maint cleancache

[options] usually should be:
--config-dir=/path/to/my/cfg/ --wiki-url=wiki.example.org/

Definition at line 14 of file cleancache.py.


Constructor & Destructor Documentation

def MoinMoin.script.maint.cleancache.PluginScript.__init__ (   self,
  argv,
  def_values 
)

Reimplemented from MoinMoin.script.MoinScript.

Definition at line 35 of file cleancache.py.

00035 
00036     def __init__(self, argv, def_values):
00037         MoinScript.__init__(self, argv, def_values)


Member Function Documentation

def MoinMoin.script.MoinScript.init_request (   self) [inherited]
create request 

Definition at line 174 of file __init__.py.

00174 
00175     def init_request(self):
00176         """ create request """
00177         from MoinMoin.web.contexts import ScriptContext
00178         url = self.options.wiki_url or None
00179         self.request = ScriptContext(url, self.options.page)

Here is the caller graph for this function:

def MoinMoin.script.Script.logRuntime (   self) [inherited]
Print the total command run time. 

Definition at line 148 of file __init__.py.

00148 
00149     def logRuntime(self):
00150         """ Print the total command run time. """
00151         if self.options.show_timing:
00152             log("Needed %.3f secs." % (time.clock() - _start_time, ))
00153 

Here is the call graph for this function:

Reimplemented from MoinMoin.script.MoinScript.

Definition at line 38 of file cleancache.py.

00038 
00039     def mainloop(self):
00040         self.init_request()
00041         request = self.request
00042 
00043         # clean page scope cache entries
00044         keys = ['text_html', 'pagelinks', 'hitcounts', ]
00045         pages = request.rootpage.getPageList(user='')
00046         for pagename in pages:
00047             arena = Page(request, pagename)
00048             for key in keys:
00049                 caching.CacheEntry(request, arena, key, scope='item').remove()
00050 
00051         # clean wiki scope cache entries
00052         arena_key_list = [
00053             ('charts', 'hitcounts'),
00054             ('charts', 'pagehits'),
00055             ('charts', 'useragents'),
00056             ('user', 'name2id'),
00057         ]
00058         for arena, key in arena_key_list:
00059             caching.CacheEntry(request, arena, key, scope='wiki').remove()
00060 
00061         # clean dict and groups related cache
00062         arena_scope_list =  [('pagedicts', 'wiki'),
00063                              ('pagegroups', 'wiki'),
00064         ]
00065         for arena, scope in arena_scope_list:
00066             for key in caching.get_cache_list(request, arena, scope):
00067                 caching.CacheEntry(request, arena, key, scope=scope).remove()
00068 
00069         # clean drafts of users
00070         uids = user.getUserList(request)
00071         for key in uids:
00072             caching.CacheEntry(request, 'drafts', key, scope='wiki').remove()
00073 

Here is the call graph for this function:

def MoinMoin.script.Script.run (   self,
  showtime = 1 
) [inherited]
Run the main function of a command. 

Definition at line 130 of file __init__.py.

00130 
00131     def run(self, showtime=1):
00132         """ Run the main function of a command. """
00133         global flag_quiet
00134         try:
00135             try:
00136                 self.options, self.args = self.parser.parse_args(self.argv)
00137                 flag_quiet = self.options.quiet
00138                 # ToDo check if we need to initialize request (self.init_request())
00139                 self.mainloop()
00140             except KeyboardInterrupt:
00141                 log("*** Interrupted by user!")
00142             except SystemExit:
00143                 showtime = 0
00144                 raise
00145         finally:
00146             if showtime:
00147                 self.logRuntime()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 135 of file __init__.py.

Definition at line 102 of file __init__.py.

Definition at line 113 of file __init__.py.

Definition at line 178 of file __init__.py.


The documentation for this class was generated from the following file: