Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140722.audit.3.miginlines.php
| <?php | <?php | ||||
| $audit_table = new PhabricatorAuditTransaction(); | $audit_table = new PhabricatorAuditTransaction(); | ||||
| $conn_w = $audit_table->establishConnection('w'); | $conn_w = $audit_table->establishConnection('w'); | ||||
| $conn_w->openTransaction(); | $conn_w->openTransaction(); | ||||
| $src_table = 'audit_inlinecomment'; | $src_table = 'audit_inlinecomment'; | ||||
| $dst_table = 'audit_transaction_comment'; | $dst_table = 'audit_transaction_comment'; | ||||
| echo "Migrating Audit inline comments to new format...\n"; | echo pht('Migrating Audit inline comments to new format...')."\n"; | ||||
| $content_source = PhabricatorContentSource::newForSource( | $content_source = PhabricatorContentSource::newForSource( | ||||
| PhabricatorContentSource::SOURCE_LEGACY, | PhabricatorContentSource::SOURCE_LEGACY, | ||||
| array())->serialize(); | array())->serialize(); | ||||
| $rows = new LiskRawMigrationIterator($conn_w, $src_table); | $rows = new LiskRawMigrationIterator($conn_w, $src_table); | ||||
| foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
| $id = $row['id']; | $id = $row['id']; | ||||
| echo "Migrating inline #{$id}...\n"; | echo pht('Migrating inline #%d...', $id); | ||||
| if ($row['auditCommentID']) { | if ($row['auditCommentID']) { | ||||
| $xaction_phid = PhabricatorPHID::generateNewPHID( | $xaction_phid = PhabricatorPHID::generateNewPHID( | ||||
| PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, | PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, | ||||
| PhabricatorRepositoryCommitPHIDType::TYPECONST); | PhabricatorRepositoryCommitPHIDType::TYPECONST); | ||||
| } else { | } else { | ||||
| $xaction_phid = null; | $xaction_phid = null; | ||||
| } | } | ||||
| Show All 40 Lines | queryfx( | ||||
| $row['lineNumber'], | $row['lineNumber'], | ||||
| $row['lineLength'], | $row['lineLength'], | ||||
| 0, | 0, | ||||
| $row['auditCommentID']); | $row['auditCommentID']); | ||||
| } | } | ||||
| $conn_w->saveTransaction(); | $conn_w->saveTransaction(); | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||