@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<?php
2
3$account_table = new PhabricatorExternalAccount();
4$account_conn = $account_table->establishConnection('w');
5$table_name = $account_table->getTableName();
6
7$config_table = new PhabricatorAuthProviderConfig();
8$config_conn = $config_table->establishConnection('w');
9
10foreach (new LiskRawMigrationIterator($account_conn, $table_name) as $row) {
11 if (strlen($row['providerConfigPHID'])) {
12 continue;
13 }
14
15 $config_row = queryfx_one(
16 $config_conn,
17 'SELECT phid
18 FROM %R
19 WHERE providerType = %s AND providerDomain = %s
20 LIMIT 1',
21 $config_table,
22 $row['accountType'],
23 $row['accountDomain']);
24 if (!$config_row) {
25 continue;
26 }
27
28 queryfx(
29 $account_conn,
30 'UPDATE %R
31 SET providerConfigPHID = %s
32 WHERE id = %d',
33 $account_table,
34 $config_row['phid'],
35 $row['id']);
36}