From 74a0e5cd7930ac06013ed6fafc4fd96e7730b40c Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 19 Nov 2016 08:35:29 -0800 Subject: [PATCH] (stable) Respect user/pass flags to bin/storage for direct DatabaseRef-based queries Summary: Ref T11893. Previously, we excuted all `bin/storage` queries through `StorageManagementAPI` objects. After D16848, we execute some queries through `PhabricatorDatabaseRef`. However, the refs we use weren't getting passed the `-u` / `-p` flags correctly, for specifying alternate administrative credentials. Test Plan: - Created a second account (`trunk`). - Ran `bin/storage -u trunk`. - Made libphutil throw when not connecting as that user. - Before patch: some connections incorrectly used the default user, "root". - After patch: all connections correctly used the configured user, "trunk". Reviewers: chad Reviewed By: chad Maniphest Tasks: T11893 Differential Revision: https://secure.phabricator.com/D16901 --- scripts/sql/manage_storage.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/sql/manage_storage.php b/scripts/sql/manage_storage.php index db21fc23f5..ec3f492e8c 100755 --- a/scripts/sql/manage_storage.php +++ b/scripts/sql/manage_storage.php @@ -206,6 +206,9 @@ foreach ($refs as $ref) { ->setDisableUTF8MB4($args->getArg('disable-utf8mb4')); PhabricatorEnv::overrideConfig('mysql.user', $api->getUser()); + $ref->setUser($selected_user); + $ref->setPass($password); + try { queryfx( $api->getConn(null),