From 7e04bb2b25ad511218ca616a4ce0e8faa43afdcc Mon Sep 17 00:00:00 2001 From: Jochen Date: Tue, 14 Jan 2025 14:41:39 +0100 Subject: [PATCH 1/4] Add v13 compatability --- .github/workflows/test.yaml | 4 +- Build/Scripts/runTests.sh | 13 +--- Build/testing-docker/docker-compose.yml | 1 - .../Backend/Controller/Ajax/JobController.php | 10 ++-- .../ToolbarItems/JobStatusToolbarItem.php | 2 +- Classes/Command/StatusReportCommand.php | 2 +- Classes/Domain/Model/Job.php | 14 ++--- Classes/Domain/Model/StatusReport.php | 2 +- Classes/Domain/Repository/JobRepository.php | 33 ++++++----- Configuration/JavaScriptModules.php | 7 +++ Resources/Public/Icons/ConfigurationCheck.svg | 3 +- Resources/Public/Icons/ContentSync.svg | 5 +- .../Public/Icons/SynchronisationHistory.svg | 3 +- Resources/Public/JavaScript/ContentSync.js | 59 ------------------- Resources/Public/JavaScript/content-sync.js | 54 +++++++++++++++++ composer.json | 6 +- ext_localconf.php | 4 -- 17 files changed, 104 insertions(+), 118 deletions(-) create mode 100644 Configuration/JavaScriptModules.php delete mode 100644 Resources/Public/JavaScript/ContentSync.js create mode 100644 Resources/Public/JavaScript/content-sync.js diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index aca147d..daff52e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,8 +13,8 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - php: [ '8.1'] - TYPO3: [ '12' ] + php: [ '8.2'] + TYPO3: [ '12', '13' ] steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index bc2c71e..c7f00ba 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -69,7 +69,7 @@ Options: - postgres: use postgres - sqlite: use sqlite - -p <8.0|8.1> + -p <8.0|8.1|8.2|8.3> Specifies the PHP minor version to be used - 8.0 (default): use PHP 8.0 @@ -122,13 +122,6 @@ fi # docker-compose v2 is enabled by docker for mac as experimental feature without # asking the user. v2 is currently broken. Detect the version and error out. -DOCKER_COMPOSE_VERSION=$(docker-compose version --short) -DOCKER_COMPOSE_MAJOR=$(echo "$DOCKER_COMPOSE_VERSION" | cut -d'.' -f1 | tr -d 'v') -if [ "$DOCKER_COMPOSE_MAJOR" -gt "1" ]; then - echo "docker-compose $DOCKER_COMPOSE_VERSION is currently broken and not supported by runTests.sh." - echo "If you are running Docker Desktop for MacOS/Windows disable 'Use Docker Compose V2 release candidate' (Settings > Experimental Features)" - exit 1 -fi # Go to the directory this script is located, so everything else is relative # to this dir, no matter from where this script is called. @@ -149,7 +142,7 @@ fi # Option defaults TEST_SUITE="unit" DBMS="mariadb" -PHP_VERSION="8.0" +PHP_VERSION="8.2" PHP_XDEBUG_ON=0 PHP_XDEBUG_PORT=9003 EXTRA_TEST_OPTIONS="" @@ -173,7 +166,7 @@ while getopts ":s:d:p:e:t:xy:nhuv" OPT; do ;; p) PHP_VERSION=${OPTARG} - if ! [[ ${PHP_VERSION} =~ ^(8.0|8.1)$ ]]; then + if ! [[ ${PHP_VERSION} =~ ^(8.0|8.1|8.2|8.3)$ ]]; then INVALID_OPTIONS+=("${OPTARG}") fi ;; diff --git a/Build/testing-docker/docker-compose.yml b/Build/testing-docker/docker-compose.yml index 1fc1c3d..9f047a3 100644 --- a/Build/testing-docker/docker-compose.yml +++ b/Build/testing-docker/docker-compose.yml @@ -1,4 +1,3 @@ -version: '2.3' services: chrome: # Image for Mac M1 diff --git a/Classes/Backend/Controller/Ajax/JobController.php b/Classes/Backend/Controller/Ajax/JobController.php index a46951a..079722f 100644 --- a/Classes/Backend/Controller/Ajax/JobController.php +++ b/Classes/Backend/Controller/Ajax/JobController.php @@ -22,8 +22,8 @@ use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Http\JsonResponse; use TYPO3\CMS\Core\Http\Response; -use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\SingletonInterface; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3\CMS\Fluid\View\StandaloneView; @@ -61,7 +61,7 @@ public function create(ServerRequestInterface $request): Response 'flashMessage' => [ 'title' => 'OK', 'message' => LocalizationUtility::translate('LLL:EXT:content_sync/Resources/Private/Language/locallang.xlf:flashMessage.job-created'), - 'severity' => FlashMessage::OK, + 'severity' => ContextualFeedbackSeverity::OK, ], 'content' => $view->render(), ]; @@ -70,7 +70,7 @@ public function create(ServerRequestInterface $request): Response 'flashMessage' => [ 'title' => 'ERROR', 'message' => LocalizationUtility::translate('LLL:EXT:content_sync/Resources/Private/Language/locallang.xlf:flashMessage.job-not-created'), - 'severity' => FlashMessage::ERROR, + 'severity' => ContextualFeedbackSeverity::ERROR, ], ]; } @@ -93,7 +93,7 @@ public function kill(ServerRequestInterface $request): Response 'flashMessage' => [ 'title' => 'OK', 'message' => LocalizationUtility::translate('LLL:EXT:content_sync/Resources/Private/Language/locallang.xlf:flashMessage.job-killed'), - 'severity' => FlashMessage::OK, + 'severity' => ContextualFeedbackSeverity::OK, ], 'content' => $view->render(), ]; @@ -102,7 +102,7 @@ public function kill(ServerRequestInterface $request): Response 'flashMessage' => [ 'title' => 'ERROR', 'message' => LocalizationUtility::translate('LLL:EXT:content_sync/Resources/Private/Language/locallang.xlf:flashMessage.job-not-killed'), - 'severity' => FlashMessage::ERROR, + 'severity' => ContextualFeedbackSeverity::ERROR, ], 'content' => $view->render(), ]; diff --git a/Classes/Backend/ToolbarItems/JobStatusToolbarItem.php b/Classes/Backend/ToolbarItems/JobStatusToolbarItem.php index c74643b..a7cc8e8 100644 --- a/Classes/Backend/ToolbarItems/JobStatusToolbarItem.php +++ b/Classes/Backend/ToolbarItems/JobStatusToolbarItem.php @@ -27,7 +27,7 @@ class JobStatusToolbarItem implements ToolbarItemInterface public function __construct(StatusReportFactory $statusReportFactory, PageRenderer $pageRenderer) { $this->statusReportFactory = $statusReportFactory; - $pageRenderer->loadRequireJsModule('TYPO3/CMS/ContentSync/ContentSync'); + $pageRenderer->loadJavaScriptModule('@b13/content-sync/content-sync.js'); } public function checkAccess(): bool diff --git a/Classes/Command/StatusReportCommand.php b/Classes/Command/StatusReportCommand.php index 19279a0..769dc31 100644 --- a/Classes/Command/StatusReportCommand.php +++ b/Classes/Command/StatusReportCommand.php @@ -55,7 +55,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $statusReport->getJob()->getConfiguration()->getTargetNode()->getConnection() . ')' ); switch ($statusReport->getJob()->getStatus()) { - case Job::STATUS_WATING: + case Job::STATUS_WAITING: $output->writeln( LocalizationUtility::translate($llPrefix . 'job.created-at') . ': ' . $statusReport->getJob()->getCreatedTime()->format(LocalizationUtility::translate($llPrefix . 'date-format')) diff --git a/Classes/Domain/Model/Job.php b/Classes/Domain/Model/Job.php index 4141d05..d639c93 100644 --- a/Classes/Domain/Model/Job.php +++ b/Classes/Domain/Model/Job.php @@ -17,15 +17,15 @@ class Job { - public const STATUS_WATING = 0; - public const STATUS_RUNNING = 1; - public const STATUS_FINISHED = 2; - public const STATUS_KILLED = 3; - public const STATUS_FAILED = 4; + public const int STATUS_WAITING = 0; + public const int STATUS_RUNNING = 1; + public const int STATUS_FINISHED = 2; + public const int STATUS_KILLED = 3; + public const int STATUS_FAILED = 4; // can be killed after 10m running public const KILLABLE_TIMELIMIT = 600; - protected $status = self::STATUS_WATING; + protected int $status = self::STATUS_WAITING; protected Configuration $configuration; protected \DateTime $startTime; protected \DateTime $endTime; @@ -126,7 +126,7 @@ public function isKillable(): bool { return $this->status === self::STATUS_RUNNING && $this->getExecutionTime() > self::KILLABLE_TIMELIMIT || - $this->status === self::STATUS_WATING + $this->status === self::STATUS_WAITING ; } diff --git a/Classes/Domain/Model/StatusReport.php b/Classes/Domain/Model/StatusReport.php index f6f3b04..cf7d570 100644 --- a/Classes/Domain/Model/StatusReport.php +++ b/Classes/Domain/Model/StatusReport.php @@ -65,7 +65,7 @@ public function isNewJobCreateable(): bool return $this->configurationIsValid && ( $this->job === null || - !in_array($this->job->getStatus(), [Job::STATUS_WATING, Job::STATUS_RUNNING], true) + !in_array($this->job->getStatus(), [Job::STATUS_WAITING, Job::STATUS_RUNNING], true) ); } } diff --git a/Classes/Domain/Repository/JobRepository.php b/Classes/Domain/Repository/JobRepository.php index 556e855..f1392f1 100644 --- a/Classes/Domain/Repository/JobRepository.php +++ b/Classes/Domain/Repository/JobRepository.php @@ -19,7 +19,7 @@ class JobRepository implements SingletonInterface { - public const TABLE = 'tx_contentsync_job'; + public const string TABLE = 'tx_contentsync_job'; protected Connection $databaseConnection; @@ -45,9 +45,9 @@ public function findOneLast(): ?Job ->from(self::TABLE) ->orderBy('created_time', 'DESC') ->setMaxResults(1) - ->execute() - ->fetch(); - if ($row === false) { + ->executeQuery() + ->fetchAssociative(); + if ($row === []) { return null; } return (new Job())->fromDatabaseRow($row); @@ -61,14 +61,14 @@ public function findOneRunning(): ?Job ->where( $queryBuilder->expr()->eq( 'status', - $queryBuilder->createNamedParameter(Job::STATUS_RUNNING, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter(Job::STATUS_RUNNING, Connection::PARAM_INT) ) ) ->orderBy('created_time', 'ASC') ->setMaxResults(1) - ->execute() - ->fetch(); - if ($row === false) { + ->executeQuery() + ->fetchAllAssociative(); + if ($row === []) { return null; } return (new Job())->fromDatabaseRow($row); @@ -82,14 +82,15 @@ public function findOneWaiting(): ?Job ->where( $queryBuilder->expr()->eq( 'status', - $queryBuilder->createNamedParameter(Job::STATUS_WATING, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter(Job::STATUS_WAITING, Connection::PARAM_INT) ) ) ->orderBy('created_time', 'ASC') ->setMaxResults(1) - ->execute() - ->fetch(); - if ($row === false) { + ->executeQuery() + ->fetchAllAssociative(); + + if ($row === []) { return null; } return (new Job())->fromDatabaseRow($row); @@ -105,17 +106,17 @@ public function findStaleJobs(): array ->where( $queryBuilder->expr()->lte( 'created_time', - $queryBuilder->createNamedParameter($timeLimit, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($timeLimit, Connection::PARAM_INT) ), $queryBuilder->expr()->in( 'status', - $queryBuilder->createNamedParameter([Job::STATUS_WATING, Job::STATUS_RUNNING], Connection::PARAM_INT_ARRAY) + $queryBuilder->createNamedParameter([Job::STATUS_WAITING, Job::STATUS_RUNNING], Connection::PARAM_INT_ARRAY) ) ) - ->execute(); + ->executeQuery(); $jobs = []; - while ($row = $res->fetch()) { + while ($row = $res->fetchAssociative()) { $jobs[] = (new Job())->fromDatabaseRow($row); } return $jobs; diff --git a/Configuration/JavaScriptModules.php b/Configuration/JavaScriptModules.php new file mode 100644 index 0000000..5a3ef58 --- /dev/null +++ b/Configuration/JavaScriptModules.php @@ -0,0 +1,7 @@ + [ + '@b13/content-sync/' => 'EXT:content_sync/Resources/Public/JavaScript/', + ], +]; diff --git a/Resources/Public/Icons/ConfigurationCheck.svg b/Resources/Public/Icons/ConfigurationCheck.svg index 3c76e6e..8af7337 100644 --- a/Resources/Public/Icons/ConfigurationCheck.svg +++ b/Resources/Public/Icons/ConfigurationCheck.svg @@ -4,9 +4,8 @@ viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve"> - + - - + diff --git a/Resources/Public/Icons/SynchronisationHistory.svg b/Resources/Public/Icons/SynchronisationHistory.svg index 88eefff..045ea20 100644 --- a/Resources/Public/Icons/SynchronisationHistory.svg +++ b/Resources/Public/Icons/SynchronisationHistory.svg @@ -4,9 +4,8 @@ viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve"> - + Date: Tue, 14 Jan 2025 14:54:39 +0100 Subject: [PATCH 2/4] Use new 'docker compose' command --- .gitignore | 1 + Build/Scripts/runTests.sh | 55 ++++++++----------- Build/php-cs-fixer.php | 1 + Build/phpstan-baseline.neon | 4 +- Build/testing-docker/docker-compose.yml | 20 +------ .../ToolbarItems/JobStatusToolbarItem.php | 6 -- Classes/Domain/Model/Job.php | 10 ++-- Classes/Domain/Repository/JobRepository.php | 2 +- .../Service/DatabaseParameterBuilder.php | 5 ++ Classes/Exception.php | 4 +- composer.json | 3 +- 11 files changed, 42 insertions(+), 69 deletions(-) diff --git a/.gitignore b/.gitignore index ddcfc81..c142ac8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ public composer.lock vendor .php_cs.cache +.php-cs-fixer.cache /.Build /Build/testing-docker/.env diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index c7f00ba..69455ca 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -1,20 +1,20 @@ #!/usr/bin/env bash # -# TYPO3 core test runner based on docker and docker-compose. +# TYPO3 core test runner based on docker and "docker compose". # # Function to write a .env file in Build/testing-docker -# This is read by docker-compose and vars defined here are +# This is read by "docker compose" and vars defined here are # used in Build/testing-docker/docker-compose.yml setUpDockerComposeDotEnv() { # Delete possibly existing local .env file if exists [ -e .env ] && rm .env - # Set up a new .env file for docker-compose + # Set up a new .env file for "docker compose" { echo "COMPOSE_PROJECT_NAME=local" # To prevent access rights of files created by the testing, the docker image later - # runs with the same user that is currently executing the script. docker-compose can't + # runs with the same user that is currently executing the script. "docker compose" can't # use $UID directly itself since it is a shell variable and not an env variable, so # we have to set it explicitly here. echo "HOST_UID=`id -u`" @@ -40,7 +40,7 @@ read -r -d '' HELP < /dev/null; then - echo "This script relies on docker and docker-compose. Please install" >&2 - exit 1 -fi - -# docker-compose v2 is enabled by docker for mac as experimental feature without -# asking the user. v2 is currently broken. Detect the version and error out. - # Go to the directory this script is located, so everything else is relative # to this dir, no matter from where this script is called. THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" @@ -233,9 +224,9 @@ fi case ${TEST_SUITE} in acceptance) setUpDockerComposeDotEnv - docker-compose run acceptance_backend_mariadb10 + docker compose run acceptance_backend_mariadb10 SUITE_EXIT_CODE=$? - docker-compose down + docker compose down ;; cgl) # Active dry-run for cgl needs not "-n" but specific options @@ -243,36 +234,36 @@ case ${TEST_SUITE} in CGLCHECK_DRY_RUN="--dry-run --diff" fi setUpDockerComposeDotEnv - docker-compose run cgl + docker compose run cgl SUITE_EXIT_CODE=$? - docker-compose down + docker compose down ;; composerUpdate) setUpDockerComposeDotEnv - docker-compose run composer_update + docker compose run composer_update SUITE_EXIT_CODE=$? - docker-compose down + docker compose down ;; composerValidate) setUpDockerComposeDotEnv - docker-compose run composer_validate + docker compose run composer_validate SUITE_EXIT_CODE=$? - docker-compose down + docker compose down ;; functional) setUpDockerComposeDotEnv case ${DBMS} in mariadb) - docker-compose run functional_mariadb10 + docker compose run functional_mariadb10 SUITE_EXIT_CODE=$? ;; postgres) - docker-compose run functional_postgres10 + docker compose run functional_postgres10 SUITE_EXIT_CODE=$? ;; sqlite) mkdir -p ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/functional-sqlite-dbs/ - docker-compose run functional_sqlite + docker compose run functional_sqlite SUITE_EXIT_CODE=$? ;; *) @@ -281,25 +272,25 @@ case ${TEST_SUITE} in echo "${HELP}" >&2 exit 1 esac - docker-compose down + docker compose down ;; lint) setUpDockerComposeDotEnv - docker-compose run lint + docker compose run lint SUITE_EXIT_CODE=$? - docker-compose down + docker compose down ;; phpstan) setUpDockerComposeDotEnv - docker-compose run phpstan + docker compose run phpstan SUITE_EXIT_CODE=$? - docker-compose down + docker compose down ;; unit) setUpDockerComposeDotEnv - docker-compose run unit + docker compose run unit SUITE_EXIT_CODE=$? - docker-compose down + docker compose down ;; update) # pull typo3/core-testing-*:latest versions of those ones that exist locally diff --git a/Build/php-cs-fixer.php b/Build/php-cs-fixer.php index d1022f0..eef762f 100644 --- a/Build/php-cs-fixer.php +++ b/Build/php-cs-fixer.php @@ -1,5 +1,6 @@ getFinder()->in(['Classes', 'Configuration']); $config->getFinder()->exclude(['var', 'public']); return $config; diff --git a/Build/phpstan-baseline.neon b/Build/phpstan-baseline.neon index 6cca269..fec6b3c 100644 --- a/Build/phpstan-baseline.neon +++ b/Build/phpstan-baseline.neon @@ -1,6 +1,6 @@ parameters: ignoreErrors: - - message: "#^Call to an undefined method Psr\\\\Http\\\\Message\\\\ServerRequestInterface\\:\\:setControllerExtensionName\\(\\)\\.$#" + message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Database\\\\Connection\\:\\:getSchemaManager\\(\\)\\.$#" count: 1 - path: ../Classes/Backend/ToolbarItems/JobStatusToolbarItem.php + path: ../Classes/Domain/Service/DatabaseParameterBuilder.php diff --git a/Build/testing-docker/docker-compose.yml b/Build/testing-docker/docker-compose.yml index 9f047a3..254aa2d 100644 --- a/Build/testing-docker/docker-compose.yml +++ b/Build/testing-docker/docker-compose.yml @@ -105,25 +105,7 @@ services: set -x fi php -v | grep '^PHP'; - if [ ${PHP_XDEBUG_ON} -eq 0 ]; then - php -dxdebug.mode=off \ - .Build/bin/php-cs-fixer fix \ - -v \ - ${CGLCHECK_DRY_RUN} \ - --config=Build/php-cs-fixer.php \ - --using-cache=no . - else - DOCKER_HOST=`route -n | awk '/^0.0.0.0/ { print $$2 }'` - XDEBUG_MODE=\"debug,develop\" \ - XDEBUG_TRIGGER=\"foo\" \ - XDEBUG_CONFIG=\"client_port=${PHP_XDEBUG_PORT} client_host=$${DOCKER_HOST}\" \ - PHP_CS_FIXER_ALLOW_XDEBUG=1 \ - .Build/bin/php-cs-fixer fix \ - -v \ - ${CGLCHECK_DRY_RUN} \ - --config=Build/php-cs-fixer.php \ - --using-cache=no . - fi + ${CORE_ROOT}/.Build/bin/php-cs-fixer fix --config Build/php-cs-fixer.php " composer_update: diff --git a/Classes/Backend/ToolbarItems/JobStatusToolbarItem.php b/Classes/Backend/ToolbarItems/JobStatusToolbarItem.php index a7cc8e8..81cca68 100644 --- a/Classes/Backend/ToolbarItems/JobStatusToolbarItem.php +++ b/Classes/Backend/ToolbarItems/JobStatusToolbarItem.php @@ -15,7 +15,6 @@ use B13\ContentSync\Domain\Factory\StatusReportFactory; use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\View\StandaloneView; @@ -76,11 +75,6 @@ protected function getFluidTemplateObject(string $filename): StandaloneView $view->setPartialRootPaths(['EXT:backend/Resources/Private/Partials/ToolbarItems', 'EXT:content_sync/Resources/Private/Partials']); $templateRootPaths = ['EXT:content_sync/Resources/Private/Templates/ToolbarItems']; - // @todo: remove when v11 was dropped - if ((new Typo3Version())->getMajorVersion() < 12) { - $templateRootPaths = ['EXT:content_sync/Resources/Private/Templates/ToolbarItemsV11']; - $view->getRequest()->setControllerExtensionName('ContentSync'); - } $view->setTemplateRootPaths($templateRootPaths); $view->setTemplate($filename); diff --git a/Classes/Domain/Model/Job.php b/Classes/Domain/Model/Job.php index d639c93..5ace737 100644 --- a/Classes/Domain/Model/Job.php +++ b/Classes/Domain/Model/Job.php @@ -17,11 +17,11 @@ class Job { - public const int STATUS_WAITING = 0; - public const int STATUS_RUNNING = 1; - public const int STATUS_FINISHED = 2; - public const int STATUS_KILLED = 3; - public const int STATUS_FAILED = 4; + public const STATUS_WAITING = 0; + public const STATUS_RUNNING = 1; + public const STATUS_FINISHED = 2; + public const STATUS_KILLED = 3; + public const STATUS_FAILED = 4; // can be killed after 10m running public const KILLABLE_TIMELIMIT = 600; diff --git a/Classes/Domain/Repository/JobRepository.php b/Classes/Domain/Repository/JobRepository.php index f1392f1..7bb0e2b 100644 --- a/Classes/Domain/Repository/JobRepository.php +++ b/Classes/Domain/Repository/JobRepository.php @@ -19,7 +19,7 @@ class JobRepository implements SingletonInterface { - public const string TABLE = 'tx_contentsync_job'; + public const TABLE = 'tx_contentsync_job'; protected Connection $databaseConnection; diff --git a/Classes/Domain/Service/DatabaseParameterBuilder.php b/Classes/Domain/Service/DatabaseParameterBuilder.php index f364a82..e50677d 100644 --- a/Classes/Domain/Service/DatabaseParameterBuilder.php +++ b/Classes/Domain/Service/DatabaseParameterBuilder.php @@ -16,6 +16,7 @@ use Helhum\Typo3Console\Database\Schema\TableMatcher; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\SingletonInterface; class DatabaseParameterBuilder implements SingletonInterface @@ -52,6 +53,10 @@ protected function getMatchedTables(array $tables): array protected function getAllTables(): array { + if ((new Typo3Version())->getMajorVersion() > 12) { + return $this->connection->createSchemaManager()->listTableNames(); + } return $this->connection->getSchemaManager()->listTableNames(); + } } diff --git a/Classes/Exception.php b/Classes/Exception.php index 84bf274..536ee50 100644 --- a/Classes/Exception.php +++ b/Classes/Exception.php @@ -12,6 +12,4 @@ * of the License, or any later version. */ -class Exception extends \TYPO3\CMS\Core\Exception -{ -} +class Exception extends \TYPO3\CMS\Core\Exception {} diff --git a/composer.json b/composer.json index df4100a..6b1cd86 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "require": { "typo3/cms-backend": "^12.4 || ^13.4", "typo3/cms-fluid": "^12.4 || ^13.4", + "typo3/cms-core": "^12.4 || ^13.4", "helhum/typo3-console": "^7.0.0 || ^8.0", "zumba/json-serializer": "^3.0", "symfony/process": "^6.0 || ^7.0" @@ -27,7 +28,7 @@ } }, "require-dev": { - "typo3/coding-standards": "^0.7.1", + "typo3/coding-standards": "^0.8.0", "phpstan/phpstan": "^1.10.16" }, "config": { From 6dfde3ef01ee23562dcb923b7a4469d9c80fbe96 Mon Sep 17 00:00:00 2001 From: Jochen Date: Tue, 14 Jan 2025 16:48:19 +0100 Subject: [PATCH 3/4] Remove v11 templates --- .../ToolbarItemsV11/JobStatusToolbarItem.html | 17 ------- .../JobStatusToolbarItemDropDown.html | 45 ------------------- 2 files changed, 62 deletions(-) delete mode 100644 Resources/Private/Templates/ToolbarItemsV11/JobStatusToolbarItem.html delete mode 100644 Resources/Private/Templates/ToolbarItemsV11/JobStatusToolbarItemDropDown.html diff --git a/Resources/Private/Templates/ToolbarItemsV11/JobStatusToolbarItem.html b/Resources/Private/Templates/ToolbarItemsV11/JobStatusToolbarItem.html deleted file mode 100644 index 1f3d810..0000000 --- a/Resources/Private/Templates/ToolbarItemsV11/JobStatusToolbarItem.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - diff --git a/Resources/Private/Templates/ToolbarItemsV11/JobStatusToolbarItemDropDown.html b/Resources/Private/Templates/ToolbarItemsV11/JobStatusToolbarItemDropDown.html deleted file mode 100644 index 0144c67..0000000 --- a/Resources/Private/Templates/ToolbarItemsV11/JobStatusToolbarItemDropDown.html +++ /dev/null @@ -1,45 +0,0 @@ - - -
- - From fac1e35459d3f2c7fca8a85f610e7fcbf0310dc9 Mon Sep 17 00:00:00 2001 From: Jochen Date: Wed, 15 Jan 2025 09:44:58 +0100 Subject: [PATCH 4/4] Retrieve only single db row --- Classes/Domain/Repository/JobRepository.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Classes/Domain/Repository/JobRepository.php b/Classes/Domain/Repository/JobRepository.php index 7bb0e2b..e239870 100644 --- a/Classes/Domain/Repository/JobRepository.php +++ b/Classes/Domain/Repository/JobRepository.php @@ -47,7 +47,7 @@ public function findOneLast(): ?Job ->setMaxResults(1) ->executeQuery() ->fetchAssociative(); - if ($row === []) { + if ($row === false) { return null; } return (new Job())->fromDatabaseRow($row); @@ -67,8 +67,8 @@ public function findOneRunning(): ?Job ->orderBy('created_time', 'ASC') ->setMaxResults(1) ->executeQuery() - ->fetchAllAssociative(); - if ($row === []) { + ->fetchAssociative(); + if ($row === false) { return null; } return (new Job())->fromDatabaseRow($row); @@ -88,9 +88,9 @@ public function findOneWaiting(): ?Job ->orderBy('created_time', 'ASC') ->setMaxResults(1) ->executeQuery() - ->fetchAllAssociative(); + ->fetchAssociative(); - if ($row === []) { + if ($row === false) { return null; } return (new Job())->fromDatabaseRow($row);