Ref T7522. This seems like the least-bad approach to a messy issue:
- When backfilling accounts from an imported instance, I need to write ExternalAccount rows to the instance to link instance accounts with upstream accounts.
- We do this in the daemons in some other cases, which lets us run all the code in the context of the instance. However, I really want to do this in-process here because it's way way simpler and we need to do writes to both the instance and the upstream, and they're interleaved, and they depend on one another.
- I can hard-code the query with qsprintf() but that feels like 100x worse than this.
This allows me to do this:
id(new PhabricatorExternalAccount()) ->setForcedConnnection($instance_conn) ->... ->save();
...and get a write to the instance database, which is at least not completely a minefield.