[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 $qtable = new PonderQuestionTransaction(); 4 $atable = new PonderAnswerTransaction(); 5 6 $conn_w = $qtable->establishConnection('w'); 7 $conn_w->openTransaction(); 8 9 echo "Migrating Ponder comments to ApplicationTransactions...\n"; 10 11 $rows = new LiskRawMigrationIterator($conn_w, 'ponder_comment'); 12 foreach ($rows as $row) { 13 14 $id = $row['id']; 15 echo "Migrating {$id}...\n"; 16 17 $type = phid_get_type($row['targetPHID']); 18 switch ($type) { 19 case PonderQuestionPHIDType::TYPECONST: 20 $table_obj = $qtable; 21 $comment_obj = new PonderQuestionTransactionComment(); 22 break; 23 case PonderAnswerPHIDType::TYPECONST: 24 $table_obj = $atable; 25 $comment_obj = new PonderAnswerTransactionComment(); 26 break; 27 } 28 29 $comment_phid = PhabricatorPHID::generateNewPHID( 30 PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, 31 $type); 32 33 $xaction_phid = PhabricatorPHID::generateNewPHID( 34 PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, 35 $type); 36 37 queryfx( 38 $conn_w, 39 'INSERT INTO %T (phid, transactionPHID, authorPHID, viewPolicy, editPolicy, 40 commentVersion, content, contentSource, isDeleted, dateCreated, 41 dateModified) 42 VALUES (%s, %s, %s, %s, %s, %d, %s, %s, %d, %d, %d)', 43 $comment_obj->getTableName(), 44 $comment_phid, 45 $xaction_phid, 46 $row['authorPHID'], 47 'public', 48 $row['authorPHID'], 49 1, 50 $row['content'], 51 PhabricatorContentSource::newForSource( 52 PhabricatorContentSource::SOURCE_LEGACY, 53 array())->serialize(), 54 0, 55 $row['dateCreated'], 56 $row['dateModified']); 57 58 queryfx( 59 $conn_w, 60 'INSERT INTO %T (phid, authorPHID, objectPHID, viewPolicy, editPolicy, 61 commentPHID, commentVersion, transactionType, oldValue, newValue, 62 contentSource, metadata, dateCreated, dateModified) 63 VALUES (%s, %s, %s, %s, %s, %s, %d, %s, %ns, %ns, %s, %s, %d, %d)', 64 $table_obj->getTableName(), 65 $xaction_phid, 66 $row['authorPHID'], 67 $row['targetPHID'], 68 'public', 69 $row['authorPHID'], 70 $comment_phid, 71 1, 72 PhabricatorTransactions::TYPE_COMMENT, 73 'null', 74 'null', 75 PhabricatorContentSource::newForSource( 76 PhabricatorContentSource::SOURCE_LEGACY, 77 array())->serialize(), 78 '[]', 79 $row['dateCreated'], 80 $row['dateModified']); 81 82 } 83 84 $conn_w->saveTransaction(); 85 86 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 |