2012-10-08 20:14:58 -07:00
|
|
|
<?php
|
|
|
|
|
2015-05-22 17:27:56 +10:00
|
|
|
echo pht('Populating Questions with mail keys...')."\n";
|
2013-01-16 17:55:39 -08:00
|
|
|
$table = new PonderQuestion();
|
|
|
|
$table->openTransaction();
|
|
|
|
|
|
|
|
foreach (new LiskMigrationIterator($table) as $question) {
|
2012-10-08 20:14:58 -07:00
|
|
|
$id = $question->getID();
|
|
|
|
|
2015-05-22 17:27:56 +10:00
|
|
|
echo pht('Question %d: ', $id);
|
2012-10-08 20:14:58 -07:00
|
|
|
if (!$question->getMailKey()) {
|
|
|
|
queryfx(
|
|
|
|
$question->establishConnection('w'),
|
|
|
|
'UPDATE %T SET mailKey = %s WHERE id = %d',
|
|
|
|
$question->getTableName(),
|
|
|
|
Filesystem::readRandomCharacters(20),
|
|
|
|
$id);
|
2015-05-22 17:27:56 +10:00
|
|
|
echo pht('Generated Key')."\n";
|
2012-10-08 20:14:58 -07:00
|
|
|
} else {
|
|
|
|
echo "-\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-16 17:55:39 -08:00
|
|
|
$table->saveTransaction();
|
2015-05-22 17:27:56 +10:00
|
|
|
echo pht('Done.')."\n";
|