Skip to content

Commit

Permalink
Merge branch 'release/27.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Dec 8, 2024
2 parents b9e8f3c + 9dd6b61 commit 2e7f7f7
Show file tree
Hide file tree
Showing 88 changed files with 1,340 additions and 1,495 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TYPO3_CACHE_DIR=var

SQLDUMPSDIR=.project/data/
SQLDUMPFILE=db.sql.gz
SQLPORT=53844
SQLPORT=53845

# Service names from docker-compose.yml to include in URL generation make target. Delimited by \|
SERVICELIST=mail
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
php-lint:
name: "PHP linter"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand All @@ -20,12 +20,12 @@ jobs:
fail-fast: false
matrix:
php-version:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
typoscript-lint:
name: "TypoScript linter"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand All @@ -36,7 +36,7 @@ jobs:
config_file: ".project/tests/typoscript-lint.yml"
php-cs-fixer:
name: "PHP CS Fixer"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: php-lint
steps:
- name: "Checkout"
Expand All @@ -51,7 +51,7 @@ jobs:
run: "composer test:php:cs"
unit-tests:
name: "PHP Unit Tests"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: php-lint
steps:
- name: Checkout
Expand All @@ -70,5 +70,5 @@ jobs:
fail-fast: false
matrix:
php-version:
- 8.1
- 8.2
- 8.3
49 changes: 49 additions & 0 deletions .project/TYPO3/additional.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,38 @@
],
],
],
'EXTENSIONS' => [
'lux' => [
'anonymizeIp' => '1',
'categoryScoringAddDownload' => '20',
'categoryScoringAddNewsVisit' => '10',
'categoryScoringAddPageVisit' => '10',
'categoryScoringLinkListenerClick' => '20',
'disableAnalysisModule' => '0',
'disableCkEditorConfiguration' => '0',
'disableIpLogging' => '0',
'disableLeadModule' => '0',
'disablePageOverview' => '0',
'disableWorkflowModule' => '0',
'enableExceptionLogging' => '1',
'leadImageFromExternalSources' => 'all',
'pageOverviewView' => 'analysis',
'scoringCalculation' => '(10 * numberOfSiteVisits) + (1 * numberOfPageVisits) + (20 * downloads) - (1 * lastVisitDaysAgo)',
'showRenderTimes' => '1',
'useCacheLayer' => '0',
],
'luxletter' => [
'addTypeNumToNumberLocation' => '1562349004',
'addUnsubscribeUrlToMailHeader' => '1',
'asynchronousQueueStorage' => '0',
'embedImagesInNewsletter' => '1',
'limitToContext' => '',
'multiLanguageMode' => '1',
'multiLanguageNewsletterPageDoktype' => '11',
'receiverAction' => '1',
'rewriteLinksInNewsletter' => '1',
],
],
'FE' => [
'cacheHash' => [
'enforceValidation' => true,
Expand All @@ -38,6 +70,7 @@
'msclkid',
],
],
'passwordPolicy' => 'simpleLuxletter',
],
'GFX' => [
'colorspace' => 'sRGB',
Expand Down Expand Up @@ -70,3 +103,19 @@
]
];
$GLOBALS['TYPO3_CONF_VARS'] = array_replace_recursive($GLOBALS['TYPO3_CONF_VARS'], $additional);

$GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies'] = [
'simpleLuxletter' => [
'validators' => [
\TYPO3\CMS\Core\PasswordPolicy\Validator\CorePasswordValidator::class => [
'options' => [
'minimumLength' => 3,
'upperCaseCharacterRequired' => false,
'lowerCaseCharacterRequired' => false,
'digitCharacterRequired' => false,
'specialCharacterRequired' => false,
],
],
],
],
];
Binary file modified .project/data/db.sql.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion .project/docker/docker-compose.darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
- host.docker.internal:host-gateway

mysql:
image: in2code/mysql:5.7
image: in2code/mysql:8.0
env_file:
- .env
volumes:
Expand Down
2 changes: 1 addition & 1 deletion .project/docker/docker-compose.unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
- .env

mysql:
image: in2code/mysql:5.7
image: in2code/mysql:8.0
env_file:
- .env
volumes:
Expand Down
2 changes: 1 addition & 1 deletion .project/docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM in2code/php-dev:8.1-fpm
FROM in2code/php-dev:8.2-fpm

COPY zz_xdebug.ini /usr/local/etc/php/conf.d/zz_xdebug.ini
17 changes: 12 additions & 5 deletions Classes/Backend/Buttons/NavigationGroupButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ public function render()

