Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20131112.userverified.2.mig.php
| <?php | <?php | ||||
| $table = new PhabricatorUser(); | $table = new PhabricatorUser(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| foreach (new LiskMigrationIterator($table) as $user) { | foreach (new LiskMigrationIterator($table) as $user) { | ||||
| $username = $user->getUsername(); | $username = $user->getUsername(); | ||||
| echo "Migrating {$username}...\n"; | echo pht('Migrating %s...', $username)."\n"; | ||||
| if ($user->getIsEmailVerified()) { | if ($user->getIsEmailVerified()) { | ||||
| // Email already verified. | // Email already verified. | ||||
| continue; | continue; | ||||
| } | } | ||||
| $primary = $user->loadPrimaryEmail(); | $primary = $user->loadPrimaryEmail(); | ||||
| if (!$primary) { | if (!$primary) { | ||||
| // No primary email. | // No primary email. | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!$primary->getIsVerified()) { | if (!$primary->getIsVerified()) { | ||||
| // Primary email not verified. | // Primary email not verified. | ||||
| continue; | continue; | ||||
| } | } | ||||
| // Primary email is verified, so mark the account as verified. | // Primary email is verified, so mark the account as verified. | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET isEmailVerified = 1 WHERE id = %d', | 'UPDATE %T SET isEmailVerified = 1 WHERE id = %d', | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| $user->getID()); | $user->getID()); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||