Skip to content

Commit 3641ca2

Browse files
Merge tag '4.0.0' into develop
4.0.0
2 parents 9f05de7 + ae8acca commit 3641ca2

File tree

28 files changed

+191
-151
lines changed

28 files changed

+191
-151
lines changed

.github/workflows/php.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
2121

2222
steps:
23-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v4
2424

2525
- name: Setup PHP
2626
uses: shivammathur/setup-php@v2
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: Cache Composer packages
3838
id: composer-cache
39-
uses: actions/cache@v2
39+
uses: actions/cache@v4
4040
with:
4141
path: vendor
4242
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
* Add support for October CMS 4.x.
10+
* Minimal version of PHP required is 8.2.0
11+
* Drop support for October CMS 3.x.
12+
713
## [3.1.11] - 2023-11-30
814

915
* Add option to keep query string when redirecting.

Plugin.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,18 @@ public function registerReportWidgets(): array
217217
/** @var Translator $translator */
218218
$translator = resolve(Translator::class);
219219

220-
$reportWidgets[ReportWidgets\CreateRedirect::class] = [
221-
'label' => 'vdlp.redirect::lang.buttons.create_redirect',
222-
'context' => 'dashboard',
223-
];
220+
$reportWidgets = [];
224221

225-
if (Settings::isStatisticsEnabled()) {
222+
if (class_exists('Dashboard\Classes\VueReportWidgetBase')) {
223+
$reportWidgets[VueComponents\CreateRedirect::class] = [
224+
'label' => e($translator->trans(
225+
'vdlp.redirect::lang.buttons.create_redirect'
226+
)),
227+
'context' => 'dashboard',
228+
];
229+
}
230+
231+
if (class_exists('Dashboard\Classes\ReportWidgetBase') && Settings::isStatisticsEnabled()) {
226232
$reportWidgets[ReportWidgets\TopTenRedirects::class] = [
227233
'label' => e($translator->trans(
228234
'vdlp.redirect::lang.statistics.top_redirects_this_month',

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ This plugin adds a 'Redirects' section to the main menu of October CMS. This plu
6464

6565
## Requirements
6666

67-
* October CMS 3
68-
* PHP version 8.0.2 or higher.
67+
* October CMS 4
68+
* PHP version 8.2.0 or higher.
6969
* PHP extensions: `ext-curl` and `ext-json`.
7070

7171
## Supported HTTP status codes

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^8.0.2",
17+
"php": "^8.2.0",
1818
"ext-curl": "*",
1919
"ext-json": "*",
2020
"composer/installers": "^1.0 || ^2.0",
2121
"davaxi/sparkline": "^2.0",
2222
"jaybizzle/crawler-detect": "^1.2",
2323
"league/csv": "^9.0",
24-
"october/rain": "^3.0 || ^4.0",
24+
"october/rain": "^4.0",
2525
"symfony/stopwatch": "^6.0"
2626
},
2727
"require-dev": {
@@ -33,6 +33,9 @@
3333
"url": "https://gateway.octobercms.com"
3434
}
3535
],
36+
"suggest": {
37+
"october/dashboard": "Allows to add the widgets to the dashboard."
38+
},
3639
"config": {
3740
"allow-plugins": {
3841
"composer/installers": true,

controllers/Redirects.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Illuminate\Support\Arr;
2020
use October\Rain\Database\Builder;
2121
use October\Rain\Database\Model;
22+
use October\Rain\Element\ElementHolder;
2223
use October\Rain\Exception\ApplicationException;
2324
use October\Rain\Exception\SystemException;
2425
use October\Rain\Flash\FlashBag;
@@ -37,7 +38,6 @@
3738
/**
3839
* @mixin Behaviors\FormController
3940
* @mixin Behaviors\ListController
40-
* @mixin Behaviors\ReorderController
4141
* @mixin Behaviors\ImportExportController
4242
* @mixin Behaviors\RelationController
4343
*/
@@ -46,7 +46,6 @@ final class Redirects extends Controller
4646
public $implement = [
4747
Behaviors\FormController::class,
4848
Behaviors\ListController::class,
49-
Behaviors\ReorderController::class,
5049
Behaviors\ImportExportController::class,
5150
Behaviors\RelationController::class,
5251
];
@@ -58,7 +57,6 @@ final class Redirects extends Controller
5857
'requestLog' => 'request-log/config_list.yaml',
5958
];
6059

61-
public $reorderConfig = 'config_reorder.yaml';
6260
public $importExportConfig = 'config_import_export.yaml';
6361
public $relationConfig = 'config_relation.yaml';
6462
public $requiredPermissions = ['vdlp.redirect.access_redirects'];
@@ -302,7 +300,7 @@ public function listExtendQuery(Builder $query, $definition = null): void
302300
}
303301
}
304302

305-
public function formExtendFields(Form $host, array $fields = []): void
303+
public function formExtendFields(Form $host, ElementHolder|array $fields = []): void
306304
{
307305
$disableFields = [
308306
'from_url',
@@ -330,7 +328,7 @@ public function formExtendFields(Form $host, array $fields = []): void
330328
}
331329
}
332330

333-
public function formExtendRefreshFields(Form $host, array $fields): void
331+
public function formExtendRefreshFields(Form $host, ElementHolder|array $fields): void
334332
{
335333
/** @var Models\Redirect $model */
336334
$model = $host->model;

controllers/redirects/_list_toolbar.htm

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
</a>
1616
<?php endif; ?>
1717

18-
<a class="btn btn-default oc-icon-sort-amount-asc"
19-
href="<?= Backend::url('vdlp/redirect/redirects/reorder'); ?>">
20-
<?= e(trans('vdlp.redirect::lang.buttons.reorder_redirects')); ?>
21-
</a>
22-
2318
<div class="btn-group" id="checkBoxTriggeredButtons">
2419
<button class="btn btn-default oc-icon-trash-o"
2520
disabled=""

controllers/redirects/_reorder_toolbar.htm

Lines changed: 0 additions & 6 deletions
This file was deleted.

controllers/redirects/config_list.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ toolbar:
4444
prompt: backend::lang.list.search_prompt
4545

4646
filter: config_filter.yaml
47+
48+
structure:
49+
showTree: false
50+
showReorder: true
51+
dragRow: false

controllers/redirects/config_reorder.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)