match = regex.search(contents)
if not match: return None
return distutils.version.LooseVersion(match.group(2)[1:-1])
- def install(self, options):
+ def install(self, version, options):
try:
os.unlink("LocalSettings.php")
except OSError:
if result.find("Installation successful") == -1:
raise install.Failure()
os.rename('config/LocalSettings.php', 'LocalSettings.php')
- def upgrade(self, options):
+ def upgrade(self, version, options):
sh = shell.Shell()
- sh.call("php", "maintenance/update.php")
+ if not os.path.isfile("AdminSettings.php"):
+ sh.call("git", "checkout", "mediawiki-" + str(version), "--", "AdminSettings.php")
+ result = sh.eval("php", "maintenance/update.php", "--quick", log=True)
+ if not result.rstrip().split()[-1] == "Done.":
+ raise app.UpgradeFailure(result)