protected function prepend(): string
{
$icon = $this->iconFactory->getIcon('extension-lux');
return $icon->render();
return '
<span class="t3js-icon icon icon-size-medium icon-state-default icon-extension-lux" data-identifier="extension-lux" aria-hidden="true">
<span class="icon-markup">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 70.9 70.9" style="enable-background:new 0 0 70.9 70.9;" xml:space="preserve">
<path d="M27.4,2.7c0,0-2.4,6.7,0.9,9.3s4.8,7.1,4.3,9.1c0,0,12.7-0.5,16.4,7.7c0,0-0.2,1.3,7.7,4.7c0,0,2.7,0.9-2.4,6.9 c0,0,0.8,1.7-2.8,2.9c0,0,0.8,4.4-3.9,3.6c-4.7-0.8-11.1-3.8-6.9,3.3c0,0,7.9,7.8,6.4,14.6c0,0-4.9-12.4-20.5-14.1 c0,0,14,3.2,19.1,17.4c0,0-2.8-5.7-15.2-9.1c0,0,3.6,1.3,4.9,5.4c0,0-1-1.9-12.4-5.2s-9.6-14.8-9-17.1c0.9-3.5,3.5-12.4,8.9-17.2 c0,0-3.1-2.7,2.1-13.5C24.9,11.5,24.1,6.7,27.4,2.7z" fill="currentColor"></path>
</svg>
</span>
</span>
';
}

protected function append(string $content): string
Expand All @@ -65,13 +72,13 @@ protected function append(string $content): string

$icon = $this->iconFactory->getIcon('extension-luxletter-star', Icon::SIZE_SMALL);
$content .= '<div style="padding-top: 5px;">';
$content .= '<a href="https://www.in2code.de/produkte/lux-typo3-marketing-automation/?utm_campaign=LUXletter+Community+Version&utm_id=llcv&utm_source=typo3&utm_medium=browser&utm_content=go+enterprise" class="lux_poweredby" style="color:black; font-weight: bold;" target="_blank" rel="noopener">';
$content .= '<a href="https://www.in2code.de/produkte/lux-typo3-marketing-automation/?utm_campaign=LUXletter+Community+Version&utm_id=llcv&utm_source=typo3&utm_medium=browser&utm_content=go+enterprise" class="lux_poweredby" style="color: currentcolor; font-weight: bold;" target="_blank" rel="noopener">';
$content .= $icon->render();
$content .= 'Go enterprise</a></div>';
$content .= ' Go enterprise</a></div>';
return $content;
}

public function __toString()
public function __toString(): string
{
return $this->render();
}
Expand Down
3 changes: 3 additions & 0 deletions Classes/Command/BuildQueueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@

