else:
raise app.RecoverableInstallFailure(error_messages)
os.rename('config/LocalSettings.php', 'LocalSettings.php')
+ php.ini_replace_vars()
+
def upgrade(self, d, version, options):
if not os.path.isfile("AdminSettings.php"):
shell.call("git", "checkout", "-q", "mediawiki-" + str(version), "--", "AdminSettings.php")
"""
import re
+import os
from wizard import app, util
def _make_filename_regex(var):
return 'php.ini', re.compile('^(' + app.expand_re(var) + r'\s*=\s*)(.*)()$', re.M)
+def ini_replace_vars():
+ """
+ Replace ``WIZARD_TMPDIR`` and ``WIZARD_SESSIONNAME`` with with user-specific values.
+ """
+ text = open('php.ini', "r").read()
+ text = text.replace('WIZARD_TMPDIR', '/mit/%s/web_scripts_tmp' % os.environ['USER'])
+ text = text.replace('WIZARD_SESSIONNAME', '%s_SID' % os.environ['USER'])
+ open('php.ini', "w").write(text)
+
seed = util.dictmap(_make_filename_regex, {
'WIZARD_SESSIONNAME': 'session.name',
'WIZARD_TMPDIR': ('upload_tmp_dir', 'session.save_path'),
os.chmod("config.php", 0777)
self.install_2(options)
os.chmod("config.php", old_mode)
+ php.ini_replace_vars()
def install_2(self, options):
database_dict = {
wp_options.update().where(wp_options.c.option_name == 'siteurl').values(option_value=options.web_path).execute()
wp_options.update().where(wp_options.c.option_name == 'home').values(option_value="http://%s%s" % (options.web_host, options.web_path)).execute() # XXX: what if missing leading slash; this should be put in a function
# should also set the username and admin password
+ php.ini_replace_vars()
def upgrade(self, d, version, options):
result = d.fetch("wp-admin/upgrade.php?step=1")
if "Upgrade Complete" not in result and "No Upgrade Required" not in result: