Skip to content

Commit

Permalink
Merge branch '11.x' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Neyman committed Jul 8, 2023
2 parents 4163c22 + 4491666 commit 56ec8c3
Show file tree
Hide file tree
Showing 114 changed files with 6,840 additions and 5,189 deletions.
522 changes: 257 additions & 265 deletions Classes/Command/AnalyzeBounceMailCommand.php

Large diffs are not rendered by default.

79 changes: 40 additions & 39 deletions Classes/Command/DirectmailCommand.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
<?php
namespace DirectMailTeam\DirectMail\Command;

use DirectMailTeam\DirectMail\Dmailer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class DirectmailCommand extends Command
{
/**
* Configure the command by defining the name, options and arguments
*/
public function configure()
{
$this->setDescription('This command invokes dmailer in order to process queued messages.');
//$this->setHelp('');
}

/**
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title($this->getDescription());
/**
* The direct_mail engine
* @var $htmlmail Dmailer
*/
$htmlmail = GeneralUtility::makeInstance(Dmailer::class);
$htmlmail->start();
$htmlmail->runcron();
return Command::SUCCESS;
}
}
<?php

namespace DirectMailTeam\DirectMail\Command;

use DirectMailTeam\DirectMail\Dmailer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class DirectmailCommand extends Command
{
/**
* Configure the command by defining the name, options and arguments
*/
public function configure()
{
$this->setDescription('This command invokes dmailer in order to process queued messages.');
//$this->setHelp('');
}

/**
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title($this->getDescription());
/**
* The direct_mail engine
* @var $htmlmail Dmailer
*/
$htmlmail = GeneralUtility::makeInstance(Dmailer::class);
$htmlmail->start();
$htmlmail->runcron();
return Command::SUCCESS;
}
}
15 changes: 6 additions & 9 deletions Classes/Command/InvokeMailerEngineCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace DirectMailTeam\DirectMail\Command;

/*
Expand All @@ -24,22 +25,19 @@

/**
* Class InvokeMailerEngineCommand
*
*
* Starts sending the newsletter by invoking mailer engine via CLI
*
* Use TYPO3 CLI module dispatcher with `direct_mail:invokemailerengine`
*
*
* This class replaces the earlier version of EXT:direct_mail/cli/cli_direct_mail.php from Ivan Kartolo, (c) 2008
* Executes the earlier solely option named 'masssend' which has been dropped as optional argument
*
* @package TYPO3
* @subpackage tx_directmail
* @author 2019 J.Kummer
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 2
*/
class InvokeMailerEngineCommand extends Command
{

/**
* Configure the command by defining the name, options and arguments
*/
Expand All @@ -64,18 +62,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io = new SymfonyStyle($input, $output);
$io->title($this->getDescription());
$lockfile = Environment::getPublicPath() . '/typo3temp/tx_directmail_cron.lock';

// Check if cronjob is already running:
if (@file_exists($lockfile)) {
// If the lock is not older than 1 day, skip:
if (filemtime($lockfile) > (time() - (60 * 60 * 24))) {
$io->warning('TYPO3 Direct Mail Cron: Aborting, another process is already running!');
return Command::FAILURE;
} else {
$io->writeln('TYPO3 Direct Mail Cron: A .lock file was found but it is older than 1 day! Processing mails ...');
}
$io->writeln('TYPO3 Direct Mail Cron: A .lock file was found but it is older than 1 day! Processing mails ...');
}

touch($lockfile);
// Fixing filepermissions
GeneralUtility::fixPermissions($lockfile);
Expand Down
14 changes: 6 additions & 8 deletions Classes/Container.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace DirectMailTeam\DirectMail;

/*
Expand Down Expand Up @@ -26,9 +27,6 @@
*
* @author Kasper Skårhøj <kasperYYYY>@typo3.com>
* @author Thorsten Kahler <[email protected]>
*
* @package TYPO3
* @subpackage tx_directmail
*/
class Container
{
Expand All @@ -39,17 +37,17 @@ class Container
* @var TypoScriptFrontendController
*/
protected $cObj;

/**
* https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Deprecation-94956-PublicCObj.html
*
*
* @param ContentObjectRenderer $cObj
*/
public function setContentObjectRenderer(ContentObjectRenderer $cObj): void
{
$this->cObj = $cObj;
}

/**
* This function wraps HTML comments around the content.
* The comments contain the uids of assigned direct mail categories.
Expand All @@ -71,7 +69,7 @@ public function insert_dMailer_boundaries($content, $conf = [])
if ($content != '') {
// setting the default
$categoryList = '';
if (intval($this->cObj->data['module_sys_dmail_category']) >= 1) {
if ((int)$this->cObj->data['module_sys_dmail_category'] >= 1) {
// if content type "RECORDS" we have to strip off
// boundaries from indcluded records
if ($this->cObj->data['CType'] == 'shortcut') {
Expand Down Expand Up @@ -122,7 +120,7 @@ public function stripInnerBoundaries($content)
public function breakLines($content, array $conf)
{
$linebreak = $GLOBALS['TSFE']->cObj->stdWrap(($conf['linebreak'] ? $conf['linebreak'] : chr(32) . LF), $conf['linebreak.']);
$charWidth = $GLOBALS['TSFE']->cObj->stdWrap(($conf['charWidth'] ? intval($conf['charWidth']) : 76), $conf['charWidth.']);
$charWidth = $GLOBALS['TSFE']->cObj->stdWrap(($conf['charWidth'] ? (int)$conf['charWidth'] : 76), $conf['charWidth.']);

return MailUtility::breakLinesForEmail($content, $linebreak, $charWidth);
}
Expand Down
Loading

0 comments on commit 56ec8c3

Please sign in to comment.