]> scripts.mit.edu Git - wizard.git/blob - wizard/command/remove.py
Use CLI installer for MediaWiki 1.17.0 and later.
[wizard.git] / wizard / command / remove.py
1 import shutil
2
3 from wizard import command, deploy, shell
4
5 def main(argv, baton):
6     options, args = parse_args(argv, baton)
7     dir = args[0]
8     shell.drop_priviledges(dir, options.log_file)
9     deployment = deploy.ProductionCopy(dir)
10     deployment.verify()
11     deployment.remove(options)
12     shutil.rmtree(dir)
13
14 def parse_args(argv, baton):
15     usage = """usage: %prog remove DIR
16
17 Removes an autoinstall directory, deleting any databases along
18 with it.  Will refuse to remove a non-autoinstall directory.  Be
19 careful: this will also destroy all backups!"""
20     parser = command.WizardOptionParser(usage)
21     options, args = parser.parse_all(argv)
22     if len(args) > 1:
23         parser.error("too many arguments")
24     if len(args) == 0:
25         parser.error("must specify directory")
26     return options, args
27