From 02440f4deddd5b3b5ca34215ff1f014377148a5e Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Fri, 24 May 2024 15:47:06 +0200 Subject: [PATCH] [TASK] Start v13 migration --- .../Domain/Finisher/CommentFormFinisher.php | 8 +-- Classes/Service/SetupService.php | 13 ++-- Classes/Updates/AbstractUpdate.php | 2 +- Configuration/TCA/Overrides/pages.php | 20 +++--- .../TCA/tx_blog_domain_model_author.php | 34 +++++---- composer.json | 42 +++++------ ext_tables.php | 70 ------------------- 7 files changed, 58 insertions(+), 131 deletions(-) diff --git a/Classes/Domain/Finisher/CommentFormFinisher.php b/Classes/Domain/Finisher/CommentFormFinisher.php index d92d1ebf..f1bea71b 100644 --- a/Classes/Domain/Finisher/CommentFormFinisher.php +++ b/Classes/Domain/Finisher/CommentFormFinisher.php @@ -16,9 +16,9 @@ use T3G\AgencyPack\Blog\Notification\NotificationManager; use T3G\AgencyPack\Blog\Service\CacheService; use T3G\AgencyPack\Blog\Service\CommentService; -use TYPO3\CMS\Core\Messaging\AbstractMessage; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\FlashMessageService; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Service\ExtensionService; @@ -36,17 +36,17 @@ class CommentFormFinisher extends AbstractFinisher CommentService::STATE_ERROR => [ 'title' => 'message.addComment.error.title', 'text' => 'message.addComment.error.text', - 'severity' => AbstractMessage::ERROR, + 'severity' => ContextualFeedbackSeverity::ERROR, ], CommentService::STATE_MODERATION => [ 'title' => 'message.addComment.moderation.title', 'text' => 'message.addComment.moderation.text', - 'severity' => AbstractMessage::INFO, + 'severity' => ContextualFeedbackSeverity::INFO, ], CommentService::STATE_SUCCESS => [ 'title' => 'message.addComment.success.title', 'text' => 'message.addComment.success.text', - 'severity' => AbstractMessage::OK, + 'severity' => ContextualFeedbackSeverity::OK, ], ]; diff --git a/Classes/Service/SetupService.php b/Classes/Service/SetupService.php index ffae0e68..0c95ebf3 100644 --- a/Classes/Service/SetupService.php +++ b/Classes/Service/SetupService.php @@ -12,6 +12,7 @@ use T3G\AgencyPack\Blog\Constants; use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\DataHandling\DataHandler; @@ -28,7 +29,7 @@ public function determineBlogSetups(): array ->select('pid') ->addSelectLiteral($queryBuilder->expr()->count('pid', 'cnt')) ->from('pages') - ->where($queryBuilder->expr()->eq('doktype', $queryBuilder->createNamedParameter(Constants::DOKTYPE_BLOG_POST, \PDO::PARAM_INT))) + ->where($queryBuilder->expr()->eq('doktype', $queryBuilder->createNamedParameter(Constants::DOKTYPE_BLOG_POST, Connection::PARAM_INT))) ->groupBy('pid') ->executeQuery() ->fetchAllAssociative(); @@ -39,7 +40,7 @@ public function determineBlogSetups(): array $title = $queryBuilder ->select('title') ->from('pages') - ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($blogUid, \PDO::PARAM_INT))) + ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($blogUid, Connection::PARAM_INT))) ->executeQuery() ->fetchOne(); $rootline = array_reverse(GeneralUtility::makeInstance(RootlineUtility::class, $blogUid)->get()); @@ -84,12 +85,12 @@ public function createBlogSetup(array $data = []): bool $record = $queryBuilder ->select('TSconfig') ->from('pages') - ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($blogRootUid, \PDO::PARAM_INT))) + ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($blogRootUid, Connection::PARAM_INT))) ->executeQuery() ->fetchAssociative(); $queryBuilder->update('pages') ->set('TSconfig', str_replace('NEW_blogFolder', (string)$blogFolderUid, $record['TSconfig'] ?? '')) - ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($blogRootUid, \PDO::PARAM_INT))) + ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($blogRootUid, Connection::PARAM_INT))) ->executeStatement(); $blogSetupRelations = GeneralUtility::getFileAbsFileName('EXT:blog/Configuration/DataHandler/BlogSetupRelations.php'); @@ -112,7 +113,7 @@ public function createBlogSetup(array $data = []): bool $record = $queryBuilder ->select('constants') ->from('sys_template') - ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($sysTemplateUid, \PDO::PARAM_INT))) + ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($sysTemplateUid, Connection::PARAM_INT))) ->executeQuery() ->fetchAssociative(); $queryBuilder @@ -122,7 +123,7 @@ public function createBlogSetup(array $data = []): bool $recordUidArray, $record['constants'] ?? '' )) - ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($sysTemplateUid, \PDO::PARAM_INT))) + ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($sysTemplateUid, Connection::PARAM_INT))) ->executeStatement(); } } diff --git a/Classes/Updates/AbstractUpdate.php b/Classes/Updates/AbstractUpdate.php index 0f564f6f..3ee3fc93 100644 --- a/Classes/Updates/AbstractUpdate.php +++ b/Classes/Updates/AbstractUpdate.php @@ -133,7 +133,7 @@ protected function updateRecord(string $table, int $uid, array $values): void { $queryBuilder = $this->createQueryBuilder($table); $queryBuilder->update($table) - ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT))); + ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, Connection::PARAM_INT))); foreach ($values as $field => $value) { $queryBuilder->set($field, $value); diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index e57500ac..b813fa53 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -194,17 +194,15 @@ ], 'featured_image' => [ 'label' => $ll . 'pages.featured_image', - 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( - 'featured_image', - [ - 'minitems' => 0, - 'maxitems' => 1, - 'behaviour' => [ - 'allowLanguageSynchronization' => true - ] - ], - $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] - ), + 'config' => [ + 'type' => 'file', + 'minitems' => 0, + 'maxitems' => 1, + 'allowed' => 'common-image-types', + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], ], 'categories' => [ 'config' => [ diff --git a/Configuration/TCA/tx_blog_domain_model_author.php b/Configuration/TCA/tx_blog_domain_model_author.php index 57ac48ae..619d6752 100644 --- a/Configuration/TCA/tx_blog_domain_model_author.php +++ b/Configuration/TCA/tx_blog_domain_model_author.php @@ -115,27 +115,25 @@ 'image' => [ 'label' => $ll . 'tx_blog_domain_model_author.image', 'displayCond' => 'FIELD:avatar_provider:=:T3G\AgencyPack\Blog\AvatarProvider\ImageProvider', - 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( - 'image', - [ - 'appearance' => [ - 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' - ], - 'overrideChildTca' => [ - 'types' => [ - \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ - 'showitem' => ' - crop, - --palette--;;filePalette - ' - ], + 'config' => [ + 'type' => 'file', + 'appearance' => [ + 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' + ], + 'overrideChildTca' => [ + 'types' => [ + \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ + 'showitem' => ' + crop, + --palette--;;filePalette + ' ], ], - 'minitems' => 0, - 'maxitems' => 1, ], - $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] - ), + 'minitems' => 0, + 'maxitems' => 1, + 'allowed' => 'common-image-types', + ], 'l10n_mode' => 'exclude', ], 'title' => [ diff --git a/composer.json b/composer.json index f012b655..efaa29c4 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ }, "extra": { "branch-alias": { - "dev-master": "12.0.x-dev" + "dev-master": "13.0.x-dev" }, "typo3/cms": { "extension-key": "blog", @@ -84,20 +84,20 @@ "typo3/cms-fluid-styled-content": "Content rendering definition based on fluid" }, "require": { - "php": "^7.4 || ^8.0", + "php": "^8.1", "ext-json": "*", "ext-pdo": "*", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "typo3/cms-backend": "^11.5 || ^12.4", - "typo3/cms-core": "^11.5 || ^12.4", - "typo3/cms-extbase": "^11.5 || ^12.4", - "typo3/cms-extensionmanager": "^11.5 || ^12.4", - "typo3/cms-fluid": "^11.5 || ^12.4", - "typo3/cms-form": "^11.5 || ^12.4", - "typo3/cms-frontend": "^11.5 || ^12.4", - "typo3/cms-install": "^11.5 || ^12.4", + "psr/http-message": "^2.0", + "typo3/cms-backend": "^12.4 || ^13.1", + "typo3/cms-core": "^12.4 || ^13.1", + "typo3/cms-extbase": "^12.4 || ^13.1", + "typo3/cms-extensionmanager": "^12.4 || ^13.1", + "typo3/cms-fluid": "^12.4 || ^13.1", + "typo3/cms-form": "^12.4 || ^13.1", + "typo3/cms-frontend": "^12.4 || ^13.1", + "typo3/cms-install": "^12.4 || ^13.1", "typo3fluid/fluid": "^2.6" }, "require-dev": { @@ -110,15 +110,15 @@ "phpstan/phpstan-deprecation-rules": "^1.1", "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-strict-rules": "^1.5", - "typo3/cms-belog": "^11.5 || ^12.4", - "typo3/cms-beuser": "^11.5 || ^12.4", - "typo3/cms-filelist": "^11.5 || ^12.4", - "typo3/cms-fluid-styled-content": "^11.5 || ^12.4", - "typo3/cms-lowlevel": "^11.5 || ^12.4", - "typo3/cms-rte-ckeditor": "^11.5 || ^12.4", - "typo3/cms-seo": "^11.5 || ^12.4", - "typo3/cms-setup": "^11.5 || ^12.4", - "typo3/cms-tstemplate": "^11.5 || ^12.4", - "typo3/testing-framework": "^7.0 || ^8.0" + "typo3/cms-belog": "^12.4", + "typo3/cms-beuser": "^12.4", + "typo3/cms-filelist": "^12.4", + "typo3/cms-fluid-styled-content": "^12.4", + "typo3/cms-lowlevel": "^12.4", + "typo3/cms-rte-ckeditor": "^12.4", + "typo3/cms-seo": "^12.4", + "typo3/cms-setup": "^12.4", + "typo3/cms-tstemplate": "^12.4", + "typo3/testing-framework": "^8.0" } } diff --git a/ext_tables.php b/ext_tables.php index 2fdc61d8..7aa2f8e1 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -8,13 +8,10 @@ */ use T3G\AgencyPack\Blog\Constants; -use T3G\AgencyPack\Blog\Controller\BackendController; use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider; use TYPO3\CMS\Core\Imaging\IconRegistry; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Utility\ExtensionUtility; if (!defined('TYPO3')) { die('Access denied.'); @@ -70,70 +67,3 @@ ExtensionManagementUtility::addUserTSConfig(' options.pageTree.doktypesToShowInNewPageDragArea := addToList(' . Constants::DOKTYPE_BLOG_POST . ') '); - -if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - ExtensionManagementUtility::allowTableOnStandardPages('tx_blog_domain_model_comment'); -} - -if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 12) { - // Main Blog - ExtensionManagementUtility::addModule( - 'blog', - '', - 'after:web', - null, - [ - 'labels' => 'LLL:EXT:blog/Resources/Private/Language/locallang_mod_blog.xlf', - 'name' => 'blog', - 'iconIdentifier' => 'module-blog', - ] - ); - - // Module Blog > Posts - ExtensionUtility::registerModule( - 'Blog', - 'blog', - 'blog_posts', - '', - [ - BackendController::class => 'posts', - ], - [ - 'labels' => 'LLL:EXT:blog/Resources/Private/Language/locallang_mod_blog_posts.xlf', - 'iconIdentifier' => 'module-blog-posts', - 'access' => 'user,group', - ] - ); - - // Module Blog > Comments - ExtensionUtility::registerModule( - 'Blog', - 'blog', - 'blog_comments', - '', - [ - BackendController::class => 'comments, updateCommentStatus', - ], - [ - 'labels' => 'LLL:EXT:blog/Resources/Private/Language/locallang_mod_blog_comments.xlf', - 'iconIdentifier' => 'module-blog-comments', - 'access' => 'user,group', - ] - ); - - // Module Blog > Setup - ExtensionUtility::registerModule( - 'Blog', - 'blog', - 'blog_setup', - '', - [ - BackendController::class => 'setupWizard, createBlog', - ], - [ - 'labels' => 'LLL:EXT:blog/Resources/Private/Language/locallang_mod_blog_setup.xlf', - 'iconIdentifier' => 'module-blog-setup', - 'access' => 'admin', - ] - ); -}