diff --git a/CHANGELOG.md b/CHANGELOG.md index 7044733..6ba2b35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,22 @@ # Linkit Changelog > One link field to rule them all, built for [Craft 3](http://craftcms.com) -## 1.1.8 - 2019-02-04 +## 1.1.8 - 2019-02-08 ### Changed -* Changed migration scripts as per Crafts new recommendations +* Changed migration scripts as per Crafts new recommendations (Thanks to @andris) * Changed requires Craft 3.1.2+ * Changed README.md installation instructions -## 1.1.7 - 2019-01-28 - ### Fixed -* Fixed README.md typos +* Fixed some README.md typos ### Added * Added `{{ customText }}` info to the docs - ## 1.1.6 - 2019-01-17 ### Fixed diff --git a/composer.json b/composer.json index 75080ba..0dfa844 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ } ], "require": { - "craftcms/cms": "^3.1.2" + "craftcms/cms": "^3.1.8" }, "repositories": [ { diff --git a/src/migrations/Install.php b/src/migrations/Install.php index 79e0780..55b31ed 100644 --- a/src/migrations/Install.php +++ b/src/migrations/Install.php @@ -47,12 +47,11 @@ private function _upgradeFromCraft2() case 'fruitlinkit': case 'fruit-link-it': case 'fruit-linkit': - $this->delete('{{%plugins}}', ['handle' => $pluginHandle]); $projectConfig->remove(Plugins::CONFIG_PLUGINS_KEY . '.' . $pluginHandle); break; } } - + $this->delete('{{%plugins}}', ['handle' => ['fruitlinkit', 'fruit-linkit', 'fruit-link-it']]); // Get the field data from the project config $fields = $projectConfig->get(Fields::CONFIG_FIELDS_KEY) ?? []; @@ -61,7 +60,7 @@ private function _upgradeFromCraft2() if ($field['type'] === 'FruitLinkIt') { $type = LinkitField::class; - $settings = $this->_migrateFieldSettings($field['settings'] ? Json::decode($field['settings']) : null); + $settings = $this->_migrateFieldSettings($field['settings']); $field['type'] = $type; $field['settings'] = $settings; @@ -70,6 +69,7 @@ private function _upgradeFromCraft2() 'type' => $type, 'settings' => Json::encode($settings), ], ['uid' => $fieldUid]); + $projectConfig->set(Fields::CONFIG_FIELDS_KEY . '.' . $fieldUid, $field); } } diff --git a/src/migrations/m180423_175007_linkit_craft2.php b/src/migrations/m180423_175007_linkit_craft2.php index 4d00f2a..f148675 100644 --- a/src/migrations/m180423_175007_linkit_craft2.php +++ b/src/migrations/m180423_175007_linkit_craft2.php @@ -23,6 +23,7 @@ class m180423_175007_linkit_craft2 extends Migration public function safeUp() { $this->_upgradeFromCraft2(); + return true; } private function _upgradeFromCraft2() @@ -47,12 +48,11 @@ private function _upgradeFromCraft2() case 'fruitlinkit': case 'fruit-link-it': case 'fruit-linkit': - $this->delete('{{%plugins}}', ['handle' => $pluginHandle]); $projectConfig->remove(Plugins::CONFIG_PLUGINS_KEY . '.' . $pluginHandle); break; } } - + $this->delete('{{%plugins}}', ['handle' => ['fruitlinkit', 'fruit-linkit', 'fruit-link-it']]); // Get the field data from the project config $fields = $projectConfig->get(Fields::CONFIG_FIELDS_KEY) ?? []; @@ -61,7 +61,7 @@ private function _upgradeFromCraft2() if ($field['type'] === 'FruitLinkIt') { $type = LinkitField::class; - $settings = $this->_migrateFieldSettings($field['settings'] ? Json::decode($field['settings']) : null); + $settings = $this->_migrateFieldSettings($field['settings']); $field['type'] = $type; $field['settings'] = $settings; @@ -70,6 +70,7 @@ private function _upgradeFromCraft2() 'type' => $type, 'settings' => Json::encode($settings), ], ['uid' => $fieldUid]); + $projectConfig->set(Fields::CONFIG_FIELDS_KEY . '.' . $fieldUid, $field); } }