Skip to content
Snippets Groups Projects
Commit 6eb533a4 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

Merge branch 'feature_Upgrade-to-TYPO3-10' into 'master'

Feature upgrade to typo3 10

See merge request !30
parents 62c9926a e99e8afd
No related branches found
No related tags found
1 merge request!30Feature upgrade to typo3 10
Showing
with 228 additions and 290 deletions
......@@ -30,27 +30,17 @@ use SGalinski\SgMail\Service\BackendService;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Updates\AbstractUpdate;
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
/**
* Migrate template db entries to the correct root pages
*/
class UpdatePidToSiteRoot extends AbstractUpdate {
/**
* @var string
*/
protected $identifier = 'tx_sgmail_update_pid_to_site_root';
/**
* @var string
*/
protected $title = 'Find all templates & queue entries with site root and assign the correct site root id as pid. Also check if the pids are actually site roots and update them accordingly';
class UpdatePidToSiteRoot implements UpgradeWizardInterface {
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManager
* The wizard identifier
*/
protected $objectManager;
const IDENTIFIER = 'tx_sgmail_update_pid_to_site_root';
/**
* @var array
......@@ -60,61 +50,48 @@ class UpdatePidToSiteRoot extends AbstractUpdate {
];
/**
* Checks whether updates are required.
* check if site_root columns actually exist
*
* @param string &$description The description for the update
* @return bool Whether an update is required (TRUE) or not (FALSE)
* @param string $table
* @return bool
*/
public function checkForUpdate(&$description) {
$description = 'Move site root ids to pid & update pids to their correspondent site root ids';
private function siteRootColumnExists($table) {
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($table);
$result = $connection->getSchemaManager()->listTableColumns($table);
return \array_key_exists('site_root_id', $result);
}
// are there site root columns differing from pids?
foreach ($this->tables as $table) {
if (!$this->siteRootColumnExists($table)) {
continue;
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$rowCount = $queryBuilder->select('*')
->from($table)
->where($queryBuilder->expr()->neq('site_root_id', 'pid'))
->execute()->rowCount();
if ($rowCount > 0) {
return TRUE;
}
}
/**
* @return string
*/
public function getIdentifier(): string {
return self::IDENTIFIER;
}
// are the pids not belonging to site root pages ?
foreach ($this->tables as $table) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$result = $queryBuilder->select('pid')->from($table)->groupBy('pid')->execute();
foreach ($result as $row) {
$siteRootId = BackendService::getSiteRoot($row['pid']);
if ($siteRootId !== $row['pid']) {
return TRUE;
}
}
}
/**
* @return string
*/
public function getTitle(): string {
return 'Find all templates & queue entries with site root and assign the correct site root id as pid. Also check if the pids are actually site roots and update them accordingly';
}
return !(!FALSE || $this->isWizardDone());
/**
* @return string
*/
public function getDescription(): string {
return 'Move site root ids to pid & update pids to their correspondent site root ids';
}
/**
* Performs the according updates.
*
* @param array &$dbQueries Queries done in this update
* @param mixed &$customMessages Custom messages
* @return bool Whether everything went smoothly or not
* @return bool
* @throws \Doctrine\DBAL\DBALException
*/
public function performUpdate(array &$dbQueries, &$customMessages) {
public function executeUpdate(): bool {
foreach ($this->tables as $table) {
if ($this->siteRootColumnExists($table)) {
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($table);
$sql = 'UPDATE ' . $table . ' SET pid = site_root_id';
$connection->executeQuery($sql);
$dbQueries[] = $sql;
} else {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll()->add(
......@@ -129,24 +106,55 @@ class UpdatePidToSiteRoot extends AbstractUpdate {
$siteRootId = 1;
}
$queryBuilder->update($table)->set('pid', $siteRootId)->where('pid = ' . $row['pid'])->execute();
$dbQueries[] = $queryBuilder->getSQL();
}
}
}
$this->markWizardAsDone();
return TRUE;
}
/**
* check if site_root columns actually exist
*
* @param string $table
* @return bool
*/
private function siteRootColumnExists($table) {
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($table);
$result = $connection->getSchemaManager()->listTableColumns($table);
return \array_key_exists('site_root_id', $result);
public function updateNecessary(): bool {
// are there site root columns differing from pids?
foreach ($this->tables as $table) {
if (!$this->siteRootColumnExists($table)) {
continue;
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$rowCount = $queryBuilder->select('*')
->from($table)
->where($queryBuilder->expr()->neq('site_root_id', 'pid'))
->execute()->rowCount();
if ($rowCount > 0) {
return TRUE;
}
}
// are the pids not belonging to site root pages ?
foreach ($this->tables as $table) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$result = $queryBuilder->select('pid')->from($table)->groupBy('pid')->execute();
foreach ($result as $row) {
$siteRootId = BackendService::getSiteRoot($row['pid']);
if ($siteRootId !== $row['pid']) {
return TRUE;
}
}
}
return FALSE;
}
/**
* @return array|string[]
*/
public function getPrerequisites(): array {
return [
DatabaseUpdatedPrerequisite::class
];
}
}
......@@ -28,68 +28,48 @@ namespace SGalinski\SgMail\Updates;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Updates\AbstractUpdate;
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
/**
* Update the correct sending times (if any)
*/
class UpdateSendingTimes extends AbstractUpdate {
class UpdateSendingTimes implements UpgradeWizardInterface {
/**
* @var string
* The wizard identifier
*/
protected $identifier = 'tx_sgmail_update_sending_times';
const IDENTIFIER = 'tx_sgmail_update_sending_times';
/**
* @var string
*/
protected $title = 'Find all sent mails and set the sending time to the tstamp field';
protected $table = 'tx_sgmail_domain_model_mail';
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManager
* @return string
*/
protected $objectManager;
public function getIdentifier(): string {
return 'tx_sgmail_update_sending_times';
}
/**
* @var string
* @return string
*/
protected $table = 'tx_sgmail_domain_model_mail';
public function getTitle(): string {
return 'Find all sent mails and set the sending time to the tstamp field';
}
/**
* Checks whether updates are required.
*
* @param string &$description The description for the update
* @return bool Whether an update is required (TRUE) or not (FALSE)
* @return string
*/
public function checkForUpdate(&$description) {
$description = 'Update the sending times if mails have been sent';
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table);
$queryBuilder->getRestrictions()->removeAll();
$rowCount = $queryBuilder->select('*')
->from($this->table)
->where(
$queryBuilder->expr()->andX(
$queryBuilder->expr()->gt('sending_time', 0),
$queryBuilder->expr()->eq('last_sending_time', 0)
)
)
->execute()->rowCount();
if ($rowCount > 0) {
return TRUE;
}
return !(!FALSE || $this->isWizardDone());
public function getDescription(): string {
return 'Update the sending times if mails have been sent';
}
/**
* Performs the according updates.
*
* @param array &$dbQueries Queries done in this update
* @param mixed &$customMessages Custom messages
* @return bool Whether everything went smoothly or not
* @return bool
*/
public function performUpdate(array &$dbQueries, &$customMessages) {
$dbQueries = [];
public function executeUpdate(): bool {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table);
$queryBuilder->getRestrictions()->removeAll();
$result = $queryBuilder->select('uid', 'sending_time')
......@@ -101,7 +81,6 @@ class UpdateSendingTimes extends AbstractUpdate {
)
)
->execute()->fetchAll();
$dbQueries[] = $queryBuilder->getSQL();
/** @var array $result */
foreach ($result as $row) {
......@@ -111,10 +90,35 @@ class UpdateSendingTimes extends AbstractUpdate {
)
->set('last_sending_time', (int) $row['sending_time'])
->execute();
$dbQueries[] = $queryBuilder->getSQL();
}
$this->markWizardAsDone();
return TRUE;
}
/**
* @return bool
*/
public function updateNecessary(): bool {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table);
$queryBuilder->getRestrictions()->removeAll();
$rowCount = $queryBuilder->select('*')
->from($this->table)
->where(
$queryBuilder->expr()->andX(
$queryBuilder->expr()->gt('sending_time', 0),
$queryBuilder->expr()->eq('last_sending_time', 0)
)
)
->execute()->rowCount();
return $rowCount > 0;
}
/**
* @return array|string[]
*/
public function getPrerequisites(): array {
return [
DatabaseUpdatedPrerequisite::class
];
}
}
<?php
namespace SGalinski\SgMail\UserFunc;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgMail\Service\RegisterService;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class ExtensionConfiguration
*
* @package SGalinski\SgMail\UserFunc
*/
class ExtensionConfiguration {
/**
* Displays all registered sg mail templates for easy use with the blacklist feature
*
* @return string
*/
public function displayTemplates(): string {
$result = '';
try {
// These are internal methods that can vanish at any moment
// TODO: We need to change this whole TypoScript fetching at these early stages
ExtensionManagementUtility::loadExtLocalconf();
ExtensionManagementUtility::loadBaseTca();
$registerService = GeneralUtility::makeInstance(RegisterService::class);
$registerArray = $registerService->getRegisterArray();
foreach ($registerArray as $extensionKey => $extension) {
/** @var array $extension */
foreach ($extension as $templateKey => $template) {
$result .= $extensionKey . '.' . $templateKey . '<br>';
}
}
} catch (\Exception $exception) {
return 'The template list could not be loaded!';
}
return $result;
}
}
<?php
namespace SGalinski\SgMail\Utility;
/**
*
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
*/
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
/**
* Class ExtensionUtility
*
* @package SGalinski\SgMail\Utility
* @author Kevin Ditscheid <kevin.ditscheid@sgalinski.de>
*/
class ExtensionUtility {
/**
* Get the extension configuration
*
* @return array
*/
public static function getExtensionConfiguration(): array {
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$extConf = \unserialize(
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['sg_mail'], ['allowed_classes' => FALSE]
);
return is_array($extConf) ? $extConf : [];
}
return $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_mail'] ?? [];
}
}
......@@ -27,6 +27,7 @@ namespace SGalinski\SgMail\ViewHelpers\Widget;
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
......@@ -52,9 +53,6 @@ class UriViewHelper extends AbstractViewHelper {
* Initialize arguments
*/
public function initializeArguments() {
$this->registerArgument(
'useCacheHash', 'bool', 'True whether the cache hash should be appended to the URL', FALSE, FALSE
);
$this->registerArgument('addQueryStringMethod', 'string', 'Method to be used for query string');
$this->registerArgument('action', 'string', 'Target action');
$this->registerArgument('arguments', 'array', 'Arguments', FALSE, []);
......@@ -89,6 +87,7 @@ class UriViewHelper extends AbstractViewHelper {
* @return string the AJAX URI
*/
protected static function getAjaxUri(RenderingContextInterface $renderingContext, array $arguments) {
/** @var ControllerContext $controllerContext */
$controllerContext = $renderingContext->getControllerContext();
$action = $arguments['action'];
$arguments = $arguments['arguments'];
......@@ -111,6 +110,7 @@ class UriViewHelper extends AbstractViewHelper {
* @return string the Widget URI
*/
protected static function getWidgetUri(RenderingContextInterface $renderingContext, array $arguments) {
/** @var ControllerContext $controllerContext */
$controllerContext = $renderingContext->getControllerContext();
$uriBuilder = $controllerContext->getUriBuilder();
$argumentPrefix = $controllerContext->getRequest()->getArgumentPrefix();
......
......@@ -28,9 +28,11 @@ namespace SGalinski\SgMail\XClass\Form;
use SGalinski\SgMail\Service\MailTemplateService;
use SGalinski\SgMail\Service\RegisterService;
use Symfony\Component\Yaml\Yaml;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Resource\StorageRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Form\Type\FormDefinitionArray;
/** @noinspection LongInheritanceChainInspection */
......@@ -67,7 +69,12 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
* @internal
*/
public function saveFormAction(string $formPersistenceIdentifier, FormDefinitionArray $formDefinition) {
$registrationService = $this->objectManager->get(RegisterService::class);
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '10.4.0', '<')) {
/** @var RegisterService $registrationService */
$registrationService = $this->objectManager->get(RegisterService::class);
} else {
$registrationService = GeneralUtility::makeInstance(RegisterService::class);
}
// immediately exit when no finisher is defined (that means no sgmail integration anyway)
// call the parent saveFormAction here, otherwise it wouldn't be called at all in this case
......@@ -106,15 +113,21 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
if (strpos($formPersistenceIdentifier, 'EXT:') === 0) {
$absoluteFilePath = GeneralUtility::getFileAbsFileName($formPersistenceIdentifier);
} else {
list($storageUid, $fileIdentifier) = explode(':', $formPersistenceIdentifier, 2);
$storageRepository = $this->objectManager->get(StorageRepository::class);
[$storageUid, $fileIdentifier] = explode(':', $formPersistenceIdentifier, 2);
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '10.4.0', '<')) {
/** @var StorageRepository $storageRepository */
$storageRepository = $this->objectManager->get(StorageRepository::class);
} else {
$storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
}
$storage = $storageRepository->findByUid($storageUid);
if (!$storage instanceof ResourceStorage || !$storage->isBrowsable()) {
throw new \InvalidArgumentException(
sprintf('Could not access storage with uid "%d".', $storageUid)
);
}
$absoluteFilePath = PATH_site . $storage->getFile($fileIdentifier)->getPublicUrl();
$absoluteFilePath = Environment::getPublicPath() . '/' . $storage->getFile($fileIdentifier)->getPublicUrl();
}
try {
......@@ -167,8 +180,13 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
'markerLabel' => $markerLabel
];
}
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '10.4.0', '<')) {
/** @var RegisterService $registrationService */
$registrationService = $this->objectManager->get(RegisterService::class);
} else {
$registrationService = GeneralUtility::makeInstance(RegisterService::class);
}
$registrationService = $this->objectManager->get(RegisterService::class);
return $registrationService->writeRegisterFile($templateKey, $extensionKey, $markers, $templateKey);
}
......
......@@ -32,6 +32,7 @@ use SGalinski\SgMail\Service\TypoScriptSettingsService;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
/**
......@@ -70,10 +71,14 @@ class FormManagerController extends \TYPO3\CMS\Form\Controller\FormManagerContro
*/
private function getRegistrationPath(): string {
// get typoscript settings from sg mail
/** @var TypoScriptSettingsService $typoScriptSettingsService */
$typoScriptSettingsService = $this->objectManager->get(TypoScriptSettingsService::class);
$tsSettings = $typoScriptSettingsService->getSettings(0, 'tx_sgmail');
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '10.4.0', '<')) {
/** @var TypoScriptSettingsService $typoScriptSettingsService */
$typoScriptSettingsService = $this->objectManager->get(TypoScriptSettingsService::class);
} else {
$typoScriptSettingsService = GeneralUtility::makeInstance(TypoScriptSettingsService::class);
}
$tsSettings = $typoScriptSettingsService->getSettings(0, 'tx_sgmail');
// get the location where automatic registrations should be stored
return 'EXT:' . $tsSettings['mail']['configurationLocation'] . '/' . MailTemplateService::CONFIG_PATH;
}
......@@ -84,12 +89,15 @@ class FormManagerController extends \TYPO3\CMS\Form\Controller\FormManagerContro
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/
private function clearCaches() {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$cacheManager = $objectManager->get(CacheManager::class);
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '10.4.0', '<')) {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var CacheManager $cacheManager */
$cacheManager = $objectManager->get(CacheManager::class);
} else {
$cacheManager = GeneralUtility::makeInstance(CacheManager::class);
}
/** @var FrontendInterface $cache */
$cache = $cacheManager->getCache(MailTemplateService::CACHE_NAME);
/** @var FrontendInterface $cache */
$cache->flush();
}
}
<?php
return [
'sg_mail:sendMail' => [
'class' => \SGalinski\SgMail\Command\SendMailCommandController::class
]
];
services:
_defaults:
autowire: true
autoconfigure: true
public: false
SGalinski\SgMail\:
resource: '../Classes/*'
SGalinski\SgMail\Domain\Repository\FrontendUserGroupRepository:
public: true
SGalinski\SgMail\Domain\Repository\LayoutRepository:
public: true
SGalinski\SgMail\Domain\Repository\MailRepository:
public: true
SGalinski\SgMail\Domain\Repository\TemplateRepository:
public: true
......@@ -24,7 +24,7 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
return [
$columns = [
'ctrl' => [
'title' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang_db.xlf:tx_sgmail_domain_model_layout',
'label' => 'name',
......@@ -44,9 +44,7 @@ return [
'hideTable' => TRUE,
'iconfile' => 'EXT:sg_mail/Resources/Public/Icons/ModuleIconTCA.svg'
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, name, head_content, content, default'
],
'interface' => [],
'types' => [
'1' => [
'showitem' => 'hidden, --palette--;;name, head_content, content, '
......@@ -87,7 +85,6 @@ return [
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => true,
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
......@@ -143,3 +140,8 @@ return [
],
]
];
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '10.3.0', '<')) {
$columns['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, name, head_content, content, default';
}
return $columns;
......@@ -24,7 +24,7 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
return [
$columns = [
'ctrl' => [
'title' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang_db.xlf:tx_sgmail_domain_model_mail',
'label' => 'mail_subject',
......@@ -41,9 +41,7 @@ return [
'default_sortby' => 'ORDER BY priority DESC',
'iconfile' => 'EXT:sg_mail/Resources/Public/Icons/ModuleIconTCA.svg'
],
'interface' => [
'showRecordFieldList' => 'hidden, blacklisted, mail_subject, mail_body, to_address, from_address, priority, from_name, bcc_addresses, cc_addresses, extension_key, template_name, sending_time, last_sending_time, language',
],
'interface' => [],
'types' => [
'1' => [
'showitem' => 'hidden;;1, blacklisted, priority, to_address, from_address, mail_subject, mail_body, from_name, bcc_addresses, cc_addresses, extension_key, template_name, sending_time, last_sending_time, language, attachments'
......@@ -199,3 +197,8 @@ return [
]
]
];
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '10.3.0', '<')) {
$columns['interface']['showRecordFieldList'] = 'hidden, blacklisted, mail_subject, mail_body, to_address, from_address, priority, from_name, bcc_addresses, cc_addresses, extension_key, template_name, sending_time, last_sending_time, language';
}
return $columns;
......@@ -24,7 +24,7 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
return [
$columns = [
'ctrl' => [
'title' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang_db.xlf:tx_sgmail_domain_model_template',
'label' => 'extension_key',
......@@ -42,9 +42,7 @@ return [
'default_sortby' => 'ORDER BY extension_key ASC, template_name ASC',
'iconfile' => 'EXT:sg_mail/Resources/Public/Icons/ModuleIconTCA.svg'
],
'interface' => [
'showRecordFieldList' => 'layout, extension_key, template_name, language, content, subject, fromName, fromMail, cc, bcc, replyTo, to_address'
],
'interface' => [],
'types' => [
'1' => [
'showitem' => 'hidden;;1, extension_key, template_name, language, content, subject, fromName, fromMail, cc, bcc, replyTo, to_address'
......@@ -157,3 +155,8 @@ return [
]
]
];
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '10.3.0', '<')) {
$columns['interface']['showRecordFieldList'] = 'layout, extension_key, template_name, language, content, subject, fromName, fromMail, cc, bcc, replyTo, to_address';
}
return $columns;
......@@ -8,7 +8,7 @@ Repository: https://gitlab.sgalinski.de/typo3/sg_mail
Please report bugs here: https://gitlab.sgalinski.de/typo3/sg_mail
TYPO3 version: >7.6
TYPO3 version: >9.5
## About
......@@ -116,7 +116,7 @@ Example:
// get an instance of the service
/** @var MailTemplateService $mailService */
$mailService = $this->objectManager->get(MailTemplateService::class, 'confirm_mail', 'sg_example', ['username' => $username]);
$mailService = GeneralUtility::makeInstance(MailTemplateService::class, 'confirm_mail', 'sg_example', ['username' => $username]);
$mailService->setFromName($this->settings['fromName']);
$mailService->setFromAddress($this->settings['fromEmail']);
......@@ -283,9 +283,6 @@ Sends your mail or adds it to the mailing queue, depending on the settings. You
###### function sendMailFromQueue
Forces the sending of an E-Mail from within the queue. If it has already been sent, it gets send again.
###### function addAttachment
With this function you can add attachments to your mail. The attachment must be of type *Swift_OutputByteStream*. You must also specify the content-type of the attachment.
###### function getMailMessage
You can get the instance of **\TYPO3\CMS\Core\Mail\MailMessage** that is internally used by the service, if you want a more direct interaction with the mail object.
......@@ -329,4 +326,3 @@ You can customize the TypoScript settings in the **setup.ts** in order to have c
This Service enables you to access your typoscript settings outside of your controller classes. You simply need to supply your page id and the extension key.
If you have no page id specific settings, set the page id to 0.
......@@ -11,7 +11,7 @@
<f:render
partial="Module/DocHeader"
section="main"
arguments="{docHeader: docHeader, pages: pages, selectedTemplateKey: selectedTemplateKey, selectedExtensionKey: selectedExtensionKey,typo3Version: typo3Version}" />
arguments="{docHeader: docHeader, pages: pages, selectedTemplateKey: selectedTemplateKey, selectedExtensionKey: selectedExtensionKey}" />
<f:if condition="{pages}">
<f:then></f:then>
<f:else>
......
......@@ -19,7 +19,7 @@
<f:render
partial="Module/DocHeader"
section="main"
arguments="{docHeader: docHeader, pages: pages, selectedTemplateKey: selectedTemplateKey, selectedExtensionKey: selectedExtensionKey,typo3Version: typo3Version}" />
arguments="{docHeader: docHeader, pages: pages, selectedTemplateKey: selectedTemplateKey, selectedExtensionKey: selectedExtensionKey}" />
<f:if condition="{pages}">
<f:then></f:then>
<f:else>
......
......@@ -37,21 +37,14 @@
<f:render
partial="Module/DocHeader"
section="path"
arguments="{docHeader: docHeader, typo3Version: typo3Version}" />
arguments="{docHeader: docHeader}" />
</div>
</f:section>
<f:section name="path">
<div class="module-docheader-bar-column-right">
<span class="typo3-docheader-pagePath">
<f:if condition="{typo3Version} < 9000000">
<f:then>
<f:translate key="LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw>
</f:then>
<f:else>
<f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw>
</f:else>
</f:if>
<f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw>
</span>
<f:format.raw>{docHeader.metaInformation.recordInformation}</f:format.raw>
</div>
......
## Version 6 Breaking Changes
- Dropped TYPO3 8 support
- set ignoreMailQueue to TRUE by default
......@@ -6,7 +6,7 @@
"license": [
"GPL-2.0-or-later"
],
"version": "5.7.11",
"version": "6.0.0-dev",
"repositories": [
{
"type": "composer",
......@@ -14,8 +14,7 @@
}
],
"require": {
"php": "^7.0",
"typo3/cms-core": "^8.7.0 || ^9.5.1"
"typo3/cms-core": "^9.5.1 || ^10.4.0"
},
"require-dev": {
"roave/security-advisories": "dev-master"
......
......@@ -8,8 +8,8 @@ $EM_CONF['sg_mail'] = [
'title' => 'Mail Templates',
'description' => 'Mail Templates',
'category' => 'module',
'version' => '5.7.11',
'state' => 'stable',
'version' => '6.0.0-dev',
'state' => 'experimental',
'uploadfolder' => FALSE,
'createDirs' => '',
'clearcacheonload' => FALSE,
......@@ -18,8 +18,8 @@ $EM_CONF['sg_mail'] = [
'author_company' => 'sgalinski Internet Services (https://www.sgalinski.de)',
'constraints' => [
'depends' => [
'typo3' => '8.7.0-9.5.99',
'php' => '7.0.0-',
'typo3' => '9.5.0-10.4.99',
'php' => '7.3.0-7.4.99',
],
'conflicts' => [
],
......
......@@ -25,20 +25,16 @@
call_user_func(
function ($extKey) {
// register command controllers
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] =
\SGalinski\SgMail\Command\SendMailCommandController::class;
// add upgrade wizard for moving all db entries to their respected siteroot
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['tx_sgmail_update_pid_to_site_root'] = \SGalinski\SgMail\Updates\UpdatePidToSiteRoot::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['tx_sgmail_update_sending_times'] = \SGalinski\SgMail\Updates\UpdateSendingTimes::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['tx_sgmail_update_languages'] = \SGalinski\SgMail\Updates\UpdateLanguages::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['tx_sgmail_update_german_as_default'] = \SGalinski\SgMail\Updates\UpdateGermanAsDefault::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgMail\Updates\UpdatePidToSiteRoot::IDENTIFIER] = \SGalinski\SgMail\Updates\UpdatePidToSiteRoot::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgMail\Updates\UpdateSendingTimes::IDENTIFIER] = \SGalinski\SgMail\Updates\UpdateSendingTimes::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgMail\Updates\UpdateLanguages::IDENTIFIER] = \SGalinski\SgMail\Updates\UpdateLanguages::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgMail\Updates\UpdateGermanAsDefault::IDENTIFIER] = \SGalinski\SgMail\Updates\UpdateGermanAsDefault::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgMail\Updates\MigrateSchedulerTasks::IDENTIFIER] = \SGalinski\SgMail\Updates\MigrateSchedulerTasks::class;
if (TYPO3_MODE === 'BE') {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $extKey . '/Configuration/TypoScript/setup.typoscript">'
'@import "EXT:' . $extKey . '/Configuration/TypoScript/setup.typoscript"'
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment