Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15396400
D17786.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D17786.diff
View Options
diff --git a/resources/sql/autopatches/20170424.user.01.verify.php b/resources/sql/autopatches/20170424.user.01.verify.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170424.user.01.verify.php
@@ -0,0 +1,34 @@
+<?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()));
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 17, 1:56 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7708434
Default Alt Text
D17786.diff (1 KB)
Attached To
Mode
D17786: Migrate accounts to correct user email verification state flag
Attached
Detach File
Event Timeline
Log In to Comment