Conditions | 4 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function safeUp() |
||
18 | { |
||
19 | $projectConfig = Craft::$app->projectConfig; |
||
20 | |||
21 | // Don't make the same config changes twice |
||
22 | $schemaVersion = $projectConfig->get('plugins.videos.schemaVersion', true); |
||
23 | |||
24 | if (version_compare($schemaVersion, '1.0.3', '<')) { |
||
25 | // Get OAuth provider options |
||
26 | $oauthProviderOptions = $projectConfig->get('plugins.videos.settings.oauthProviderOptions', true); |
||
27 | |||
28 | if(!is_array($oauthProviderOptions)) { |
||
29 | return true; |
||
30 | } |
||
31 | |||
32 | $oauthProviderOptions = ProjectConfig::unpackAssociativeArray($oauthProviderOptions); |
||
33 | |||
34 | // Reset OAuth provider options |
||
35 | $projectConfig->set('plugins.videos.settings.oauthProviderOptions', [], "Reset the oauth provider options"); |
||
36 | |||
37 | // Rebuild OAuth provider options |
||
38 | foreach($oauthProviderOptions as $providerHandle => $provider) { |
||
39 | $projectConfig->set('plugins.videos.settings.oauthProviderOptions.'.$providerHandle, $provider, "Save the “{$providerHandle}” provider"); |
||
40 | } |
||
53 |