@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

Migrate all "accountID" values to "ExternalAccountIdentifier" objects

Summary: Depends on D21016. Ref T13493. This copies existing external account "accountID" values into the "ExternalAccountIdentifier" table, preparing for an authority switch.

Test Plan: Ran migration several times, looked at the data that came out of it, saw sensible results. Logged out / in with external accounts.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13493

Differential Revision: https://secure.phabricator.com/D21017

+40
+40
resources/sql/autopatches/20200222.xident.01.migrate.php
··· 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); 10 + foreach ($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 + }