@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use `--user` and `--password` from bin/storage in PHP migrations

Summary:
Fixes T2059. Ref T2517.

Currently, you can run `bin/storage upgrade` with `--user` and `--password` arguments. However, these clownishly apply only to `.sql` patches -- the `.php` migrations still use the default user and password.

This is dumb. Stop doing it. Respect `--user` and `--password` for PHP patches.

(I implemented "override", which is very similar to "repair", but kept them separate since I think they're semantically distinct enough to differentiate.)

Test Plan: Ran `./bin/storage upgrade --user x --pass y --apply phabricator:20130219.commitsummarymig.php`. Verified the correct user and password were used both for the initial connect and patch application.

Reviewers: chad, vrana

Reviewed By: chad

CC: aran

Maniphest Tasks: T2059, T2517

Differential Revision: https://secure.phabricator.com/D5115

+12
+2
scripts/sql/manage_storage.php
··· 75 75 } else { 76 76 // Put this in a PhutilOpaqueEnvelope. 77 77 $password = new PhutilOpaqueEnvelope($args->getArg('password')); 78 + PhabricatorEnv::overrideConfig('mysql.pass', $args->getArg('password')); 78 79 } 79 80 80 81 $api = new PhabricatorStorageManagementAPI(); 81 82 $api->setUser($args->getArg('user')); 83 + PhabricatorEnv::overrideConfig('mysql.user', $args->getArg('user')); 82 84 $api->setHost($default_host); 83 85 $api->setPassword($password); 84 86 $api->setNamespace($args->getArg('namespace'));
+10
src/infrastructure/env/PhabricatorEnv.php
··· 52 52 53 53 private static $sourceStack; 54 54 private static $repairSource; 55 + private static $overrideSource; 55 56 private static $requestBaseURI; 56 57 57 58 /** ··· 159 160 self::$sourceStack->pushSource(self::$repairSource); 160 161 } 161 162 self::$repairSource->setKeys(array($key => $value)); 163 + } 164 + 165 + public static function overrideConfig($key, $value) { 166 + if (!self::$overrideSource) { 167 + self::$overrideSource = id(new PhabricatorConfigDictionarySource(array())) 168 + ->setName(pht("Overridden Config")); 169 + self::$sourceStack->pushSource(self::$overrideSource); 170 + } 171 + self::$overrideSource->setKeys(array($key => $value)); 162 172 } 163 173 164 174 public static function getUnrepairedEnvConfig($key, $default = null) {