class BuildQueueCommand extends Command
{
use FakeRequestTrait;

public function configure()
{
$this->setDescription('Build a queue to a newsletter. Normally used together with "asynchronousQueueStorage"');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->fakeRequest();
$newsletterRepository = GeneralUtility::makeInstance(NewsletterRepository::class);
$newsletter = $newsletterRepository->findOneNotQueued();

Expand Down
2 changes: 2 additions & 0 deletions Classes/Command/CreateNewsletterFromOriginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function configure()
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->fakeRequest();
/** @var NewsletterFactory $newsletterFactory */
$newsletterFactory = GeneralUtility::makeInstance(NewsletterFactory::class);
$newsletter = $newsletterFactory->get(
$input->getArgument('title'),
Expand All @@ -69,6 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Newsletter with uid ' . $newsletter->getUid() . ' created');

if (ConfigurationUtility::isAsynchronousQueueStorageActivated() === false) {
/** @var QueueService $queueService */
$queueService = GeneralUtility::makeInstance(QueueService::class);
$queuedAmount = $queueService->addMailReceiversToQueue($newsletter, (int)$input->getArgument('language'));
$output->writeln('Added ' . $queuedAmount . ' queue records');
Expand Down
4 changes: 2 additions & 2 deletions Classes/Command/FakeRequestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use TYPO3\CMS\Core\Http\ServerRequest;

/**
* For whatever reason it seems not possible to create an instance of an extbase repository in a symfony command
* in TYPO3 12. So now we have to fake a request.
* It is not possible to create an instance of an extbase repository in a symfony command anymore in TYPO3 12 or newer
* So we have to fake a request, to get this running again.
*/
trait FakeRequestTrait
{
Expand Down
50 changes: 14 additions & 36 deletions Classes/Controller/AbstractNewsletterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,54 +30,33 @@ abstract class AbstractNewsletterController extends ActionController
protected string $wizardUserPreviewFile =
'EXT:luxletter/Resources/Private/Templates/Newsletter/WizardUserPreview.html';
protected string $receiverDetailFile = 'EXT:luxletter/Resources/Private/Templates/Newsletter/ReceiverDetail.html';

protected ModuleTemplateFactory $moduleTemplateFactory;
protected IconFactory $iconFactory;
protected ModuleTemplate $moduleTemplate;
protected NewsletterRepository $newsletterRepository;
protected UserRepository $userRepository;
protected UsergroupRepository $usergroupRepository;
protected LogRepository $logRepository;
protected ConfigurationRepository $configurationRepository;
protected PageRepository $pageRepository;
protected LayoutService $layoutService;
protected CategoryRepository $categoryRepository;

public function __construct(
ModuleTemplateFactory $moduleTemplateFactory,
IconFactory $iconFactory,
NewsletterRepository $newsletterRepository,
UserRepository $userRepository,
UsergroupRepository $usergroupRepository,
LogRepository $logRepository,
ConfigurationRepository $configurationRepository,
PageRepository $pageRepository,
LayoutService $layoutService,
CategoryRepository $categoryRepository
readonly protected ModuleTemplateFactory $moduleTemplateFactory,
readonly protected IconFactory $iconFactory,
readonly protected NewsletterRepository $newsletterRepository,
readonly protected UserRepository $userRepository,
readonly protected UsergroupRepository $usergroupRepository,
readonly protected LogRepository $logRepository,
readonly protected ConfigurationRepository $configurationRepository,
readonly protected PageRepository $pageRepository,
readonly protected LayoutService $layoutService,
readonly protected CategoryRepository $categoryRepository
) {
$this->moduleTemplateFactory = $moduleTemplateFactory;
$this->iconFactory = $iconFactory;
$this->newsletterRepository = $newsletterRepository;
$this->userRepository = $userRepository;
$this->usergroupRepository = $usergroupRepository;
$this->logRepository = $logRepository;
$this->configurationRepository = $configurationRepository;
$this->pageRepository = $pageRepository;
$this->layoutService = $layoutService;
$this->categoryRepository = $categoryRepository;
}

public function initializeView($view)
public function initializeView()
{
$this->view->assignMultiple([
$this->moduleTemplate->assignMultiple([
'view' => [
'controller' => $this->getControllerName(),
'action' => $this->getActionName(),
],
]);
}

public function initializeAction()
public function initializeAction(): void
{
$this->moduleTemplate = $this->moduleTemplateFactory->create($this->request);
}
Expand Down Expand Up @@ -163,8 +142,7 @@ protected function getActionName(): string

protected function defaultRendering(): ResponseInterface
{
$this->moduleTemplate->setContent($this->view->render());
return $this->htmlResponse($this->moduleTemplate->renderContent());
return $this->moduleTemplate->renderResponse($this->getControllerName() . '/' . ucfirst($this->getActionName()));
}

protected function addDocumentHeader(array $configuration): void
Expand Down
43 changes: 11 additions & 32 deletions Classes/Controller/FrontendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
declare(strict_types=1);
namespace In2code\Luxletter\Controller;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Exception as ExceptionDbalDriver;
use Doctrine\DBAL\Exception as ExceptionDbal;
use Exception;
use In2code\Luxletter\Domain\Factory\UsergroupFactory;
use In2code\Luxletter\Domain\Model\Newsletter;
Expand All @@ -31,41 +30,27 @@
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;

class FrontendController extends ActionController
{
protected ?UserRepository $userRepository;
protected UsergroupRepository $usergroupRepository;
protected ContentRepository $contentRepository;
protected LogService $logService;
protected UsergroupFactory $usergroupFactory;

public function __construct(
UserRepository $userRepository,
UsergroupRepository $usergroupRepository,
ContentRepository $contentRepository,
LogService $logService,
UsergroupFactory $usergroupFactory
readonly protected UserRepository $userRepository,
readonly protected UsergroupRepository $usergroupRepository,
readonly protected ContentRepository $contentRepository,
readonly protected LogService $logService,
readonly protected UsergroupFactory $usergroupFactory
) {
$this->userRepository = $userRepository;
$this->usergroupRepository = $usergroupRepository;
$this->contentRepository = $contentRepository;
$this->logService = $logService;
$this->usergroupFactory = $usergroupFactory;
}

/**
* @param \TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view (Todo: Param is only needed in TYPO3 11)
* @return void
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
*/
public function initializeView($view)
public function initializeView()
{
$contentObject = $this->configurationManager->getContentObject();
$this->view->assignMultiple([
'data' => $contentObject->data,
'data' => $this->request->getAttribute('currentContentObject')->data,
'extensionConfiguration' => GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('luxletter'),
]);
}
Expand Down Expand Up @@ -98,14 +83,12 @@ public function previewAction(string $origin, string $layout, int $language = 0)
* @param Newsletter|null $newsletter
* @param User|null $user
* @return ResponseInterface
* @throws IllegalObjectTypeException
* @throws ExceptionDbalDriver
* @throws DBALException
* @throws ExceptionDbal
*/
public function trackingPixelAction(Newsletter $newsletter = null, User $user = null): ResponseInterface
{
if ($newsletter !== null && $user !== null) {
$this->logService->logNewsletterOpening($newsletter, $user);
$this->logService->logNewsletterOpening($newsletter->getUid(), $user->getUid());
}
$content = base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==');
return $this->htmlResponse($content);
Expand Down Expand Up @@ -151,14 +134,10 @@ public function unsubscribeAction(
* Use same arguments as from default unsubscribe plugin
*
* @return void
* @throws ArgumentMissingException
* @throws AuthenticationFailedException
* @throws MisconfigurationException
* @throws UserValuesAreMissingException
*/
public function initializeUnsubscribe2Action(): void
{
$arguments = GeneralUtility::_GP('tx_luxletter_fe');
$arguments = $_REQUEST['tx_luxletter_fe'] ?? null;
if (is_array($arguments)) {
$this->request = $this->request->withArguments($arguments);
}
Expand Down
Loading

0 comments on commit 2e7f7f7

Please sign in to comment.