Skip to content

Commit bc3914a

Browse files
committed
[BUGFIX] BE-Module v13
* do not call registerModule for v13 * prevent empty configuration exception * add v13 to ci workflow * get rid of runTest.sh
1 parent 90f3227 commit bc3914a

File tree

15 files changed

+190
-30
lines changed

15 files changed

+190
-30
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,42 @@ jobs:
1515
matrix:
1616
php: [ '8.1', '8.2']
1717
TYPO3: ['11', '12' ]
18+
include:
19+
- TYPO3: '13'
20+
php: '8.3'
1821
steps:
1922
- name: Checkout
20-
uses: actions/checkout@v2
21-
22-
- name: Install testing system
23-
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s composerInstall
23+
uses: actions/checkout@v4
2424

25+
- name: Set up PHP Version
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
tools: composer:v2
2530
- name: Composer validate
26-
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerValidate
27-
28-
- name: Lint PHP
29-
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lint
30-
31-
- name: CGL
32-
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s cgl -n
31+
run: composer validate
32+
- name: Install composer dependencies TYPO3 13
33+
if: matrix.TYPO3 == '13'
34+
run: |
35+
composer install --no-progress --no-interaction
36+
37+
- name: Install composer dependencies TYPO3 12
38+
if: matrix.TYPO3 == '12'
39+
run: |
40+
composer require typo3/cms-core:^12.4 --no-progress --no-interaction --dev -W
41+
- name: Install composer dependencies TYPO3 11
42+
if: matrix.TYPO3 == '11'
43+
run: |
44+
composer require typo3/cms-core:^11.5 --no-progress --no-interaction --dev -W
45+
- name: Phpstan 11
46+
if: matrix.TYPO3 == '11'
47+
run: .Build/bin/phpstan analyze -c Build/phpstan11.neon
48+
- name: Phpstan 12
49+
if: matrix.TYPO3 == '12'
50+
run: .Build/bin/phpstan analyze -c Build/phpstan12.neon
51+
- name: Phpstan 13
52+
if: matrix.TYPO3 == '13'
53+
run: .Build/bin/phpstan analyze -c Build/phpstan13.neon
54+
- name: Phpcsfix
55+
run: .Build/bin/php-cs-fixer fix --config=Build/php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no
3356

34-
- name: phpstan
35-
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s phpstan

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
publish:
99
name: Publish new version to TER
1010
if: startsWith(github.ref, 'refs/tags/')
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
1212
env:
1313
TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }}
1414

1515
steps:
1616
- name: Checkout repository
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1818

1919
- name: Check tag
2020
run: |
@@ -37,7 +37,7 @@ jobs:
3737
- name: Setup PHP
3838
uses: shivammathur/setup-php@v2
3939
with:
40-
php-version: 7.4
40+
php-version: 8.3
4141
extensions: intl, mbstring, json, zip, curl
4242

4343
- name: Install tailor

Build/phpstan-baseline-11.neon

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Access to constant ERROR on an unknown class TYPO3\\\\CMS\\\\Core\\\\Type\\\\ContextualFeedbackSeverity\\.$#"
5+
count: 1
6+
path: ../Classes/Controller/ManagementController.php
7+
8+
-
9+
message: "#^Access to constant OK on an unknown class TYPO3\\\\CMS\\\\Core\\\\Type\\\\ContextualFeedbackSeverity\\.$#"
10+
count: 2
11+
path: ../Classes/Controller/ManagementController.php
12+
13+
-
14+
message: "#^Access to constant WARNING on an unknown class TYPO3\\\\CMS\\\\Core\\\\Type\\\\ContextualFeedbackSeverity\\.$#"
15+
count: 1
16+
path: ../Classes/Controller/ManagementController.php
17+
18+
-
19+
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplate\\:\\:renderResponse\\(\\)\\.$#"
20+
count: 1
21+
path: ../Classes/Controller/ManagementController.php
22+
23+
-
24+
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Extbase\\\\Mvc\\\\View\\\\ViewInterface\\:\\:setTemplateRootPaths\\(\\)\\.$#"
25+
count: 1
26+
path: ../Classes/Controller/ManagementController.php

Build/phpstan-baseline-12.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Call to an undefined method TYPO3Fluid\\\\Fluid\\\\View\\\\ViewInterface\\:\\:setTemplateRootPaths\\(\\)\\.$#"
5+
count: 1
6+
path: ../Classes/Controller/ManagementController.php

Build/phpstan-baseline-13.neon

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Access to undefined constant TYPO3\\\\CMS\\\\Core\\\\Messaging\\\\AbstractMessage\\:\\:ERROR\\.$#"
5+
count: 1
6+
path: ../Classes/Controller/ManagementController.php
7+
8+
-
9+
message: "#^Access to undefined constant TYPO3\\\\CMS\\\\Core\\\\Messaging\\\\AbstractMessage\\:\\:OK\\.$#"
10+
count: 2
11+
path: ../Classes/Controller/ManagementController.php
12+
13+
-
14+
message: "#^Access to undefined constant TYPO3\\\\CMS\\\\Core\\\\Messaging\\\\AbstractMessage\\:\\:WARNING\\.$#"
15+
count: 2
16+
path: ../Classes/Controller/ManagementController.php
17+
18+
-
19+
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplate\\:\\:renderContent\\(\\)\\.$#"
20+
count: 1
21+
path: ../Classes/Controller/ManagementController.php
22+
23+
-
24+
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Backend\\\\Template\\\\ModuleTemplate\\:\\:setContent\\(\\)\\.$#"
25+
count: 1
26+
path: ../Classes/Controller/ManagementController.php
27+
28+
-
29+
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewInterface\\|TYPO3Fluid\\\\Fluid\\\\View\\\\ViewInterface\\:\\:setTemplateRootPaths\\(\\)\\.$#"
30+
count: 1
31+
path: ../Classes/Controller/ManagementController.php

