Skip to content

Commit

Permalink
Merge pull request #51 from pluswerk/typo3-12
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanti authored Sep 22, 2023
2 parents 979ea8b + 02a3cd7 commit 992806e
Show file tree
Hide file tree
Showing 54 changed files with 693 additions and 1,084 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,16 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1' ]
typo3: [ '10', '11' ]
exclude:
- php: '7.2'
typo3: '11'
- php: '7.3'
typo3: '11'

- php: '8.0'
typo3: '10'
- php: '8.1'
typo3: '10'
php: [ '8.1', '8.2' ]
typo3: [ '11', '12' ]
steps:
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- uses: mirromutth/[email protected]
with:
mysql version: '5.7'
mysql version: '8.0'
mysql database: 'typo3_test'
mysql root password: 'root'
- uses: actions/checkout@v2
Expand Down Expand Up @@ -64,7 +54,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'
extensions: intl, mbstring, xml, soap, zip, curl

- name: Install typo3/tailor
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/.Build/
/composer.lock
/vendor/
var/
public/
27 changes: 12 additions & 15 deletions Classes/Command/TestMailCommand.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
<?php

/***
*
* This file is part of an "+Pluswerk AG" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Felix König <[email protected]>, +Pluswerk AG
*
***/

declare(strict_types=1);

namespace Pluswerk\MailLogger\Command;
Expand All @@ -20,13 +9,13 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Mail\MailerInterface;
use TYPO3\CMS\Core\Mail\MailMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;

class TestMailCommand extends Command
{
protected function configure()
protected function configure(): void
{
$this
->setDescription('Sends a test mail.')
Expand All @@ -44,12 +33,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($args['templatekey'] !== '') {
$mail = MailUtility::getMailByKey($args['templatekey'], null);
} else {
$mail = GeneralUtility::makeInstance(ObjectManager::class)->get(MailMessage::class);
$mail = GeneralUtility::makeInstance(MailMessage::class);
$mail
->setSubject('Testmail')
->html(str_pad('This is a testmail (html).', (int)$input->getOption('textLength'), '_ '));
}

$mail->addTo($args['addressto']);
return $mail->send() ? 0 : 1;

if ($mail->send()) {
$output->writeln('Successfully send mail');
return 0;
}

$output->writeln('<error>Error on send</error>');
return 1;
}
}
51 changes: 20 additions & 31 deletions Classes/Controller/MailLogController.php
Original file line number Diff line number Diff line change
@@ -1,64 +1,53 @@
<?php

/***
*
* This file is part of an "+Pluswerk AG" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2018 Markus Hölzle <[email protected]>, +Pluswerk AG
*
***/

declare(strict_types=1);

namespace Pluswerk\MailLogger\Controller;

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Page\PageRenderer;
use Pluswerk\MailLogger\Domain\Model\MailLog;
use Pluswerk\MailLogger\Domain\Repository\MailLogRepository;
use TYPO3\CMS\Core\Pagination\SimplePagination;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Pagination\QueryResultPaginator;

/**
*/
class MailLogController extends ActionController
{
/**
* @var \Pluswerk\MailLogger\Domain\Repository\MailLogRepository
*/
protected $mailLogRepository;

public function injectMailLogRepository(MailLogRepository $mailLogRepository): void
{
$this->mailLogRepository = $mailLogRepository;
public function __construct(
private readonly MailLogRepository $mailLogRepository,
private readonly ModuleTemplateFactory $moduleTemplateFactory,
) {
}

/**
* action dashboard
*
* @return void
*/
public function dashboardAction(): void
public function dashboardAction(): ResponseInterface
{
$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
// Add required js files.
$pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class);
$pageRenderer->loadRequireJsModule('TYPO3/CMS/MailLogger/MailLogController');
$pageRenderer->loadRequireJsModule('TYPO3/CMS/MailLogger/DashboardController');
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
assert($pageRenderer instanceof PageRenderer);
$pageRenderer->loadRequireJsModule('TYPO3/CMS/MailLogger/Main');

// Assign all logged mails to template.
$this->view->assign('mailLogs', $this->mailLogRepository->findAll());

$moduleTemplate->setContent($this->view->render());
return $this->htmlResponse($moduleTemplate->renderContent());
}

/**
* action show
*
* @param \Pluswerk\MailLogger\Domain\Model\MailLog $mailLog
* @return void
*/
public function showAction(MailLog $mailLog): void
public function showAction(MailLog $mailLog): ResponseInterface
{
$this->view->assign('mailLog', $mailLog);

return $this->htmlResponse();
}
}
26 changes: 3 additions & 23 deletions Classes/Domain/Model/AbstractModel.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
<?php

/***
*
* This file is part of an "+Pluswerk AG" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2018 Markus Hölzle <[email protected]>, +Pluswerk AG
*
***/

declare(strict_types=1);

namespace Pluswerk\MailLogger\Domain\Model;

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

/**
* Class AbstractModel
*/
abstract class AbstractModel extends AbstractEntity
{
/**
* @var int|null
*/
protected $tstamp = 0;

/**
* @var int|null
*/
protected $crdate = 0;
protected int|null $tstamp = 0;

protected int|null $crdate = 0;

public function getTstamp(): ?int
{
Expand Down
12 changes: 0 additions & 12 deletions Classes/Domain/Model/DebuggableMailMessage.php

This file was deleted.

10 changes: 0 additions & 10 deletions Classes/Domain/Model/LoggableMailMessage.php

This file was deleted.

63 changes: 14 additions & 49 deletions Classes/Domain/Model/MailLog.php
Original file line number Diff line number Diff line change
@@ -1,83 +1,47 @@
<?php

/***
*
* This file is part of an "+Pluswerk AG" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2018 Markus Hölzle <[email protected]>, +Pluswerk AG
*
***/

declare(strict_types=1);

namespace Pluswerk\MailLogger\Domain\Model;

/**
* Class MailLog
*/
class MailLog extends AbstractModel
{
const MEBI_BYTE = 1048576;
/**
* @var string
* @var int
*/
protected $typoScriptKey = '';
final public const MEBI_BYTE = 1048576;

/**
* @var string
*/
protected $subject = '';
protected string $typoScriptKey = '';

/**
* @var string
*/
protected $message = '';
protected string $subject = '';

protected string $message = '';

/**
* json encoded
*
* @var string
*/
protected $mailFrom = '';
protected string $mailFrom = '';

/**
* json encoded
*
* @var string
*/
protected $mailTo = '';
protected string $mailTo = '';

/**
* json encoded
*
* @var string
*/
protected $mailCopy = '';
protected string $mailCopy = '';

/**
* json encoded
*
* @var string
*/
protected $mailBlindCopy = '';
protected string $mailBlindCopy = '';

/**
* @var string
*/
protected $headers = '';
protected string $headers = '';

/**
* @var string
*/
protected $result = 'Not send until now';
protected string $result = 'Not send until now';

/**
* @var int
*/
protected $sysLanguageUid = 0;
protected int $sysLanguageUid = 0;

public function getTypoScriptKey(): string
{
Expand Down Expand Up @@ -113,6 +77,7 @@ public function setMessage(string $message): self
$this->message = substr($this->message, 0, self::MEBI_BYTE);
$this->message .= ' (... message trimmed ...)';
}

return $this;
}

Expand Down
Loading

0 comments on commit 992806e

Please sign in to comment.