From cc22d69b38fdf2b40954478813f957ce331cd80c Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 30 Jan 2024 12:15:50 +0100 Subject: [PATCH] Support TYPO3 v13.0.0 --- .build/.gitignore | 12 +-- .build/config/system/.gitignore | 1 - .build/packages/cache_status/composer.json | 2 +- .build/run-tests.sh | 3 +- .build/setup-typo3.sh | 19 ++-- .../{config/system => shared}/additional.php | 0 .build/{ => v12}/composer.json | 8 +- .build/v12/config/system/additional.php | 1 + .build/v13-dev/composer.json | 35 ++++++++ .build/v13-dev/config/system/additional.php | 1 + .build/v13/composer.json | 38 ++++++++ .build/v13/config/system/additional.php | 1 + .build/v13/patches/f5296972ae7-install.patch | 86 +++++++++++++++++++ .ddev/commands/web/clean-db | 3 + .ddev/config.yaml | 2 +- .github/workflows/tests.yml | 2 +- Classes/Hooks/PageLoadedFromCacheHook.php | 56 ++++++++++-- Classes/Hooks/RequestAwareTrait.php | 7 +- Classes/Hooks/SetPageCacheHook.php | 9 +- Configuration/Services.yaml | 3 + Makefile | 29 ++++--- composer.json | 6 +- ext_emconf.php | 2 +- ext_localconf.php | 7 +- 24 files changed, 283 insertions(+), 50 deletions(-) delete mode 100644 .build/config/system/.gitignore rename .build/{config/system => shared}/additional.php (100%) rename .build/{ => v12}/composer.json (73%) create mode 120000 .build/v12/config/system/additional.php create mode 100644 .build/v13-dev/composer.json create mode 120000 .build/v13-dev/config/system/additional.php create mode 100644 .build/v13/composer.json create mode 120000 .build/v13/config/system/additional.php create mode 100644 .build/v13/patches/f5296972ae7-install.patch create mode 100755 .ddev/commands/web/clean-db diff --git a/.build/.gitignore b/.build/.gitignore index c48e473..d57b864 100644 --- a/.build/.gitignore +++ b/.build/.gitignore @@ -1,6 +1,8 @@ -/composer.lock -/config/sites/ -/var -/public -/vendor +v*/composer.lock +v*/config/system/settings.php +v*/config/sites/ +v*/var +v*/public +v*/vendor /assert*.sh +/public diff --git a/.build/config/system/.gitignore b/.build/config/system/.gitignore deleted file mode 100644 index 9f37e35..0000000 --- a/.build/config/system/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/settings.php diff --git a/.build/packages/cache_status/composer.json b/.build/packages/cache_status/composer.json index a5927a1..a1c00c8 100644 --- a/.build/packages/cache_status/composer.json +++ b/.build/packages/cache_status/composer.json @@ -16,7 +16,7 @@ ], "license": "GPL-2.0+", "require": { - "typo3/cms-core": "^12.4.0" + "typo3/cms-core": "^12.4.0 || ~13.0.0 || dev-main" }, "autoload": { "psr-4": { diff --git a/.build/run-tests.sh b/.build/run-tests.sh index 95a2811..70c68a1 100755 --- a/.build/run-tests.sh +++ b/.build/run-tests.sh @@ -4,6 +4,7 @@ DIR=$(realpath $(dirname "$0")) ROOT=$(realpath "$DIR/..") HOST="${DDEV_PRIMARY_URL}" +PREFIX="${1:-v12}" make -C ${ROOT} .build/assert-1.1.sh @@ -12,7 +13,7 @@ source $DIR/assert.sh cookiefile=/tmp/nginx_cache-backend.cookie function clear_cache() { - $ROOT/.build/vendor/bin/typo3 cache:flush + $ROOT/.build/${PREFIX}/vendor/bin/typo3 cache:flush curl -X PURGE "${HOST}/*" } diff --git a/.build/setup-typo3.sh b/.build/setup-typo3.sh index f325713..a451b89 100755 --- a/.build/setup-typo3.sh +++ b/.build/setup-typo3.sh @@ -2,14 +2,20 @@ set -ve -rm -rf \ - .build/config/sites/ \ - .build/config/system/settings.php \ - .build/composer.lock \ - .build/public/ \ - .build/vendor/ +prefix=${1} cd .build/ +ln -snf ${1}/public public + +cd ${prefix} + +rm -rf \ + config/sites/ \ + config/system/settings.php \ + composer.lock \ + public/ \ + vendor/ + composer install TYPO3_DB_USERNAME=db \ @@ -18,6 +24,7 @@ TYPO3_DB_HOST=db \ TYPO3_DB_DBNAME=db \ TYPO3_DB_PASSWORD=db \ TYPO3_DB_DRIVER=mysqli \ +TYPO3_SERVER_TYPE=other \ TYPO3_SETUP_ADMIN_EMAIL=admin@example.com \ TYPO3_SETUP_ADMIN_USERNAME=admin \ TYPO3_SETUP_ADMIN_PASSWORD='Pa$$w0rd' \ diff --git a/.build/config/system/additional.php b/.build/shared/additional.php similarity index 100% rename from .build/config/system/additional.php rename to .build/shared/additional.php diff --git a/.build/composer.json b/.build/v12/composer.json similarity index 73% rename from .build/composer.json rename to .build/v12/composer.json index 328992f..6b47a90 100644 --- a/.build/composer.json +++ b/.build/v12/composer.json @@ -3,19 +3,19 @@ "repositories": [ { "type": "path", - "url": "../" + "url": "../../" }, { "type": "path", - "url": "./packages/*/" + "url": "../packages/*/" } ], "license": "GPL-2.0+", "require": { "bnf/cache-status": "@dev", "bnf/nginx-cache": "@dev", - "typo3/cms-adminpanel": "^12.4.0 || dev-main", - "typo3/minimal": "^12.4.0 || dev-main" + "typo3/cms-adminpanel": "^12.4", + "typo3/minimal": "^12.4" }, "config": { "allow-plugins": { diff --git a/.build/v12/config/system/additional.php b/.build/v12/config/system/additional.php new file mode 120000 index 0000000..b63b141 --- /dev/null +++ b/.build/v12/config/system/additional.php @@ -0,0 +1 @@ +../../../shared/additional.php \ No newline at end of file diff --git a/.build/v13-dev/composer.json b/.build/v13-dev/composer.json new file mode 100644 index 0000000..9a34290 --- /dev/null +++ b/.build/v13-dev/composer.json @@ -0,0 +1,35 @@ +{ + "name": "bnf/nginx-cache-test-site", + "repositories": [ + { + "type": "path", + "url": "../../" + }, + { + "type": "path", + "url": "../packages/*/" + } + ], + "license": "GPL-2.0+", + "require": { + "bnf/cache-status": "@dev", + "bnf/nginx-cache": "@dev", + "cweagans/composer-patches": "^1.7", + "doctrine/dbal": "4.0.0-RC2@rc", + "typo3/cms-adminpanel": "13.1.x-dev as 13.0.0", + "typo3/cms-backend": "13.1.x-dev as 13.0.0", + "typo3/cms-core": "13.1.x-dev as 13.0.0", + "typo3/cms-extbase": "13.1.x-dev as 13.0.0", + "typo3/cms-filelist": "13.1.x-dev as 13.0.0", + "typo3/cms-fluid": "13.1.x-dev as 13.0.0", + "typo3/cms-frontend": "13.1.x-dev as 13.0.0", + "typo3/cms-install": "13.1.x-dev as 13.0.0" + }, + "config": { + "allow-plugins": { + "typo3/class-alias-loader": true, + "typo3/cms-composer-installers": true, + "cweagans/composer-patches": false + } + } +} diff --git a/.build/v13-dev/config/system/additional.php b/.build/v13-dev/config/system/additional.php new file mode 120000 index 0000000..b63b141 --- /dev/null +++ b/.build/v13-dev/config/system/additional.php @@ -0,0 +1 @@ +../../../shared/additional.php \ No newline at end of file diff --git a/.build/v13/composer.json b/.build/v13/composer.json new file mode 100644 index 0000000..1435144 --- /dev/null +++ b/.build/v13/composer.json @@ -0,0 +1,38 @@ +{ + "name": "bnf/nginx-cache-test-site", + "repositories": [ + { + "type": "path", + "url": "../../" + }, + { + "type": "path", + "url": "../packages/*/" + } + ], + "license": "GPL-2.0+", + "require": { + "bnf/cache-status": "@dev", + "bnf/nginx-cache": "@dev", + "cweagans/composer-patches": "^1.7", + "doctrine/dbal": "4.0.0-RC2@rc", + "typo3/cms-adminpanel": "~13.0.0", + "typo3/cms-install": "~13.0.0", + "typo3/minimal": "~13.0.0" + }, + "extra": { + "composer-exit-on-patch-failure": true, + "patches": { + "typo3/cms-install": { + "[BUGFIX] Cast database port to int in setup command": "patches/f5296972ae7-install.patch" + } + } + }, + "config": { + "allow-plugins": { + "typo3/class-alias-loader": true, + "typo3/cms-composer-installers": true, + "cweagans/composer-patches": true + } + } +} diff --git a/.build/v13/config/system/additional.php b/.build/v13/config/system/additional.php new file mode 120000 index 0000000..b63b141 --- /dev/null +++ b/.build/v13/config/system/additional.php @@ -0,0 +1 @@ +../../../shared/additional.php \ No newline at end of file diff --git a/.build/v13/patches/f5296972ae7-install.patch b/.build/v13/patches/f5296972ae7-install.patch new file mode 100644 index 0000000..037c992 --- /dev/null +++ b/.build/v13/patches/f5296972ae7-install.patch @@ -0,0 +1,86 @@ +diff --git a/Classes/Command/SetupCommand.php b/Classes/Command/SetupCommand.php +index a52afe5c1fb..aaec25928d3 100644 +--- a/Classes/Command/SetupCommand.php ++++ b/Classes/Command/SetupCommand.php +@@ -432,7 +432,6 @@ EOT + $default = $this->getDefinition()->getOption($key)->getDefault(); + $defaultLabel = empty($value) ? '' : ' [default: ' . $default . ']'; + $question = new Question('Enter the database "' . $key . '"' . $defaultLabel . ' ? ', $default); +- + if ($key === 'password') { + $question = new Question('Enter the database "' . $key . '" ? ', $default); + $question->setHidden(true); +@@ -445,19 +444,18 @@ EOT + 1669747572 + ); + } +- + return $host; + }; + $question->setValidator($hostValidator); + } elseif ($key === 'port') { + $portValidator = function ($port) { +- if (!$this->setupDatabaseService->isValidDbPort((int)$port)) { ++ $port = (int)$port; ++ if (!$this->setupDatabaseService->isValidDbPort($port)) { + throw new \RuntimeException( + 'Please use a port in the range between 1 and 65535.', + 1669747592, + ); + } +- + return $port; + }; + $question->setValidator($portValidator); +@@ -469,12 +467,10 @@ EOT + 1669747601, + ); + } +- + return $value; + }; + $question->setValidator($emptyValidator); + } +- + if ($envValue === false && $key === 'password') { + // Force this question if no `TYPO3_DB_PASSWORD` set via cli. + // Thus, the user will always be prompted for a password even --no-interaction is set. +@@ -491,7 +487,6 @@ EOT + $envValue = $envValue ?: $default; + $value = $validator ? $validator($envValue) : $envValue; + } +- + $databaseConnectionOptions[$key] = $value; + } + } +diff --git a/Classes/Service/SetupDatabaseService.php b/Classes/Service/SetupDatabaseService.php +index 11714d955ce..85ebd65ffff 100644 +--- a/Classes/Service/SetupDatabaseService.php ++++ b/Classes/Service/SetupDatabaseService.php +@@ -597,7 +597,7 @@ class SetupDatabaseService + 'driver' => 'mysqli', + 'username' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['user'] ?? '', + 'password' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['password'] ?? '', +- 'port' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['port'] ?? 3306, ++ 'port' => (int)($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['port'] ?? 3306), + 'database' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['dbname'] ?? '', + ]; + $host = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['host'] ?? '127.0.0.1'; +@@ -629,7 +629,7 @@ class SetupDatabaseService + 'driver' => 'pdo_mysql', + 'username' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['user'] ?? '', + 'password' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['password'] ?? '', +- 'port' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['port'] ?? 3306, ++ 'port' => (int)($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['port'] ?? 3306), + 'database' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['dbname'] ?? '', + ]; + $host = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['host'] ?? '127.0.0.1'; +@@ -666,7 +666,7 @@ class SetupDatabaseService + 'username' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['user'] ?? '', + 'password' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['password'] ?? '', + 'host' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['host'] ?? '127.0.0.1', +- 'port' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['port'] ?? 5432, ++ 'port' => (int)($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['port'] ?? 5432), + 'database' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['dbname'] ?? '', + ]; + if (($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['driver'] ?? '') === 'pdo_pgsql') { diff --git a/.ddev/commands/web/clean-db b/.ddev/commands/web/clean-db new file mode 100755 index 0000000..a7ec909 --- /dev/null +++ b/.ddev/commands/web/clean-db @@ -0,0 +1,3 @@ +#!/bin/sh +mysql -Bs --execute='drop database if exists db' '' +mysql -Bs --execute='create database db' '' diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 23e5cdb..9c328a6 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -1,7 +1,7 @@ name: nginx-cache type: typo3 docroot: .build/public -php_version: "8.1" +php_version: "8.2" webserver_type: nginx-fpm router_http_port: "80" router_https_port: "443" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3dbc55b..34632d9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,4 +6,4 @@ jobs: steps: - uses: actions/checkout@v1 - uses: ddev/github-action-setup-ddev@v1 - - run: make ddev-12 + - run: make check diff --git a/Classes/Hooks/PageLoadedFromCacheHook.php b/Classes/Hooks/PageLoadedFromCacheHook.php index 40a2b80..d900534 100644 --- a/Classes/Hooks/PageLoadedFromCacheHook.php +++ b/Classes/Hooks/PageLoadedFromCacheHook.php @@ -23,9 +23,9 @@ use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Frontend\Event\AfterTypoScriptDeterminedEvent; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; - class PageLoadedFromCacheHook { use RequestAwareTrait; @@ -37,12 +37,56 @@ public function __construct(FrontendInterface $nginxCache) $this->nginxCache = $nginxCache; } + /** + * v13.0 event + */ + public function handleEvent(AfterTypoScriptDeterminedEvent $event): void + { + $tsfe = $this->getTypoScriptFrontendController(); + // @todo $tsfe->pageContentWasLoadedFromCache is protected and $tsfe->isGeneratePage() is internal + if ($tsfe->isGeneratePage()) { + return; + } + + $pageCacheTags = $tsfe->getPageCacheTags(); + if (!in_array('nginx-cache-later-cacheable', $pageCacheTags, true)) { + return; + } + + $request = $this->getServerRequest(); + $uri = $this->getUri($request); + + $context = GeneralUtility::makeInstance(Context::class); + + $frontendTypoScript = $event->getFrontendTypoScript(); + $cachable = ( + $tsfe->isStaticCacheble($request) && + $context->getPropertyFromAspect('workspace', 'isOffline', false) === false && + strpos($uri, '?') === false && + $this->isAdminPanelVisible($frontendTypoScript) === false && + $this->isFrontendEditingActive($tsfe) === false && + $request->getMethod() === 'GET' + ); + + if (!$cachable) { + return; + } + + // @todo This is ugly because $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache'] was removed in v13 without replacement, + // and TSFE does not provide public access to current cache expiry timestamp + $cacheExpires = \Closure::bind(static fn() => $tsfe->cacheExpires, null, TypoScriptFrontendController::class); + $lifetime = $cacheExpires()- $context->getPropertyFromAspect('date', 'timestamp'); + $this->nginxCache->set(md5($uri), $uri, $pageCacheTags, $lifetime); + } + + /** + * v12 hook + */ public function loadedFromCache(array &$params, TypoScriptFrontendController $tsfe): void { $row = $params['cache_pages_row'] ?? []; - - $nginxCacheTags = $row['tx_nginx_cache_tags'] ?? null; - if ($nginxCacheTags === null) { + $pageCacheTags = $row['cacheTags'] ?? []; + if (!in_array('nginx-cache-later-cacheable', $pageCacheTags, true)) { return; } @@ -55,7 +99,7 @@ public function loadedFromCache(array &$params, TypoScriptFrontendController $ts $context = GeneralUtility::makeInstance(Context::class); $cachable = ( - $tsfe->isStaticCacheble($request) && + $tsfe->isStaticCacheble() && $context->getPropertyFromAspect('workspace', 'isOffline', false) === false && strpos($uri, '?') === false && $this->isAdminPanelVisible() === false && @@ -68,6 +112,6 @@ public function loadedFromCache(array &$params, TypoScriptFrontendController $ts } $lifetime = $row['expires'] - $context->getPropertyFromAspect('date', 'timestamp'); - $this->nginxCache->set(md5($uri), $uri, $nginxCacheTags, $lifetime); + $this->nginxCache->set(md5($uri), $uri, $pageCacheTags, $lifetime); } } diff --git a/Classes/Hooks/RequestAwareTrait.php b/Classes/Hooks/RequestAwareTrait.php index a06714c..7cda1e4 100644 --- a/Classes/Hooks/RequestAwareTrait.php +++ b/Classes/Hooks/RequestAwareTrait.php @@ -21,7 +21,9 @@ use TYPO3\CMS\Adminpanel\Utility\StateUtility; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequestFactory; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; +use TYPO3\CMS\Core\TypoScript\FrontendTypoScript; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; trait RequestAwareTrait @@ -40,12 +42,13 @@ protected function getTypoScriptFrontendController(): ?TypoScriptFrontendControl return $request->getAttribute('frontend.controller', $GLOBALS['TSFE'] ?? null); } - protected function isAdminPanelVisible(): bool + protected function isAdminPanelVisible(?FrontendTypoScript $frontendTypoScript = null): bool { + $frontendTypoScript ??= $this->getServerRequest()->getAttribute('frontend.typoscript'); return ( ExtensionManagementUtility::isLoaded('adminpanel') && StateUtility::isActivatedForUser() && - StateUtility::isActivatedInTypoScript() && + ((new Typo3Version())->getMajorVersion() <= 12 ? StateUtility::isActivatedInTypoScript() : ($frontendTypoScript->getConfigArray()['admPanel'] ?? false)) && StateUtility::isHiddenForUser() == false ); } diff --git a/Classes/Hooks/SetPageCacheHook.php b/Classes/Hooks/SetPageCacheHook.php index f2c3885..74c70e8 100644 --- a/Classes/Hooks/SetPageCacheHook.php +++ b/Classes/Hooks/SetPageCacheHook.php @@ -90,13 +90,12 @@ public function set(array $params, FrontendInterface $frontend): void } if ($isLaterCachable) { - /* We store these values here, in case we ever loose the cache in nginx. + /* We store this marker here, in case we ever loose the cache in nginx. * In that case TYPO3 is requested and retrieves the cached content from cache_pages. - * For that case we install a PageLoadedFromCache Hook, that uses these data - * to decide a) whether data should be cached and b) which tags have to be assigned. - * (As the tags are not available in that hook) + * For that case we install a PageLoadedFromCache hook(v12)/event(13.0), that uses these data + * to decide a) whether data should be cached */ - $params['variable']['tx_nginx_cache_tags'] = $tags; + $params['variable']['cacheTags'][] = 'nginx-cache-later-cacheable'; } } } diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index ef382e9..12931e4 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -18,5 +18,8 @@ services: Bnf\NginxCache\Hooks\PageLoadedFromCacheHook: public: true + tags: + - name: event.listener + method: handleEvent arguments: $nginxCache: '@cache.nginx' diff --git a/Makefile b/Makefile index 65aff15..14c33da 100644 --- a/Makefile +++ b/Makefile @@ -5,20 +5,27 @@ EXTKEY = $(notdir $(shell pwd)) ln -snf assert-1.1.sh .build/assert.sh check: - $(MAKE) ddev-12 - - -ddev-12: .build/assert-1.1.sh ddev stop --remove-data --omit-snapshot ddev start - ddev exec .build/setup-typo3.sh typo3/cms-core:^12.4.0 - ddev exec .build/run-tests.sh + $(MAKE) check-12 + ddev restart + $(MAKE) check-13 -ddev-main: .build/assert-1.1.sh - ddev stop --remove-data --omit-snapshot - ddev start - ddev exec .build/setup-typo3.sh typo3/cms-core:dev-main@dev typo3/cms-frontend:dev-main@dev typo3/cms-backend:dev-main@dev - ddev exec .build/run-tests.sh + +check-12: .build/assert-1.1.sh + ddev clean-db + ddev exec .build/setup-typo3.sh v12 + ddev exec .build/run-tests.sh v12 + +check-13: .build/assert-1.1.sh + ddev clean-db + ddev exec .build/setup-typo3.sh v13 + ddev exec .build/run-tests.sh v13 + +check-main: .build/assert-1.1.sh + ddev clean-db + ddev exec .build/setup-typo3.sh v13-dev + ddev exec .build/run-tests.sh v13-dev t3x-pack: git archive --worktree-attributes -o $(EXTKEY)_`git describe --always --tags`.zip HEAD diff --git a/composer.json b/composer.json index 544a95e..6e56c0b 100644 --- a/composer.json +++ b/composer.json @@ -17,9 +17,9 @@ ], "license": "GPL-2.0+", "require": { - "typo3/cms-core": "^12.4.0", - "typo3/cms-frontend": "^12.4.0", - "typo3/cms-backend": "^12.4.0" + "typo3/cms-core": "^12.4.0 || ~13.0.0", + "typo3/cms-frontend": "^12.4.0 || ~13.0.0", + "typo3/cms-backend": "^12.4.0 || ~13.0.0" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index c3ddffe..094f7e4 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -9,7 +9,7 @@ 'version' => '3.0.0', 'constraints' => [ 'depends' => [ - 'typo3' => '12.4.0-12.4.99', + 'typo3' => '12.4.0-13.0.99', ], 'conflicts' => [ ], diff --git a/ext_localconf.php b/ext_localconf.php index 08f237b..44ae2bf 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -6,6 +6,7 @@ use Bnf\NginxCache\Hooks\PageLoadedFromCacheHook; use Bnf\NginxCache\Hooks\SetPageCacheHook; use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend; +use TYPO3\CMS\Core\Information\Typo3Version; $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['nginx'] = [ 'frontend' => VariableFrontend::class, @@ -19,5 +20,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_cache_frontend_variablefrontend.php']['set']['nginx_cache'] = SetPageCacheHook::class . '->set'; -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache']['nginx_cache'] = - PageLoadedFromCacheHook::class . '->loadedFromCache'; +if ((new Typo3Version())->getMajorVersion() <= 12) { + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache']['nginx_cache'] = + PageLoadedFromCacheHook::class . '->loadedFromCache'; +}