1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00
phorge-phorge/resources/sql/patches/ponder-mailkey-populate.php

26 lines
564 B
PHP
Raw Normal View History

<?php
echo "Populating Questions with mail keys...\n";
$table = new PonderQuestion();
$table->openTransaction();
foreach (new LiskMigrationIterator($table) as $question) {
$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";
}
}
$table->saveTransaction();
echo "Done.\n";