Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140323.harbor.1.renames.php
| <?php | <?php | ||||
| $names = array( | $names = array( | ||||
| 'CommandBuildStepImplementation', | 'CommandBuildStepImplementation', | ||||
| 'LeaseHostBuildStepImplementation', | 'LeaseHostBuildStepImplementation', | ||||
| 'PublishFragmentBuildStepImplementation', | 'PublishFragmentBuildStepImplementation', | ||||
| 'SleepBuildStepImplementation', | 'SleepBuildStepImplementation', | ||||
| 'UploadArtifactBuildStepImplementation', | 'UploadArtifactBuildStepImplementation', | ||||
| 'WaitForPreviousBuildStepImplementation', | 'WaitForPreviousBuildStepImplementation', | ||||
| ); | ); | ||||
| $tables = array( | $tables = array( | ||||
| id(new HarbormasterBuildStep())->getTableName(), | id(new HarbormasterBuildStep())->getTableName(), | ||||
| id(new HarbormasterBuildTarget())->getTableName(), | id(new HarbormasterBuildTarget())->getTableName(), | ||||
| ); | ); | ||||
| echo "Renaming Harbormaster classes...\n"; | echo pht('Renaming Harbormaster classes...')."\n"; | ||||
| $conn_w = id(new HarbormasterBuildStep())->establishConnection('w'); | $conn_w = id(new HarbormasterBuildStep())->establishConnection('w'); | ||||
| foreach ($names as $name) { | foreach ($names as $name) { | ||||
| $old = $name; | $old = $name; | ||||
| $new = 'Harbormaster'.$name; | $new = 'Harbormaster'.$name; | ||||
| echo "Renaming {$old} -> {$new}...\n"; | echo pht('Renaming %s -> %s...', $old, $new)."\n"; | ||||
| foreach ($tables as $table) { | foreach ($tables as $table) { | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET className = %s WHERE className = %s', | 'UPDATE %T SET className = %s WHERE className = %s', | ||||
| $table, | $table, | ||||
| $new, | $new, | ||||
| $old); | $old); | ||||
| } | } | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||