[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 echo "Populating Phabricator files with mail keys xactions...\n"; 4 5 $table = new PhabricatorFile(); 6 $table_name = $table->getTableName(); 7 8 $conn_w = $table->establishConnection('w'); 9 $conn_w->openTransaction(); 10 11 $sql = array(); 12 foreach (new LiskRawMigrationIterator($conn_w, 'file') as $row) { 13 // NOTE: MySQL requires that the INSERT specify all columns which don't 14 // have default values when configured in strict mode. This query will 15 // never actually insert rows, but we need to hand it values anyway. 16 17 $sql[] = qsprintf( 18 $conn_w, 19 '(%d, %s, 0, 0, 0, 0, 0, 0, 0, 0)', 20 $row['id'], 21 Filesystem::readRandomCharacters(20)); 22 } 23 24 if ($sql) { 25 foreach (PhabricatorLiskDAO::chunkSQL($sql, ', ') as $chunk) { 26 queryfx( 27 $conn_w, 28 'INSERT INTO %T 29 (id, mailKey, phid, byteSize, storageEngine, storageFormat, 30 storageHandle, dateCreated, dateModified, metadata) VALUES %Q '. 31 'ON DUPLICATE KEY UPDATE mailKey = VALUES(mailKey)', 32 $table_name, 33 $chunk); 34 } 35 } 36 37 $table->saveTransaction(); 38 echo "Done.\n";
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |