Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20130728.ponderxcomment.php
| <?php | <?php | ||||
| $qtable = new PonderQuestionTransaction(); | $qtable = new PonderQuestionTransaction(); | ||||
| $atable = new PonderAnswerTransaction(); | $atable = new PonderAnswerTransaction(); | ||||
| $conn_w = $qtable->establishConnection('w'); | $conn_w = $qtable->establishConnection('w'); | ||||
| $conn_w->openTransaction(); | $conn_w->openTransaction(); | ||||
| echo "Migrating Ponder comments to ApplicationTransactions...\n"; | echo pht('Migrating Ponder comments to %s...', 'ApplicationTransactions')."\n"; | ||||
| $rows = new LiskRawMigrationIterator($conn_w, 'ponder_comment'); | $rows = new LiskRawMigrationIterator($conn_w, 'ponder_comment'); | ||||
| foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
| $id = $row['id']; | $id = $row['id']; | ||||
| echo "Migrating {$id}...\n"; | echo pht('Migrating %d...', $id)."\n"; | ||||
| $type = phid_get_type($row['targetPHID']); | $type = phid_get_type($row['targetPHID']); | ||||
| switch ($type) { | switch ($type) { | ||||
| case PonderQuestionPHIDType::TYPECONST: | case PonderQuestionPHIDType::TYPECONST: | ||||
| $table_obj = $qtable; | $table_obj = $qtable; | ||||
| $comment_obj = new PonderQuestionTransactionComment(); | $comment_obj = new PonderQuestionTransactionComment(); | ||||
| break; | break; | ||||
| case PonderAnswerPHIDType::TYPECONST: | case PonderAnswerPHIDType::TYPECONST: | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | queryfx( | ||||
| '[]', | '[]', | ||||
| $row['dateCreated'], | $row['dateCreated'], | ||||
| $row['dateModified']); | $row['dateModified']); | ||||
| } | } | ||||
| $conn_w->saveTransaction(); | $conn_w->saveTransaction(); | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||