def install(self, version, options):
php.ini_replace_vars()
if version >= distutils.version.LooseVersion("1.17.0"):
- self.install_1_17_0(options)
+ # The --email option was added in 1.16.3 and removed in 1.18.0
+ has_email = version < distutils.version.LooseVersion("1.18.0")
+ self.install_1_17_0(options, has_email)
else:
self.install_old(options)
- def install_1_17_0(self, options):
+ def install_1_17_0(self, options, has_email):
util.soft_unlink("LocalSettings.php")
if os.path.exists("math"):
with util.ChangeDirectory("math"):
os.write(out_fd, options.admin_password)
os.close(out_fd)
- result = shell.eval(
- "php", "-c", ".", "maintenance/install.php",
- "--dbname", options.dsn.database,
- "--dbpassfile", "php://fd/%d" % (dbpass_fd,),
- "--dbserver", options.dsn.host,
- "--dbuser", options.dsn.username,
+ args = (
+ "php", "-c", ".", "maintenance/install.php",
+ "--dbname", options.dsn.database,
+ "--dbpassfile", "php://fd/%d" % (dbpass_fd,),
+ "--dbserver", options.dsn.host,
+ "--dbuser", options.dsn.username,
+ "--passfile", "php://fd/%d" % (pass_fd,),
+ "--server", "https://" + options.web_host,
+ "--scriptpath", options.web_path,
+ )
+ if has_email:
+ args += (
"--email", options.email,
- "--passfile", "php://fd/%d" % (pass_fd,),
- "--server", "https://" + options.web_host,
- "--scriptpath", options.web_path,
- options.title, options.admin_name,
+ )
+ args += (options.title, options.admin_name,)
+ result = shell.eval(
+ *args,
+ log=True,
+ close_fds=False)
+ if not has_email:
+ shell.eval(
+ "php", "-c", ".", "maintenance/resetUserEmail.php",
+ "--no-reset-password",
+ options.admin_name, options.email,
log=True,
- close_fds=False,
- )
+ )
except shell.CallError as e:
raise app.RecoverableInstallFailure(["Install script returned non-zero exit code\nSTDOUT: %s\nSTDERR: %s" % (e.stdout, e.stderr)])
logging.debug("Install script output:\n\n" + result)