From 1b470d53caa7bfdcbef03130c1746da38cf43cf2 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Fri, 2 Feb 2024 13:30:15 +0100 Subject: [PATCH] Update bundle for Contao 5 --- .editorconfig | 4 ++- .github/workflows/ci.yml | 29 ++++++++++++++++ .gitignore | 4 +-- LICENSE | 2 +- composer.json | 13 +++----- contao/dca/tl_page.php | 33 ++++++------------- ecs.php | 3 -- .../RequireAuthenticationListener.php | 17 ++++------ 8 files changed, 55 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 ecs.php diff --git a/.editorconfig b/.editorconfig index 6db78d6..029a3ab 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,4 +16,6 @@ indent_size = 4 [*.html5] indent_style = space indent_size = 2 -insert_final_newline = false + +[*.md] +trim_trailing_whitespace = false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fc89221 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: ~ + pull_request: ~ + +permissions: read-all + +jobs: + ecs: + name: build-tools + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.1 + extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib + coverage: none + + - name: Checkout + uses: actions/checkout@v3 + + - name: Install the dependencies + run: | + composer install --no-interaction --no-progress + + - name: Run all build-tools to validate code + run: composer run build-tools diff --git a/.gitignore b/.gitignore index 3a9875b..de4a392 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/vendor/ -composer.lock +/vendor +/composer.lock diff --git a/LICENSE b/LICENSE index 5356e24..d6aacdb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020 terminal42 gmbh +Copyright (c) 2024 terminal42 gmbh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/composer.json b/composer.json index 2c1e958..c9c9729 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "authors": [ { "name": "terminal42 gmbh", - "homepage": "http://www.terminal42.ch" + "homepage": "https://www.terminal42.ch" } ], "funding": [ @@ -26,12 +26,12 @@ "forum": "https://community.contao.org" }, "require": { - "php": "^7.4 || ^8.0", - "contao/core-bundle": "^4.9" + "php": "^8.1", + "contao/core-bundle": "^4.13 || ^5.0" }, "require-dev": { "contao/manager-plugin": "^2.0", - "contao/easy-coding-standard": "^3.0" + "terminal42/contao-build-tools": "dev-main" }, "conflict": { "contao/manager-plugin": "<2.0 || >=3.0" @@ -43,10 +43,5 @@ }, "extra": { "contao-manager-plugin": "Terminal42\\RootProtectionBundle\\ContaoManager\\Plugin" - }, - "scripts": { - "cs-fixer": [ - "vendor/bin/ecs check src/ --fix --ansi" - ] } } diff --git a/contao/dca/tl_page.php b/contao/dca/tl_page.php index 1b45628..1d3572d 100644 --- a/contao/dca/tl_page.php +++ b/contao/dca/tl_page.php @@ -4,7 +4,7 @@ use Contao\CoreBundle\DataContainer\PaletteManipulator; -$paletteManipulator = PaletteManipulator::create() +PaletteManipulator::create() ->addLegend('rootProtection_legend', 'publish_legend', PaletteManipulator::POSITION_BEFORE) ->addField('rootProtection', 'rootProtection_legend', PaletteManipulator::POSITION_APPEND) ->applyToPalette('root', 'tl_page') @@ -12,38 +12,25 @@ ; $GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'rootProtection'; - $GLOBALS['TL_DCA']['tl_page']['subpalettes']['rootProtection'] = 'rootProtectionUsername,rootProtectionPassword'; $GLOBALS['TL_DCA']['tl_page']['fields']['rootProtection'] = [ - 'label' => &$GLOBALS['TL_LANG']['tl_page']['rootProtection'], - 'exclude' => true, + 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => [ - 'tl_class' => 'w50', - 'submitOnChange' => true, - ], - 'sql' => "char(1) NOT NULL default ''", + 'eval' => ['tl_class' => 'w50', 'submitOnChange' => true], + 'sql' => "char(1) NOT NULL default ''", ]; $GLOBALS['TL_DCA']['tl_page']['fields']['rootProtectionUsername'] = [ - 'label' => &$GLOBALS['TL_LANG']['tl_page']['rootProtectionUsername'], - 'exclude' => true, + 'exclude' => true, 'inputType' => 'text', - 'eval' => [ - 'tl_class' => 'clr w50', - 'mandatory' => true, - ], - 'sql' => "varchar(255) NOT NULL default ''", + 'eval' => ['tl_class' => 'clr w50', 'mandatory' => true], + 'sql' => "varchar(255) NOT NULL default ''", ]; $GLOBALS['TL_DCA']['tl_page']['fields']['rootProtectionPassword'] = [ - 'label' => &$GLOBALS['TL_LANG']['tl_page']['rootProtectionPassword'], - 'exclude' => true, + 'exclude' => true, 'inputType' => 'text', - 'eval' => [ - 'tl_class' => 'w50', - 'mandatory' => true, - ], - 'sql' => "varchar(255) NOT NULL default ''", + 'eval' => ['tl_class' => 'w50', 'mandatory' => true], + 'sql' => "varchar(255) NOT NULL default ''", ]; diff --git a/ecs.php b/ecs.php deleted file mode 100644 index 9afc61d..0000000 --- a/ecs.php +++ /dev/null @@ -1,3 +0,0 @@ -framework = $framework; - $this->requestStack = $requestStack; + public function __construct( + private readonly ContaoFramework $framework, + private readonly RequestStack $requestStack, + ) { } public function __invoke(PageModel $page): void