1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +01:00
phorge-phorge/src/infrastructure
epriestley 889eca1af9 Allow a DAO object storage namespace to be forced to a particular value
Summary:
Ref T6703. When we import external data from a third-party install to a Phacility instance, we must link instance accounts to central accounts: either existing central accounts, or newly created central accounts that we send invites for.

During this import, or when users register and claim those new accounts, we do a write from `admin.phacility.com` directly into the instance database to link the accounts.

This is pretty sketchy, and should almost certainly just be an internal API instead, particularly now that it's relatively stable.

However, it's what we use for now. The process has had some issues since the introduction of `%R` (combined database name and table refrence in queries), and now needs to be updated for the new `providerConfigPHID` column in `ExternalAccount`.

The problem is that `%R` isn't doing the right thing. We have code like this:

```
$conn = new_connection_to_instance('turtle');
queryf($conn, 'INSERT INTO %R ...', $table);
```

However, the `$table` resolves `%R` using the currently-executing-process information, not anything specific to `$conn`, so it prints `admin_user.user_externalaccount` (the name of the table on `admin.phacility.com`, where the code is running).

We want it to print `turtle_user.user_externalaccount` instead: the name of the table on `turtle.phacility.com`, where we're actually writing.

To force this to happen, let callers override the namespace part of the database name.

Long term: I'd plan to rip this out and replace it with an API call. This "connect directly to the database" stuff is nice for iterating on (only `admin` needs hotfixes) but very very sketchy for maintaining.

Test Plan: See next diff.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T6703

Differential Revision: https://secure.phabricator.com/D20167
2019-02-14 12:02:08 -08:00
..
cluster Add infrastructure for sending SMS via AWS SNS 2019-01-23 16:29:50 -08:00
contentsource Redesign Config Application 2016-08-29 15:49:49 -07:00
customfield Allow "Change Subtype" to be selected from the comment action stack 2018-11-28 13:40:40 -08:00
daemon Remove "getApplicationTransactionObject()" from ApplicationTransactionInterface 2018-12-20 15:16:19 -08:00
diff When authors add inlines to their own revisions/commits, mark them as "Done" by default 2018-09-07 11:18:14 -07:00
edges Continue making application fixes to Phabricator for changes to %Q semantics 2018-11-15 03:50:02 -08:00
env Replace all "setQueryParam()" calls with "remove/replaceQueryParam()" 2019-02-14 11:56:39 -08:00
events Remove support for the "TYPE_AUTH_WILLLOGIN" event 2018-12-28 00:16:22 -08:00
export Allow "bin/bulk export" to merge multiple queries and accept more flexible flags 2018-10-10 09:14:14 -07:00
graph Enable hovercards for the "Task Graph" UI in Maniphest 2017-10-04 11:12:01 -07:00
internationalization Improve UI for "wait" and "answered" MFA challenges 2018-12-28 00:18:53 -08:00
javelin When the profiler is active, keep it active if the user submits forms 2017-02-23 11:15:40 -08:00
lint/linter Linter fixes 2015-12-03 07:44:23 +11:00
log Add "%I" (instance name) to application log formats 2017-04-23 11:07:19 -07:00
management Provide "bin/files integrity" for debugging, maintaining and backfilling integrity hashes 2017-04-06 15:42:43 -07:00
markup Bump the markup cache version for URI changes 2019-02-13 12:25:18 -08:00
query Don't put "spacePHID IN (...)" constraints in queries which will raise policy exceptions 2019-01-28 09:03:32 -08:00
ssh Generate a random unique "Request ID" for SSH requests so processes can coordinate better 2018-03-22 13:44:30 -07:00
status Give Drydock Leases more modern status treatment 2018-02-13 13:15:57 -08:00
storage Allow a DAO object storage namespace to be forced to a particular value 2019-02-14 12:02:08 -08:00
syntax Pass the new default syntax highlighting map to the remarkup engine 2016-05-05 02:51:19 -07:00
testing When running unit tests, ignore any custom task fields 2017-04-02 09:36:17 -07:00
time Fix errors found by PHPStan 2017-02-18 09:24:56 +00:00
util Add a "metronome" for spreading service call load 2019-02-05 14:06:22 -08:00
PhabricatorEditor.php Mark some strings for translation 2015-06-09 23:06:52 +10:00