Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140731.cancdn.php
| <?php | <?php | ||||
| $table = new PhabricatorFile(); | $table = new PhabricatorFile(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| foreach (new LiskMigrationIterator($table) as $file) { | foreach (new LiskMigrationIterator($table) as $file) { | ||||
| $id = $file->getID(); | $id = $file->getID(); | ||||
| echo "Updating flags for file {$id}...\n"; | echo pht('Updating flags for file %d...', $id)."\n"; | ||||
| $meta = $file->getMetadata(); | $meta = $file->getMetadata(); | ||||
| if (!idx($meta, 'canCDN')) { | if (!idx($meta, 'canCDN')) { | ||||
| $meta['canCDN'] = true; | $meta['canCDN'] = true; | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET metadata = %s WHERE id = %d', | 'UPDATE %T SET metadata = %s WHERE id = %d', | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| json_encode($meta), | json_encode($meta), | ||||
| $id); | $id); | ||||
| } | } | ||||
| } | } | ||||