return os.path.isfile("wp-config.php")
def checkWeb(self, deployment):
# XXX: this sucks pretty hard
- return self.checkWebPage(deployment, "",
- outputs=["<html", "WordPress", "feed"],
- exclude=["Error establishing a database connection"])
+ def doCheck():
+ return self.checkWebPage(deployment, "",
+ outputs=["<html", "WordPress", "feed"],
+ exclude=["Error establishing a database connection"])
+ if not doCheck():
+ deployment.enableOldStyleUrls()
+ return doCheck()
+ else:
+ return True
def detectVersion(self, deployment):
return self.detectVersionFromFile("wp-includes/version.php", php.re_var("wp_version"))
def install(self, version, options):
if not self._url:
raise UnknownWebPath
return self._url
+ def enableOldStyleUrls(self):
+ """
+ Switches to using http://user.scripts.mit.edu/~user/app URLs.
+ No effect if they have an explicit .scripts/url override.
+ """
+ self._url = scripts.fill_url(self.location, self.application.url(self), old_style = True)
@staticmethod
def parse(line):
"""
import wizard
from wizard import shell, util
-def fill_url(dir, url=None):
+def fill_url(dir, url=None, old_style=False):
"""
Attempts to determine the URL a directory would be web-accessible at.
If ``url`` is specified, automatically use it.
# try the directory
homedir, _, web_path = dir.partition("/web_scripts")
if web_path:
- return urlparse.ParseResult(
- "http",
- util.get_dir_owner(homedir) + ".scripts.mit.edu",
- web_path.rstrip('/'),
- "", "", "")
+ if old_style:
+ return urlparse.ParseResult(
+ "http",
+ "scripts.mit.edu",
+ "/~" + util.get_dir_owner(homedir) + web_path.rstrip('/'),
+ "", "", "")
+ else:
+ return urlparse.ParseResult(
+ "http",
+ util.get_dir_owner(homedir) + ".scripts.mit.edu",
+ web_path.rstrip('/'),
+ "", "", "")
# try the environment
host = os.getenv("WIZARD_WEB_HOST")