@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
at recaptime-dev/main 34 lines 873 B view raw
1<?php 2 3echo pht('Migrating user emails...')."\n"; 4 5$table = new PhabricatorUser(); 6$table->openTransaction(); 7$conn = $table->establishConnection('w'); 8 9$emails = queryfx_all( 10 $conn, 11 'SELECT phid, email FROM %T LOCK IN SHARE MODE', 12 $table->getTableName()); 13$emails = ipull($emails, 'email', 'phid'); 14 15$etable = new PhabricatorUserEmail(); 16 17foreach ($emails as $phid => $email) { 18 19 // NOTE: Grandfather all existing email in as primary / verified. We generate 20 // verification codes because they are used for password resets, etc. 21 22 echo pht("Migrating '%s'...", $phid)."\n"; 23 queryfx( 24 $conn, 25 'INSERT INTO %T (userPHID, address, verificationCode, isVerified, isPrimary) 26 VALUES (%s, %s, %s, 1, 1)', 27 $etable->getTableName(), 28 $phid, 29 $email, 30 Filesystem::readRandomCharacters(24)); 31} 32 33$table->saveTransaction(); 34echo pht('Done.')."\n";