2012-10-09 05:14:58 +02:00
|
|
|
<?php
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Populating Questions with mail keys...')."\n";
|
2013-01-17 02:55:39 +01:00
|
|
|
$table = new PonderQuestion();
|
|
|
|
$table->openTransaction();
|
|
|
|
|
|
|
|
foreach (new LiskMigrationIterator($table) as $question) {
|
2012-10-09 05:14:58 +02:00
|
|
|
$id = $question->getID();
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Question %d: ', $id);
|
2012-10-09 05:14:58 +02: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 09:27:56 +02:00
|
|
|
echo pht('Generated Key')."\n";
|
2012-10-09 05:14:58 +02:00
|
|
|
} else {
|
|
|
|
echo "-\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-17 02:55:39 +01:00
|
|
|
$table->saveTransaction();
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|