changeset 502:55691a4d867a

moin maint cleancache imported from: moin--main--1.5--patch-506
author Thomas Waldmann <tw@waldmann-edv.de>
date Sun, 26 Mar 2006 12:38:33 +0000
parents 069acf15d7b3
children 1c46c48ca67e
files ChangeLog MoinMoin/script/maint/cleancache.py MoinMoin/script/old/cachecleaner.py docs/CHANGES
diffstat 4 files changed, 69 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Mar 26 12:23:13 2006 +0000
+++ b/ChangeLog	Sun Mar 26 12:38:33 2006 +0000
@@ -2,6 +2,32 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-03-26 13:38:33 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-506
+
+    Summary:
+      moin maint cleancache
+    Revision:
+      moin--main--1.5--patch-506
+
+    moin maint cleancache
+    
+
+    new files:
+     MoinMoin/script/maint/.arch-ids/=id
+
+    modified files:
+     ChangeLog MoinMoin/script/maint/cleancache.py docs/CHANGES
+
+    renamed files:
+     MoinMoin/script/old/.arch-ids/cachecleaner.py.id
+       ==> MoinMoin/script/maint/.arch-ids/cleancache.py.id
+     MoinMoin/script/old/cachecleaner.py
+       ==> MoinMoin/script/maint/cleancache.py
+
+    new directories:
+     MoinMoin/script/maint MoinMoin/script/maint/.arch-ids
+
+
 2006-03-26 13:23:13 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-505
 
     Summary:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/script/maint/cleancache.py	Sun Mar 26 12:38:33 2006 +0000
@@ -0,0 +1,41 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - cleancache script
+
+    globally delete cache files in data/pages/PageName/cache/ directories
+    
+    You will usually do this after changing MoinMoin code, by either upgrading
+    version, installing or removing macros. This often makes the text_html
+    files invalid, so you have to remove them (the wiki will recreate them
+    automatically).
+    
+    text_html is the name of the cache file used for compiled pages formatted
+    by the wiki text to html formatter,
+
+    @copyright: 2005-2006 by MoinMoin:ThomasWaldmann
+    @license: GNU GPL, see COPYING for details.
+"""
+
+cachefiles_to_delete = ['text_html', 'pagelinks', ]
+
+import os
+
+from MoinMoin.script._util import MoinScript
+
+class PluginScript(MoinScript):
+    def __init__(self, argv, def_values):
+        MoinScript.__init__(self, argv, def_values)
+    
+    def mainloop(self):
+        self.init_request()
+        base = self.request.cfg.data_dir
+        pagesdir = os.path.join(base, 'pages')
+        for f in os.listdir(pagesdir):
+            for fname in cachefiles_to_delete:
+                cachefile = os.path.join(pagesdir, f, 'cache', fname)
+                try:
+                    os.remove(cachefile)
+                    print "Removed %s" % cachefile
+                except:
+                    pass
+
--- a/MoinMoin/script/old/cachecleaner.py	Sun Mar 26 12:23:13 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - clear the cache
-
-    @copyright: 2005 by Thomas Waldmann (MoinMoin:ThomasWaldmann)
-    @license: GNU GPL, see COPYING for details.
-
-    globally delete cache files in data/pages/PageName/cache/ directories
-    
-    Usage:
-    First change the base path and fname to match your needs.
-    Then do ./cachecleaner.py
-
-    You will usually do this after changing MoinMoin code, by either upgrading
-    version, installing or removing macros. This often makes the text_html
-    files invalid, so you have to remove them (the wiki will recreate them
-    automatically).
-    
-    text_html is the name of the cache file used for compiled pages formatted
-    by the wiki text to html formatter,
-"""
-
-base = "." # directory containing the data directory
-fnames = ['text_html', 'pagelinks', ] # cache filenames to delete
-
-def run():
-    import os
-    pagesdir = os.path.join(base, 'data', 'pages')
-    for f in os.listdir(pagesdir):
-        for fname in fnames:
-            cachefile = os.path.join(pagesdir, f, 'cache', fname)
-            try:
-                os.remove(cachefile)
-            except:
-                pass
-    
-if __name__ == '__main__':
-    run()
-
--- a/docs/CHANGES	Sun Mar 26 12:23:13 2006 +0000
+++ b/docs/CHANGES	Sun Mar 26 12:38:33 2006 +0000
@@ -110,7 +110,8 @@
         scripts.
       * moin ... account create --name=JoeDoe --email=joe@doe.org
       * moin ... account disable --name=JoeDoe
-      * moin ... acount check    <-- this is what usercheck script was before
+      * moin ... acount check     <-- this is what usercheck script was before
+      * moin ... maint cleancache <-- this is what cachecleaner script was
 
   Bugfixes:
     * cookie_lifetime didn't work comfortable for low values. The cookie was