Short description

May be we should add "Do you want yet to clean your cache Y/N (Y): " to the migration script and if Y clean the cache.

We can check in 1.8/1.9 if the wiki process is stopped and tell to do it otherwise it does not clean the cache.

The patch also tests in the migration script if the wikiserver is offline.

   1 diff -r 8585fdace215 MoinMoin/script/maint/cleancache.py
   2 --- a/MoinMoin/script/maint/cleancache.py	Fri Dec 19 23:35:57 2008 +0100
   3 +++ b/MoinMoin/script/maint/cleancache.py	Wed Dec 24 08:48:15 2008 +0100
   4 @@ -6,6 +6,7 @@
   5              2007-2008 MoinMoin:ReimarBauer
   6  @license: GNU GPL, see COPYING for details.
   7  """
   8 +import urllib
   9  
  10  from MoinMoin import caching
  11  from MoinMoin.Page import Page
  12 @@ -41,7 +42,16 @@
  13      def mainloop(self):
  14          self.init_request()
  15          request = self.request
  16 +        site = None
  17 +        try:
  18 +            site = urllib.urlopen(self.options.wiki_url)
  19 +        except:
  20 +            pass
  21  
  22 +        if site:
  23 +            print "***************************************************"
  24 +            print "Please STOP your wiki and retry to clean your cache."
  25 +            return
  26          # clean page scope cache entries
  27          keys = ['text_html', 'pagelinks', 'hitcounts', ]
  28          pages = request.rootpage.getPageList(user='')
  29 diff -r 8585fdace215 MoinMoin/script/migration/data.py
  30 --- a/MoinMoin/script/migration/data.py	Fri Dec 19 23:35:57 2008 +0100
  31 +++ b/MoinMoin/script/migration/data.py	Wed Dec 24 08:48:15 2008 +0100
  32 @@ -17,7 +17,7 @@
  33      @license: GNU GPL, see COPYING for details.
  34  """
  35  
  36 -import os
  37 +import os, urllib
  38  
  39  from MoinMoin import wikiutil
  40  from MoinMoin.script import MoinScript
  41 @@ -37,6 +37,17 @@
  42          request = self.request
  43          data_dir = request.cfg.data_dir
  44          meta_fname = os.path.join(data_dir, 'meta')
  45 +        site = None
  46 +        try:
  47 +            site = urllib.urlopen(self.options.wiki_url)
  48 +        except:
  49 +            pass
  50 +
  51 +        if site:
  52 +            print "****************************************************"
  53 +            print "Please STOP your wiki and retry to migrate your data."
  54 +            return
  55 +        
  56          while True:
  57              try:
  58                  meta = wikiutil.MetaDict(meta_fname, request.cfg.cache_dir)
  59 @@ -58,4 +69,5 @@
  60                      break
  61              finally:
  62                  del meta
  63 -
  64 +                print "*****************************************************************************"
  65 +                print "You may want to continue with cleaning your cache files, see maint cleancache."
  66 
script.patch


CategoryFeatureRequest CategoryFeaturePatched

MoinMoin: FeatureRequests/CleanCacheAfterMigration (last edited 2008-12-24 07:53:02 by ReimarBauer)