@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 accounts to correct user email verification state flag

Summary:
Depends on D17785. Fixes T12635. There was a bug where users could verify their primary email without getting the "isEmailVerified" flag set on their accounts.

D17785 fixes this bug. This change migrates affected account to fix their state, now that they can't get in trouble any more (hopefully).

Test Plan:
- Explicitly removed this flag from a bunch of accounts.
- Ran migration, saw the accounts get fixed.
- Ran migration again (`storage upgrade --apply ...`), saw the accounts not get touched.
- We have 117 affected accounts on `secure`, so I'll verify that this fixes them.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12635

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

+34
+34
resources/sql/autopatches/20170424.user.01.verify.php
··· 1 + <?php 2 + 3 + $table = new PhabricatorUser(); 4 + $conn = $table->establishConnection('w'); 5 + 6 + foreach (new LiskMigrationIterator($table) as $user) { 7 + // Ignore users who are verified. 8 + if ($user->getIsEmailVerified()) { 9 + continue; 10 + } 11 + 12 + // Ignore unverified users with missing (rare) or unverified (common) 13 + // primary emails: it's correct that their accounts are not verified. 14 + $primary = $user->loadPrimaryEmail(); 15 + if (!$primary) { 16 + continue; 17 + } 18 + 19 + if (!$primary->getIsVerified()) { 20 + continue; 21 + } 22 + 23 + queryfx( 24 + $conn, 25 + 'UPDATE %T SET isEmailVerified = 1 WHERE id = %d', 26 + $table->getTableName(), 27 + $user->getID()); 28 + 29 + echo tsprintf( 30 + "%s\n", 31 + pht( 32 + 'Corrected account verification state for user "%s".', 33 + $user->getUsername())); 34 + }