Пример #1
0
 def mainloop(self):
     self.init_request()
     request = self.request
     data_dir = request.cfg.data_dir
     meta_fname = os.path.join(data_dir, 'meta')
     while True:
         try:
             meta = wikiutil.MetaDict(meta_fname, request.cfg.cache_dir)
             try:
                 curr_rev = meta['data_format_revision']
                 mig_name = str(curr_rev)
                 execute = wikiutil.importBuiltinPlugin('script.migration', mig_name)
                 print "Calling migration script for %s, base revision %d" % (data_dir, curr_rev)
                 curr_rev = execute(self, data_dir, curr_rev)
                 if curr_rev is None:
                     print "Final mig script reached, migration is complete."
                     break
                 else:
                     print "Returned. New rev is %d." % curr_rev
                     meta['data_format_revision'] = curr_rev
                     meta.sync()
             except wikiutil.PluginMissingError:
                 print "Error: There is no script for %s." % mig_name
                 break
         finally:
             del meta
Пример #2
0
 def mainloop(self):
     self.init_request()
     request = self.request
     data_dir = request.cfg.data_dir
     meta_fname = os.path.join(data_dir, 'meta')
     while True:
         try:
             meta = wikiutil.MetaDict(meta_fname, request.cfg.cache_dir)
             try:
                 curr_rev = meta['data_format_revision']
                 mig_name = str(curr_rev)
                 execute = wikiutil.importBuiltinPlugin(
                     'script.migration', mig_name)
                 print "Calling migration script for %s, base revision %d" % (
                     data_dir, curr_rev)
                 curr_rev = execute(self, data_dir, curr_rev)
                 if curr_rev is None:
                     print "Final mig script reached, migration is complete."
                     break
                 else:
                     print "Returned. New rev is %d." % curr_rev
                     meta['data_format_revision'] = curr_rev
                     meta.sync()
             except wikiutil.PluginMissingError:
                 print "Error: There is no script for %s." % mig_name
                 break
         finally:
             del meta
Пример #3
0
    def mainloop(self):
        # Insert config dir or the current directory to the start of the path.
        config_dir = self.options.config_dir
        if config_dir and not os.path.isdir(config_dir):
            fatal("bad path given to --config-dir option")
        sys.path.insert(0, os.path.abspath(config_dir or os.curdir))

        args = self.args
        if len(args) < 2:
            self.parser.error("""You must specify a command module and name:
            
moin ... account check ...
moin ... account create ...
moin ... account disable ...

moin ... cli show ...

moin ... export dump ...

moin ... import irclog ...

moin ... lupy build ...
moin ... lupy optimize ...

moin ... maint cleancache ...
moin ... maint cleanpage ...
moin ... maint globaledit ...
moin ... maint mkpagepacks ...
moin ... maint reducewiki ...

moin ... migration data ...

General options:
    Most commands need some general parameters before command subcommand:
    --config-dir=/config/directory
        Mandatory for most commands and specifies the directory that contains
        your wikiconfig.py (or farmconfig.py).

    --wiki-url=wiki.example.org/
        Mandatory for most commands and specifies the url of the wiki you like
        to operate on.
        
Specific options:
    Most commands need additional parameters after command subcommand.

    Sorry, but there is not much docs about that stuff yet, you can check
    docs/CHANGES and the MoinMoin wiki site for more infos (or just try to
    invoke some command/subcommand to see if it emits more help).
    The code you invoke is contained in MoinMoin/script/command/subcommand.py,
    so just reading the comments / source there might help you, too.
""")
            sys.exit(1)

        cmd_module, cmd_name = args[:2]
        from MoinMoin import wikiutil
        plugin_class = wikiutil.importBuiltinPlugin('script.%s' % cmd_module, cmd_name, 'PluginScript')
        plugin_class(args[2:], self.options).run() # all starts again there
Пример #4
0
    def mainloop(self):
        # Insert config dir or the current directory to the start of the path.
        config_dir = self.options.config_dir
        if config_dir:
            if os.path.isdir(config_dir):
                sys.path.insert(0, os.path.abspath(config_dir))
            else:
                fatal("bad path given to --config-dir option")

        args = self.args
        if len(args) < 2:
            self.parser.print_help()
            fatal("""You must specify a command module and name:

moin ... account check ...
moin ... account create ...
moin ... account disable ...
moin ... account resetpw ...

moin ... cli show ...

moin ... export dump ...

moin ... import irclog ...
moin ... import wikipage ...

moin ... index build ...

moin ... maint cleancache ...
moin ... maint cleanpage ...
moin ... maint globaledit ...
moin ... maint makecache ...
moin ... maint mkpagepacks ...
moin ... maint reducewiki ...

moin ... migration data ...

moin ... server standalone ...

moin ... xmlrpc mailimport ...
moin ... xmlrpc remote ...

General options:
    Most commands need some general parameters before command subcommand:
    --config-dir=/config/directory
        Mandatory for most commands and specifies the directory that contains
        your wikiconfig.py (or farmconfig.py).

    --wiki-url=http://wiki.example.org/
        Mandatory for most commands and specifies the url of the wiki you like
        to operate on.

Specific options:
    Most commands need additional parameters after command subcommand.

    To obtain additonal help on a command use 'moin module subcommand --help'
""")

        cmd_module, cmd_name = args[:2]
        if cmd_module == '...':
            # our docs usually tell to use moin ... cmd_module cmd_name
            # if somebody enters the ... verbatim, tell him how to do it right:
            fatal("Wrong invokation. Please do not enter ... verbatim, but give --config-dir and --wiki-url options (see help for more details).")

        from MoinMoin import wikiutil
        try:
            plugin_class = wikiutil.importBuiltinPlugin('script.%s' % cmd_module, cmd_name, 'PluginScript')
        except wikiutil.PluginMissingError:
            fatal("Command plugin %r, command %r was not found." % (cmd_module, cmd_name))

        # We have to use the args list here instead of optparse, as optparse only
        # deals with things coming before command subcommand.
        if "--help" in args or "-h" in args:
            print "MoinMoin Help - %s/ %s\n" % (cmd_module, cmd_name)
            print plugin_class.__doc__
            print "Command line reference:"
            print "======================="
            plugin_class(args[2:], self.options).parser.print_help()
        else:
            plugin_class(args[2:], self.options).run() # all starts again there