@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$identifier_table = new PhabricatorExternalAccountIdentifier();
5
6$conn = $account_table->establishConnection('w');
7$table_name = $account_table->getTableName();
8
9$iterator = new LiskRawMigrationIterator($conn, $table_name);
10foreach ($iterator as $account_row) {
11 // We don't need to migrate "accountID" values for "password" accounts,
12 // since these were dummy values in the first place and are no longer
13 // read or written after D21014. (There would be no harm in writing these
14 // rows, but it's easy to skip them.)
15
16 if ($account_row['accountType'] === 'password') {
17 continue;
18 }
19
20 $account_id = $account_row['accountID'];
21 if (!strlen($account_id)) {
22 continue;
23 }
24
25 queryfx(
26 $conn,
27 'INSERT IGNORE INTO %R (
28 phid, externalAccountPHID, providerConfigPHID,
29 identifierHash, identifierRaw,
30 dateCreated, dateModified)
31 VALUES (%s, %s, %s, %s, %s, %d, %d)',
32 $identifier_table,
33 $identifier_table->generatePHID(),
34 $account_row['phid'],
35 $account_row['providerConfigPHID'],
36 PhabricatorHash::digestForIndex($account_id),
37 $account_id,
38 $account_row['dateCreated'],
39 $account_row['dateModified']);
40}