Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110488020
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, Apr 26, 13:35
Size
873 B
Mime Type
text/x-php
Expires
Mon, Apr 28, 13:35 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25807820
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