Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20130802.heraldphids.php
| <?php | <?php | ||||
| $table = new HeraldRule(); | $table = new HeraldRule(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| echo "Assigning PHIDs to Herald Rules...\n"; | echo pht('Assigning PHIDs to Herald Rules...')."\n"; | ||||
| foreach (new LiskMigrationIterator(new HeraldRule()) as $rule) { | foreach (new LiskMigrationIterator(new HeraldRule()) as $rule) { | ||||
| $id = $rule->getID(); | $id = $rule->getID(); | ||||
| echo "Rule {$id}.\n"; | echo pht('Rule %d.', $id)."\n"; | ||||
| if ($rule->getPHID()) { | if ($rule->getPHID()) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET phid = %s WHERE id = %d', | 'UPDATE %T SET phid = %s WHERE id = %d', | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| PhabricatorPHID::generateNewPHID(HeraldRulePHIDType::TYPECONST), | PhabricatorPHID::generateNewPHID(HeraldRulePHIDType::TYPECONST), | ||||
| $rule->getID()); | $rule->getID()); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||