Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140722.appname.php
| Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | foreach ($applications as $application) { | ||||
| $old_name = 'PhabricatorApplication'.$application; | $old_name = 'PhabricatorApplication'.$application; | ||||
| $new_name = 'Phabricator'.$application.'Application'; | $new_name = 'Phabricator'.$application.'Application'; | ||||
| $map[$old_name] = $new_name; | $map[$old_name] = $new_name; | ||||
| } | } | ||||
| /* -( User preferences )--------------------------------------------------- */ | /* -( User preferences )--------------------------------------------------- */ | ||||
| echo pht('Migrating user preferences...')."\n"; | |||||
| $table = new PhabricatorUserPreferences(); | |||||
| $conn_w = $table->establishConnection('w'); | |||||
| $pref_pinned = PhabricatorUserPreferences::PREFERENCE_APP_PINNED; | |||||
| foreach (new LiskMigrationIterator(new PhabricatorUser()) as $user) { | |||||
| $user_preferences = $user->loadPreferences(); | |||||
| $old_pinned_apps = $user_preferences->getPreference($pref_pinned); | |||||
| $new_pinned_apps = array(); | |||||
| if (!$old_pinned_apps) { | // This originally migrated pinned applications in user preferences, but was | ||||
| continue; | // removed to simplify preference changes after about 22 months. | ||||
| } | |||||
| foreach ($old_pinned_apps as $pinned_app) { | |||||
| $new_pinned_apps[] = idx($map, $pinned_app, $pinned_app); | |||||
| } | |||||
| $user_preferences | |||||
| ->setPreference($pref_pinned, $new_pinned_apps); | |||||
| queryfx( | |||||
| $conn_w, | |||||
| 'UPDATE %T SET preferences = %s WHERE id = %d', | |||||
| $user_preferences->getTableName(), | |||||
| json_encode($user_preferences->getPreferences()), | |||||
| $user_preferences->getID()); | |||||
| } | |||||
| /* -( Dashboard installs )------------------------------------------------- */ | /* -( Dashboard installs )------------------------------------------------- */ | ||||
| echo pht('Migrating dashboard installs...')."\n"; | echo pht('Migrating dashboard installs...')."\n"; | ||||
| $table = new PhabricatorDashboardInstall(); | $table = new PhabricatorDashboardInstall(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| ▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines | |||||