Skip to content

Commit

Permalink
[TASK] Start v13 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
achimfritz-b13 authored and bnf committed Oct 17, 2024
1 parent 466fc12 commit 02440f4
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 131 deletions.
8 changes: 4 additions & 4 deletions Classes/Domain/Finisher/CommentFormFinisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
],
];

Expand Down
13 changes: 7 additions & 6 deletions Classes/Service/SetupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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());
Expand Down Expand Up @@ -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');
Expand All @@ -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
Expand All @@ -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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Updates/AbstractUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 9 additions & 11 deletions Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
34 changes: 16 additions & 18 deletions Configuration/TCA/tx_blog_domain_model_author.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
42 changes: 21 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "12.0.x-dev"
"dev-master": "13.0.x-dev"
},
"typo3/cms": {
"extension-key": "blog",
Expand Down Expand Up @@ -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": {
Expand All @@ -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"
}
}
70 changes: 0 additions & 70 deletions ext_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down Expand Up @@ -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',
]
);
}

0 comments on commit 02440f4

Please sign in to comment.