mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
da40f80741
Summary: Ref T13217. This method is slightly tricky: - We can't safely return a string: return an array instead. - It no longer makes sense to accept glue. All callers use `', '` as glue anyway, so hard-code that. Then convert all callsites. Test Plan: Browsed around, saw fewer "unsafe" errors in error log. Reviewers: amckinley Reviewed By: amckinley Subscribers: yelirekim, PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13217 Differential Revision: https://secure.phabricator.com/D19784
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
echo pht('Populating Phabricator files with mail keys xactions...')."\n";
|
|
|
|
$table = new PhabricatorFile();
|
|
$table_name = $table->getTableName();
|
|
|
|
$conn_w = $table->establishConnection('w');
|
|
$conn_w->openTransaction();
|
|
|
|
$sql = array();
|
|
foreach (new LiskRawMigrationIterator($conn_w, 'file') as $row) {
|
|
// NOTE: MySQL requires that the INSERT specify all columns which don't
|
|
// have default values when configured in strict mode. This query will
|
|
// never actually insert rows, but we need to hand it values anyway.
|
|
|
|
$sql[] = qsprintf(
|
|
$conn_w,
|
|
'(%d, %s, 0, 0, 0, 0, 0, 0, 0, 0)',
|
|
$row['id'],
|
|
Filesystem::readRandomCharacters(20));
|
|
}
|
|
|
|
if ($sql) {
|
|
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
|
|
queryfx(
|
|
$conn_w,
|
|
'INSERT INTO %T
|
|
(id, mailKey, phid, byteSize, storageEngine, storageFormat,
|
|
storageHandle, dateCreated, dateModified, metadata) VALUES %LQ '.
|
|
'ON DUPLICATE KEY UPDATE mailKey = VALUES(mailKey)',
|
|
$table_name,
|
|
$chunk);
|
|
}
|
|
}
|
|
|
|
$table->saveTransaction();
|
|
echo pht('Done.')."\n";
|