X-Git-Url: https://scripts.mit.edu/gitweb/wizard.git/blobdiff_plain/e1ec702ae6c455049afcb520d9d3680c6148cc1c..30380c4b5b28df9670ea5952e14bc485d1d34133:/wizard/app/mediawiki.py diff --git a/wizard/app/mediawiki.py b/wizard/app/mediawiki.py index 9a9ea30..c6ac8ae 100644 --- a/wizard/app/mediawiki.py +++ b/wizard/app/mediawiki.py @@ -1,12 +1,16 @@ import re import distutils.version import os +import lxml.cssselect +import lxml.etree +import StringIO +import logging from wizard import app, install, resolve, shell, util from wizard.app import php def make_filename_regex(var): - return 'LocalSettings.php', re.compile('^(\$' + app.expand_re(var) + r'''\s*=\s*)(.*)(;)''', re.M) + return 'LocalSettings.php', php.re_var(var) seed = util.dictmap(make_filename_regex, { 'WIZARD_IP': 'IP', # obsolete, remove after we're done @@ -21,62 +25,56 @@ seed = util.dictmap(make_filename_regex, { }) class Application(app.Application): - parametrized_files = ['LocalSettings.php', 'php.ini'] + database = "mysql" + parametrized_files = ['LocalSettings.php'] + php.parametrized_files deprecated_keys = set(['WIZARD_IP']) | php.deprecated_keys extractors = app.make_extractors(seed) extractors.update(php.extractors) substitutions = app.make_substitutions(seed) substitutions.update(php.substitutions) - install_schema = install.ArgSchema("mysql", "admin", "email") - install_schema.add(install.Arg("title", help="Title of your new MediaWiki install")) + install_schema = install.ArgSchema("db", "admin", "email", "title") def checkConfig(self, deployment): - return os.path.isfile(os.path.join(deployment.location, "LocalSettings.php")) + return os.path.isfile("LocalSettings.php") def detectVersion(self, deployment): - contents = deployment.read("includes/DefaultSettings.php") - regex = make_filename_regex("wgVersion")[1] - match = regex.search(contents) - if not match: return None - return distutils.version.LooseVersion(match.group(2)[1:-1]) - def checkWeb(self, deployment, out=None): - page = deployment.fetch("/index.php?title=Main_Page") - if type(out) is list: - out.append(page) - return page.find("