changeset 3449:933bb04c0935

script.maint.makecache: introduced makecache maint module
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 30 Mar 2008 12:45:07 +0200
parents f26af7360865
children 69374fa17c73
files MoinMoin/script/__init__.py MoinMoin/script/maint/makecache.py
diffstat 2 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/__init__.py	Sun Mar 30 10:27:23 2008 +0200
+++ b/MoinMoin/script/__init__.py	Sun Mar 30 12:45:07 2008 +0200
@@ -208,6 +208,7 @@
 moin ... maint cleancache ...
 moin ... maint cleanpage ...
 moin ... maint globaledit ...
+moin ... maint makecache ...
 moin ... maint mkpagepacks ...
 moin ... maint reducewiki ...
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/script/maint/makecache.py	Sun Mar 30 12:45:07 2008 +0200
@@ -0,0 +1,47 @@
+# -*- coding: iso-8859-1 -*-
+"""
+MoinMoin - makecache script
+
+@copyright: 2008 MoinMoin:ReimarBauer
+@license: GNU GPL, see COPYING for details.
+"""
+
+from MoinMoin import caching
+from MoinMoin.Page import Page
+from MoinMoin.script import MoinScript
+from MoinMoin.stats import hitcounts
+
+class PluginScript(MoinScript):
+    """\
+Purpose:
+========
+This script allows you to create cache files in data/pages/PageName/cache/
+and /data/cache directories
+
+You will usually do this after changing MoinMoin code and calling "maint cleancache", by either upgrading
+version, installing or removing macros or changing the regex expression for dicts.
+
+text_html is the name of the cache file used for compiled pages formatted
+by the wiki text to html formatter, A dict file does cache the pages which
+do fit to the page_group_regex variable.
+
+Detailed Instructions:
+======================
+General syntax: moin [options] maint makecache
+
+[options] usually should be:
+    --config-dir=/path/to/my/cfg/ --wiki-url=wiki.example.org/
+"""
+
+    def __init__(self, argv, def_values):
+        MoinScript.__init__(self, argv, def_values)
+
+    def mainloop(self):
+        self.init_request()
+        request = self.request
+
+        # make cache related to pagelinks entries of a page
+        pages = request.rootpage.getPageList(user='', exists=1)
+        for pagename in pages:
+            p = Page(request, pagename).getPageLinks(request)
+