Build/phpstan11.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
includes:
2+
- phpstan-baseline-11.neon
13
parameters:
24
level: 5
35

Build/phpstan12.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
includes:
2+
- phpstan-baseline-12.neon
13
parameters:
24
level: 5
35

Build/phpstan13.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
includes:
2+
- phpstan-baseline-13.neon
3+
parameters:
4+
level: 5
5+
6+
paths:
7+
- %currentWorkingDirectory%/Classes
8+
9+
ignoreErrors:
10+

Build/testing-docker/docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ services:
8383
fi
8484
php -v | grep '^PHP';
8585
if [ ${TYPO3} -eq 11 ]; then
86-
composer install --no-progress --no-interaction;
86+
composer require typo3/cms-frontend:^11.5 typo3/cms-backend:^11.5 --dev -W --no-progress --no-interaction
87+
elif [ ${TYPO3} -eq 12 ]; then
88+
composer require typo3/cms-frontend:^12.4 typo3/cms-backend:^12.4 --dev -W --no-progress --no-interaction
8789
else
88-
composer remove typo3/cms* --dev --no-progress --no-interaction && composer require typo3/cms-frontend:^12.4 typo3/cms-backend:^12.4 --dev -W --no-progress --no-interaction
90+
composer require typo3/cms-frontend:^13.4 typo3/cms-backend:^13.4 --dev -W --no-progress --no-interaction
8991
fi
9092
"
9193

Classes/Controller/ManagementController.php

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
2424
use TYPO3\CMS\Core\Cache\CacheManager;
2525
use TYPO3\CMS\Core\Http\RedirectResponse;
26+
use TYPO3\CMS\Core\Information\Typo3Version;
2627
use TYPO3\CMS\Core\Messaging\AbstractMessage;
27-
use TYPO3\CMS\Core\Messaging\FlashMessage;
28+
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
2829
use TYPO3\CMS\Core\Utility\GeneralUtility;
2930
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
3031

@@ -40,8 +41,14 @@ public function __construct(protected ModuleTemplateFactory $moduleTemplateFacto
4041
public function indexAction(): ResponseInterface
4142
{
4243
$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
43-
$moduleTemplate->setContent($this->view->render());
44-
return $this->htmlResponse($moduleTemplate->renderContent());
44+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 11) {
45+
$this->view->setTemplateRootPaths(['EXT:proxycachemanager/Resources/Private/TemplatesV11/']);
46+
$moduleTemplate->setContent($this->view->render());
47+
$response = $this->htmlResponse($moduleTemplate->renderContent());
48+
} else {
49+
$response = $moduleTemplate->renderResponse('Management/Index');
50+
}
51+
return $response;
4552
}
4653

4754
/**
@@ -50,10 +57,15 @@ public function indexAction(): ResponseInterface
5057
public function clearTagAction(string $tag): ResponseInterface
5158
{
5259
GeneralUtility::makeInstance(CacheManager::class)->flushCachesByTags([htmlspecialchars($tag)]);
60+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 11) {
61+
$severity = AbstractMessage::OK;
62+
} else {
63+
$severity = ContextualFeedbackSeverity::OK;
64+
}
5365
$this->addFlashMessage(
5466
'Successfully purged cache tag "' . htmlspecialchars($tag) . '".',
5567
'Cache flushed',
56-
AbstractMessage::OK
68+
$severity
5769
);
5870
return new RedirectResponse($this->uriBuilder->reset()->uriFor('index'));
5971
}
@@ -64,6 +76,11 @@ public function clearTagAction(string $tag): ResponseInterface
6476
public function purgeUrlAction(string $url): ResponseInterface
6577
{
6678
if (empty($url)) {
79+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 11) {
80+
$severity = AbstractMessage::WARNING;
81+
} else {
82+
$severity = ContextualFeedbackSeverity::WARNING;
83+
}
6784
$this->addFlashMessage(
6885
'Please specify url',
6986
'Cache not flushed',
@@ -73,19 +90,29 @@ public function purgeUrlAction(string $url): ResponseInterface
7390
}
7491
$url = htmlspecialchars($url);
7592
if (!$this->proxyProvider->isActive()) {
93+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 11) {
94+
$severity = AbstractMessage::ERROR;
95+
} else {
96+
$severity = ContextualFeedbackSeverity::ERROR;
97+
}
7698
$this->addFlashMessage(
7799
'Attempting to purge URL "' . $url . '". No active provider configured.',
78100
'Cache not flushed',
79-
AbstractMessage::ERROR
101+
$severity
80102
);
81103
return new RedirectResponse($this->uriBuilder->reset()->uriFor('index'));
82104
}
83105

84106
$this->proxyProvider->flushCacheForUrls([$url]);
107+
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 11) {
108+
$severity = AbstractMessage::OK;
109+
} else {
110+
$severity = ContextualFeedbackSeverity::OK;
111+
}
85112
$this->addFlashMessage(
86113
'Successfully purged URL "' . $url . '".',
87114
'Cache flushed',
88-
FlashMessage::OK
115+
$severity
89116
);
90117
return new RedirectResponse($this->uriBuilder->reset()->uriFor('index'));
91118
}

0 commit comments

Comments
 (0)