| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class m161117_000001_remove_account_explorer_data_setting extends Migration |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Any migration code in here is wrapped inside of a transaction. |
||
| 16 | * |
||
| 17 | * @return bool |
||
| 18 | */ |
||
| 19 | public function safeUp() |
||
| 20 | { |
||
| 21 | // set forceConnect setting to true |
||
| 22 | |||
| 23 | $row = (new Query()) |
||
| 24 | ->select('*') |
||
| 25 | ->from(['{{%plugins}}']) |
||
| 26 | ->where(['handle' => 'analytics']) |
||
| 27 | ->one(); |
||
| 28 | |||
| 29 | if ($row) { |
||
| 30 | $settingsJson = $row['settings']; |
||
| 31 | |||
| 32 | $settings = Json::decode($settingsJson); |
||
| 33 | |||
| 34 | if (isset($settings['accountExplorerData'])) { |
||
| 35 | unset($settings['accountExplorerData']); |
||
| 36 | } |
||
| 37 | |||
| 38 | $settingsJson = Json::encode($settings); |
||
| 39 | |||
| 40 | $this->update('{{%plugins}}', ['settings' => $settingsJson], ['id' => $row['id']]); |
||
| 41 | } |
||
| 42 | |||
| 43 | return true; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @inheritdoc |
||
| 48 | */ |
||
| 49 | public function safeDown() |
||
| 54 | } |
||
| 55 | } |
||
| 56 |