Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140106.macromailkey.2.php
| <?php | <?php | ||||
| echo "Adding mailkeys to macros.\n"; | echo pht('Adding mailkeys to macros.')."\n"; | ||||
| $table = new PhabricatorFileImageMacro(); | $table = new PhabricatorFileImageMacro(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| $iterator = new LiskMigrationIterator($table); | $iterator = new LiskMigrationIterator($table); | ||||
| foreach ($iterator as $macro) { | foreach ($iterator as $macro) { | ||||
| $id = $macro->getID(); | $id = $macro->getID(); | ||||
| echo "Populating macro {$id}...\n"; | echo pht('Populating macro %d...', $id)."\n"; | ||||
| if (!$macro->getMailKey()) { | if (!$macro->getMailKey()) { | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET mailKey = %s WHERE id = %d', | 'UPDATE %T SET mailKey = %s WHERE id = %d', | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| Filesystem::readRandomCharacters(20), | Filesystem::readRandomCharacters(20), | ||||
| $id); | $id); | ||||
| } | } | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||