X-Git-Url: https://scripts.mit.edu/gitweb/wizard.git/blobdiff_plain/05d452073bdb008549a4a69ef47660a7e37115b7..0f0d3e3da4c7fe6d3cd824b8fb9126c7758ead4a:/wizard/app/wordpress.py diff --git a/wizard/app/wordpress.py b/wizard/app/wordpress.py index 93187c5..a068fb8 100644 --- a/wizard/app/wordpress.py +++ b/wizard/app/wordpress.py @@ -1,19 +1,60 @@ -import sqlalchemy import os +import re +import logging +import distutils +import urlparse -from wizard import app, install, sql +from wizard import app, install, resolve, sql, util from wizard.app import php +def make_filename_regex_define(var): + return 'wp-config.php', php.re_define(var) + +seed = util.dictmap(make_filename_regex_define, { + # these funny names are due to convention set by MediaWiki + 'WIZARD_DBSERVER': 'DB_HOST', + 'WIZARD_DBNAME': 'DB_NAME', + 'WIZARD_DBUSER': 'DB_USER', + 'WIZARD_DBPASSWORD': 'DB_PASSWORD', + 'WIZARD_SECRETKEY': 'SECRET_KEY', + 'WIZARD_AUTH_KEY': 'AUTH_KEY', + 'WIZARD_SECURE_AUTH_KEY': 'SECURE_AUTH_KEY', + 'WIZARD_LOGGED_IN_KEY': 'LOGGED_IN_KEY', + 'WIZARD_NONCE_KEY': 'NONCE_KEY', + }) + class Application(app.Application): - install_schema = install.ArgSchema("mysql", "email", "title") + database = "mysql" + parametrized_files = ['wp-config.php'] + php.parametrized_files + extractors = app.make_extractors(seed) + extractors.update(php.extractors) + substitutions = app.make_substitutions(seed) + substitutions.update(php.substitutions) + install_schema = install.ArgSchema("db", "email", "title") + deprecated_keys = set(['WIZARD_SECRETKEY']) + random_keys = set(['WIZARD_SECRETKEY', 'WIZARD_AUTH_KEY', 'WIZARD_SECURE_AUTH_KEY', 'WIZARD_LOGGED_IN_KEY', 'WIZARD_NONCE_KEY']) def download(self, version): return "http://wordpress.org/wordpress-%s.tar.gz" % version + def checkConfig(self, deployment): + return os.path.isfile("wp-config.php") + def checkWeb(self, deployment): + # XXX: this sucks pretty hard + return self.checkWebPage(deployment, "", ">>>>>> +""", [0]) +], +}