diff --git a/CHANGELOG.md b/CHANGELOG.md index d22ec5b..50cc579 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Redirect Changelog +## 1.0.23 - 2019-04-30 +### Changed +- Change the url size (source and destination url) from maximal 255 characters to maximal 1000 characters -## 1.0.22 - 2019-04-26 +### Fixed +- :void is not a return type in PHP < 7.1 +## 1.0.22 - 2019-04-26 ### Changed - Cleanup and improvements in the sourcecode diff --git a/composer.json b/composer.json index 1942e00..cd77f58 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "dolphiq/redirect", "description": "Craft redirect plugin provides an easy way to enter and maintain 301 and 302 redirects and 404 error pages.", "type": "craft-plugin", - "version": "1.0.22", + "version": "1.0.23", "keywords": [ "craft", "cms", @@ -35,7 +35,7 @@ "extra": { "name": "Redirect plugin for Craft 3", "handle": "redirect", - "schemaVersion": "1.0.4", + "schemaVersion": "1.0.5", "developer": "Dolphiq", "developerUrl": "https://dolphiq.nl/", "description": "Craft redirect plugin provides an easy way to enter and maintain 301 and 302 redirects and 404 error pages.", diff --git a/src/RedirectPlugin.php b/src/RedirectPlugin.php index f6ffe7f..10133b5 100644 --- a/src/RedirectPlugin.php +++ b/src/RedirectPlugin.php @@ -54,7 +54,7 @@ public function getCatchAll() public $hasCpSettings = true; // table schema version - public $schemaVersion = '1.0.4'; + public $schemaVersion = '1.0.5'; /* * @@ -135,7 +135,7 @@ public function registerCpUrlRules(RegisterUrlRulesEvent $event) /** * Registers our custom feed import logic if feed-me is enabled. Also note, we're checking for craft\feedme */ - private function registerFeedMeElement(): void + private function registerFeedMeElement() { if (Craft::$app->plugins->isPluginEnabled('feed-me') && class_exists(\craft\feedme\Plugin::class)) { Event::on(\craft\feedme\services\Elements::class, \craft\feedme\services\Elements::EVENT_REGISTER_FEED_ME_ELEMENTS, function (\craft\feedme\events\RegisterFeedMeElementsEvent $e) { @@ -152,8 +152,6 @@ public function init() self::$plugin = $this; // only register CP URLs if the user is logged in - - Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, [$this, 'registerCpUrlRules']); // Register FeedMe ElementType diff --git a/src/elements/Redirect.php b/src/elements/Redirect.php index 94c5079..58c681b 100644 --- a/src/elements/Redirect.php +++ b/src/elements/Redirect.php @@ -275,7 +275,7 @@ public function rules() $rules = parent::rules(); $rules[] = [['hitAt'], DateTimeValidator::class]; $rules[] = [['hitCount'], 'number', 'integerOnly' => true]; - $rules[] = [['sourceUrl', 'destinationUrl'], 'string', 'max' => 255]; + $rules[] = [['sourceUrl', 'destinationUrl'], 'string', 'max' => 1000]; $rules[] = [['sourceUrl', 'destinationUrl'], 'required']; return $rules; } diff --git a/src/migrations/m190426_121317_change_url_size_to_1000.php b/src/migrations/m190426_121317_change_url_size_to_1000.php new file mode 100644 index 0000000..673a354 --- /dev/null +++ b/src/migrations/m190426_121317_change_url_size_to_1000.php @@ -0,0 +1,35 @@ +db->tableExists('{{%dolphiq_redirects}}') + && $this->db->columnExists('{{%dolphiq_redirects}}', 'sourceUrl') + && $this->db->columnExists('{{%dolphiq_redirects}}', 'destinationUrl') + ) { + $this->alterColumn('{{%dolphiq_redirects}}','sourceUrl', $this->string(1000)->notNull()->defaultValue('')); + $this->alterColumn('{{%dolphiq_redirects}}','destinationUrl', $this->string(1000)->notNull()->defaultValue('')); + } + } + + /** + * @inheritdoc + */ + public function safeDown() + { + echo "m190426_121317_change_url_size_to_1000 cannot be reverted, we keep the larger size.\n"; + return true; + } +}