Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91315663
emailtableport.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 9, 22:37
Size
847 B
Mime Type
text/x-php
Expires
Mon, Nov 11, 22:37 (2 d)
Engine
blob
Format
Raw Data
Handle
22237982
Attached To
rPH Phabricator
emailtableport.php
View Options
<?php
echo
"Migrating user emails...
\n
"
;
$table
=
new
PhabricatorUser
();
$table
->
openTransaction
();
$conn
=
$table
->
establishConnection
(
'w'
);
$emails
=
queryfx_all
(
$conn
,
'SELECT phid, email FROM %T LOCK IN SHARE MODE'
,
$table
->
getTableName
());
$emails
=
ipull
(
$emails
,
'email'
,
'phid'
);
$etable
=
new
PhabricatorUserEmail
();
foreach
(
$emails
as
$phid
=>
$email
)
{
// NOTE: Grandfather all existing email in as primary / verified. We generate
// verification codes because they are used for password resets, etc.
echo
"Migrating '{$phid}'...
\n
"
;
queryfx
(
$conn
,
'INSERT INTO %T (userPHID, address, verificationCode, isVerified, isPrimary)
VALUES (%s, %s, %s, 1, 1)'
,
$etable
->
getTableName
(),
$phid
,
$email
,
Filesystem
::
readRandomCharacters
(
24
));
}
$table
->
saveTransaction
();
echo
"Done.
\n
"
;
Event Timeline
Log In to Comment