]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/app/mediawiki.py
Add version detection.
[wizard.git] / wizard / app / mediawiki.py
index 40358cec594806fc38cc9ce9236ec299f4073fa9..ef7c1ea605de7c6b5f2de0bd8346cb8aac35fb6c 100644 (file)
@@ -1,4 +1,5 @@
 import re
+import distutils.version
 import os
 
 from wizard import app, deploy, install, shell, util
@@ -43,6 +44,12 @@ class Application(deploy.Application):
         return handler
     def checkConfig(self, deployment):
         return os.path.isfile(os.path.join(deployment.location, "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 install(self, options):
         try:
             os.unlink("LocalSettings.php")