Created
August 19, 2011 21:56
-
-
Save rupl/1158118 to your computer and use it in GitHub Desktop.
Allows regular drush commands without -l arg when using super awesome dynamic vhost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Allow developers to override settings. | |
*/ | |
define('SWEET_ASS_STAGE_SETTINGS_REGEX', '/^(dca11\.webchefs\.org|dca11\.dev1\.fourkitchens\.com)(:\d+)*$/'); | |
define('SWEET_ASS_USER_SETTINGS_REGEX', '/^(.*)\.(.*)\.(webchefs\.org|dev1\.fourkitchens\.com)(:\d+)*$/'); | |
if (preg_match(SWEET_ASS_USER_SETTINGS_REGEX, $_SERVER['HTTP_HOST'], $matches)) { | |
// Load general dev settings. | |
if (file_exists('sites/default/settings.dev.php')) { | |
include_once 'sites/default/settings.dev.php'; | |
} | |
// Load user specific settings. | |
if (file_exists('sites/default/settings_' . $matches[1] . '.php')) { | |
include_once 'sites/default/settings_' . $matches[1] . '.php'; | |
} | |
} elseif (preg_match(SWEET_ASS_STAGE_SETTINGS_REGEX, $_SERVER['HTTP_HOST'])) { | |
if (file_exists('sites/default/settings.stage.php')) { | |
include_once 'sites/default/settings.stage.php'; | |
} | |
} else { | |
// fallback | |
if (file_exists('sites/default/settings_' . getenv(USER) . '.php')) { | |
include_once 'sites/default/settings_' . getenv(USER) . '.php'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment