2012-10-09 05:14:58 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
echo "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();
|
|
|
|
|
|
|
|
echo "Question {$id}: ";
|
|
|
|
if (!$question->getMailKey()) {
|
|
|
|
queryfx(
|
|
|
|
$question->establishConnection('w'),
|
|
|
|
'UPDATE %T SET mailKey = %s WHERE id = %d',
|
|
|
|
$question->getTableName(),
|
|
|
|
Filesystem::readRandomCharacters(20),
|
|
|
|
$id);
|
|
|
|
echo "Generated Key\n";
|
|
|
|
} else {
|
|
|
|
echo "-\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-17 02:55:39 +01:00
|
|
|
$table->saveTransaction();
|
2012-10-09 05:14:58 +02:00
|
|
|
echo "Done.\n";
|