Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94944144
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
Wed, Dec 11, 14:37
Size
873 B
Mime Type
text/x-php
Expires
Fri, Dec 13, 14:37 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22903755
Attached To
rPH Phabricator
emailtableport.php
View Options
<?php
echo
pht
(
'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
pht
(
"Migrating '%s'..."
,
$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
pht
(
'Done.'
).
"
\n
"
;
Event Timeline
Log In to Comment