Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #88 from Dolphiq/development
Browse files Browse the repository at this point in the history
Set url to maximal 1000 characters
  • Loading branch information
johanzandstra authored Apr 30, 2019
2 parents 71b6689 + 846e430 commit 4874513
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.",
Expand Down
6 changes: 2 additions & 4 deletions src/RedirectPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getCatchAll()
public $hasCpSettings = true;

// table schema version
public $schemaVersion = '1.0.4';
public $schemaVersion = '1.0.5';

/*
*
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
35 changes: 35 additions & 0 deletions src/migrations/m190426_121317_change_url_size_to_1000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace dolphiq\redirect\migrations;

use Craft;
use craft\db\Migration;

/**
* m190426_121317_change_url_size_to_1000 migration.
*/
class m190426_121317_change_url_size_to_1000 extends Migration
{
/**
* @inheritdoc
*/
public function safeUp()
{
if ($this->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;
}
}

0 comments on commit 4874513

Please sign in to comment.