[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 $conn_w = id(new DifferentialRevision())->establishConnection('w'); 4 $rows = new LiskRawMigrationIterator($conn_w, 'differential_comment'); 5 6 $content_source = PhabricatorContentSource::newForSource( 7 PhabricatorContentSource::SOURCE_LEGACY, 8 array())->serialize(); 9 10 echo "Migrating Differential comment text to modern storage...\n"; 11 foreach ($rows as $row) { 12 $id = $row['id']; 13 echo "Migrating Differential comment {$id}...\n"; 14 if (!strlen($row['content'])) { 15 echo "Comment has no text, continuing.\n"; 16 continue; 17 } 18 19 $revision = id(new DifferentialRevision())->load($row['revisionID']); 20 if (!$revision) { 21 echo "Comment has no valid revision, continuing.\n"; 22 continue; 23 } 24 25 $revision_phid = $revision->getPHID(); 26 27 $dst_table = 'differential_inline_comment'; 28 29 $xaction_phid = PhabricatorPHID::generateNewPHID( 30 PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, 31 DifferentialRevisionPHIDType::TYPECONST); 32 33 $comment_phid = PhabricatorPHID::generateNewPHID( 34 PhabricatorPHIDConstants::PHID_TYPE_XCMT, 35 DifferentialRevisionPHIDType::TYPECONST); 36 37 queryfx( 38 $conn_w, 39 'INSERT IGNORE INTO %T 40 (phid, transactionPHID, authorPHID, viewPolicy, editPolicy, 41 commentVersion, content, contentSource, isDeleted, 42 dateCreated, dateModified, revisionPHID, changesetID, 43 legacyCommentID) 44 VALUES (%s, %s, %s, %s, %s, 45 %d, %s, %s, %d, 46 %d, %d, %s, %nd, 47 %d)', 48 'differential_transaction_comment', 49 50 // phid, transactionPHID, authorPHID, viewPolicy, editPolicy 51 $comment_phid, 52 $xaction_phid, 53 $row['authorPHID'], 54 'public', 55 $row['authorPHID'], 56 57 // commentVersion, content, contentSource, isDeleted 58 1, 59 $row['content'], 60 $content_source, 61 0, 62 63 // dateCreated, dateModified, revisionPHID, changesetID, legacyCommentID 64 $row['dateCreated'], 65 $row['dateModified'], 66 $revision_phid, 67 null, 68 $row['id']); 69 } 70 71 echo "Done.\n";
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |