Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102069189
ponder-mailkey-populate.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
Sun, Feb 16, 19:20
Size
595 B
Mime Type
text/x-php
Expires
Tue, Feb 18, 19:20 (2 d)
Engine
blob
Format
Raw Data
Handle
24274803
Attached To
rPH Phabricator
ponder-mailkey-populate.php
View Options
<?php
echo
pht
(
'Populating Questions with mail keys...'
).
"
\n
"
;
$table
=
new
PonderQuestion
();
$table
->
openTransaction
();
foreach
(
new
LiskMigrationIterator
(
$table
)
as
$question
)
{
$id
=
$question
->
getID
();
echo
pht
(
'Question %d: '
,
$id
);
if
(!
$question
->
getMailKey
())
{
queryfx
(
$question
->
establishConnection
(
'w'
),
'UPDATE %T SET mailKey = %s WHERE id = %d'
,
$question
->
getTableName
(),
Filesystem
::
readRandomCharacters
(
20
),
$id
);
echo
pht
(
'Generated Key'
).
"
\n
"
;
}
else
{
echo
"-
\n
"
;
}
}
$table
->
saveTransaction
();
echo
pht
(
'Done.'
).
"
\n
"
;
Event Timeline
Log In to Comment