Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20130219.commitsummarymig.php
| <?php | <?php | ||||
| echo "Backfilling commit summaries...\n"; | echo pht('Backfilling commit summaries...')."\n"; | ||||
| $table = new PhabricatorRepositoryCommit(); | $table = new PhabricatorRepositoryCommit(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| $commits = new LiskMigrationIterator($table); | $commits = new LiskMigrationIterator($table); | ||||
| foreach ($commits as $commit) { | foreach ($commits as $commit) { | ||||
| echo 'Filling Commit #'.$commit->getID()."\n"; | echo pht('Filling Commit #%d', $commit->getID())."\n"; | ||||
| if (strlen($commit->getSummary())) { | if (strlen($commit->getSummary())) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $data = $commit->loadOneRelative( | $data = $commit->loadOneRelative( | ||||
| new PhabricatorRepositoryCommitData(), | new PhabricatorRepositoryCommitData(), | ||||
| 'commitID'); | 'commitID'); | ||||
| if (!$data) { | if (!$data) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET summary = %s WHERE id = %d', | 'UPDATE %T SET summary = %s WHERE id = %d', | ||||
| $commit->getTableName(), | $commit->getTableName(), | ||||
| $data->getSummary(), | $data->getSummary(), | ||||
| $commit->getID()); | $commit->getID()); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||