1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 07:50:57 +01:00
phorge-phorge/resources/sql/patches/081.filekeys.php

23 lines
523 B
PHP
Raw Normal View History

<?php
echo "Generating file keys...\n";
$table = new PhabricatorFile();
$table->openTransaction();
$table->beginReadLocking();
$files = $table->loadAllWhere('secretKey IS NULL');
echo count($files).' files to generate keys for';
foreach ($files as $file) {
queryfx(
$file->establishConnection('w'),
'UPDATE %T SET secretKey = %s WHERE id = %d',
$file->getTableName(),
$file->generateSecretKey(),
$file->getID());
echo '.';
}
$table->endReadLocking();
$table->saveTransaction();
echo "\nDone.\n";