Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140731.audit.1.subscribers.php
| <?php | <?php | ||||
| $table = new PhabricatorRepositoryAuditRequest(); | $table = new PhabricatorRepositoryAuditRequest(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| echo "Migrating Audit subscribers to subscriptions...\n"; | echo pht('Migrating Audit subscribers to subscriptions...')."\n"; | ||||
| foreach (new LiskMigrationIterator($table) as $request) { | foreach (new LiskMigrationIterator($table) as $request) { | ||||
| $id = $request->getID(); | $id = $request->getID(); | ||||
| echo "Migrating auditor {$id}...\n"; | echo pht("Migrating audit %d...\n", $id); | ||||
| if ($request->getAuditStatus() != 'cc') { | if ($request->getAuditStatus() != 'cc') { | ||||
| // This isn't a "subscriber", so skip it. | // This isn't a "subscriber", so skip it. | ||||
| continue; | continue; | ||||
| } | } | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'INSERT IGNORE INTO %T (src, type, dst) VALUES (%s, %d, %s)', | 'INSERT IGNORE INTO %T (src, type, dst) VALUES (%s, %d, %s)', | ||||
| PhabricatorEdgeConfig::TABLE_NAME_EDGE, | PhabricatorEdgeConfig::TABLE_NAME_EDGE, | ||||
| $request->getCommitPHID(), | $request->getCommitPHID(), | ||||
| PhabricatorObjectHasSubscriberEdgeType::EDGECONST, | PhabricatorObjectHasSubscriberEdgeType::EDGECONST, | ||||
| $request->getAuditorPHID()); | $request->getAuditorPHID()); | ||||
| // Wipe the row. | // Wipe the row. | ||||
| $request->delete(); | $request->delete(); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||