diff --git a/scripts/sql/manage_storage.php b/scripts/sql/manage_storage.php index 81d90059a0..0e4dc088da 100755 --- a/scripts/sql/manage_storage.php +++ b/scripts/sql/manage_storage.php @@ -75,10 +75,12 @@ if ($args->getArg('password') === null) { } else { // Put this in a PhutilOpaqueEnvelope. $password = new PhutilOpaqueEnvelope($args->getArg('password')); + PhabricatorEnv::overrideConfig('mysql.pass', $args->getArg('password')); } $api = new PhabricatorStorageManagementAPI(); $api->setUser($args->getArg('user')); +PhabricatorEnv::overrideConfig('mysql.user', $args->getArg('user')); $api->setHost($default_host); $api->setPassword($password); $api->setNamespace($args->getArg('namespace')); diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php index eb0352c1e0..27d5fcebb0 100644 --- a/src/infrastructure/env/PhabricatorEnv.php +++ b/src/infrastructure/env/PhabricatorEnv.php @@ -52,6 +52,7 @@ final class PhabricatorEnv { private static $sourceStack; private static $repairSource; + private static $overrideSource; private static $requestBaseURI; /** @@ -161,6 +162,15 @@ final class PhabricatorEnv { self::$repairSource->setKeys(array($key => $value)); } + public static function overrideConfig($key, $value) { + if (!self::$overrideSource) { + self::$overrideSource = id(new PhabricatorConfigDictionarySource(array())) + ->setName(pht("Overridden Config")); + self::$sourceStack->pushSource(self::$overrideSource); + } + self::$overrideSource->setKeys(array($key => $value)); + } + public static function getUnrepairedEnvConfig($key, $default = null) { foreach (self::$sourceStack->getStack() as $source) { if ($source === self::$repairSource) {