Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140722.audit.4.migtext.php
| <?php | <?php | ||||
| $conn_w = id(new PhabricatorAuditTransaction())->establishConnection('w'); | $conn_w = id(new PhabricatorAuditTransaction())->establishConnection('w'); | ||||
| $rows = new LiskRawMigrationIterator($conn_w, 'audit_comment'); | $rows = new LiskRawMigrationIterator($conn_w, 'audit_comment'); | ||||
| $content_source = PhabricatorContentSource::newForSource( | $content_source = PhabricatorContentSource::newForSource( | ||||
| PhabricatorContentSource::SOURCE_LEGACY, | PhabricatorContentSource::SOURCE_LEGACY, | ||||
| array())->serialize(); | array())->serialize(); | ||||
| echo "Migrating Audit comment text to modern storage...\n"; | echo pht('Migrating Audit comment text to modern storage...')."\n"; | ||||
| foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
| $id = $row['id']; | $id = $row['id']; | ||||
| echo "Migrating Audit comment {$id}...\n"; | echo pht('Migrating Audit comment %d...', $id)."\n"; | ||||
| if (!strlen($row['content'])) { | if (!strlen($row['content'])) { | ||||
| echo "Comment has no text, continuing.\n"; | echo pht('Comment has no text, continuing.')."\n"; | ||||
| continue; | continue; | ||||
| } | } | ||||
| $xaction_phid = PhabricatorPHID::generateNewPHID( | $xaction_phid = PhabricatorPHID::generateNewPHID( | ||||
| PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, | PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, | ||||
| PhabricatorRepositoryCommitPHIDType::TYPECONST); | PhabricatorRepositoryCommitPHIDType::TYPECONST); | ||||
| $comment_phid = PhabricatorPHID::generateNewPHID( | $comment_phid = PhabricatorPHID::generateNewPHID( | ||||
| Show All 29 Lines | queryfx( | ||||
| // dateCreated, dateModified, commitPHID, pathID, legacyCommentID | // dateCreated, dateModified, commitPHID, pathID, legacyCommentID | ||||
| $row['dateCreated'], | $row['dateCreated'], | ||||
| $row['dateModified'], | $row['dateModified'], | ||||
| $row['targetPHID'], | $row['targetPHID'], | ||||
| null, | null, | ||||
| $row['id']); | $row['id']); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||