mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 19:32:40 +01:00
e2a94019b1
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 lines
764 B
PHP
34 lines
764 B
PHP
<?php
|
|
|
|
$table = new PhabricatorUser();
|
|
$conn = $table->establishConnection('w');
|
|
|
|
foreach (new LiskMigrationIterator($table) as $user) {
|
|
// Ignore users who are verified.
|
|
if ($user->getIsEmailVerified()) {
|
|
continue;
|
|
}
|
|
|
|
// Ignore unverified users with missing (rare) or unverified (common)
|
|
// primary emails: it's correct that their accounts are not verified.
|
|
$primary = $user->loadPrimaryEmail();
|
|
if (!$primary) {
|
|
continue;
|
|
}
|
|
|
|
if (!$primary->getIsVerified()) {
|
|
continue;
|
|
}
|
|
|
|
queryfx(
|
|
$conn,
|
|
'UPDATE %T SET isEmailVerified = 1 WHERE id = %d',
|
|
$table->getTableName(),
|
|
$user->getID());
|
|
|
|
echo tsprintf(
|
|
"%s\n",
|
|
pht(
|
|
'Corrected account verification state for user "%s".',
|
|
$user->getUsername()));
|
|
}
|