Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Create a fake TYPO3_REQUEST, as this throws errors through Cron job manager #503

Open
wants to merge 1 commit into
base: 12.x
Choose a base branch
from

Conversation

TimWilms
Copy link

This is (somewhat) related to: #401 Albeit this applies for V12, I am not sure if this is applicable for V11.

For us this change is essential to make DirectMail functional in V12, otherwise creating a mail from draft breaks whilst triggering this code through a cron job manager.

I am not too familiar with collaborating on open source projects yet, so if I am missing something in terms of describing the issue, please let me know.

…t running this through a cron job manager.
@martin-git-kristensen
Copy link

The changes will not work in typo3 v11 - but if you put the same code in direct_mail -> MainController.php in public function __construct it will work in typo3 v11 as well.

@Patta
Copy link
Contributor

Patta commented Oct 29, 2024

can not confirm that this change works. now i get another warning "No site found in root line of page 1" and the mail from draft is not created.

TYPO3 12.4.22
PHP 8.2.24
direct_mail 12.x 500a858

Tue, 29 Oct 2024 10:50:02 +0100 [WARNING] request="8727be573b39a" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (BE): PHP Warning: Undefined array key "HTTP_HOST" in /var/www/html/vendor/directmailteam/direct-mail/Classes/DirectMailUtility.php line 325 
Tue, 29 Oct 2024 10:50:02 +0100 [ERROR] request="8727be573b39a" component="TYPO3.CMS.Scheduler.Scheduler": Task failed to execute successfully. Class: DirectMailTeam\DirectMail\Scheduler\MailFromDraft, UID: 104, Code: 1521716622, "No site found in root line of page 1" in /var/www/html/vendor/typo3/cms-core/Classes/Site/SiteFinder.php at line 123- SiteNotFoundException: No site found in root line of page 1, in file /var/www/html/vendor/typo3/cms-core/Classes/Site/SiteFinder.php:123 - {"taskClass":"DirectMailTeam\\DirectMail\\Scheduler\\MailFromDraft","taskId":104,"exception":"TYPO3\\CMS\\Core\\Exception\\SiteNotFoundException: No site found in root line of page 1 in /var/www/html/vendor/typo3/cms-core/Classes/Site/SiteFinder.php:123\nStack trace:\n#0 /var/www/html/vendor/directmailteam/direct-mail/Classes/DirectMailUtility.php(108): TYPO3\\CMS\\Core\\Site\\SiteFinder->getSiteByPageId(1)\n#1 /var/www/html/vendor/directmailteam/direct-mail/Classes/DirectMailUtility.php(332): DirectMailTeam\\DirectMail\\DirectMailUtility::getTypolinkURL('7494')\n#2 /var/www/html/vendor/directmailteam/direct-mail/Classes/DirectMailUtility.php(144): DirectMailTeam\\DirectMail\\DirectMailUtility::getFullUrlsForDirectMailRecord(Array)\n#3 /var/www/html/vendor/directmailteam/direct-mail/Classes/Scheduler/MailFromDraft.php(105): DirectMailTeam\\DirectMail\\DirectMailUtility::fetchUrlContentsForDirectMailRecord(Array, Array, true)\n#4 /var/www/html/vendor/typo3/cms-scheduler/Classes/Scheduler.php(175): DirectMailTeam\\DirectMail\\Scheduler\\MailFromDraft->execute()\n#5 /var/www/html/vendor/typo3/cms-scheduler/Classes/Command/SchedulerCommand.php(241): TYPO3\\CMS\\Scheduler\\Scheduler->executeTask(Object(DirectMailTeam\\DirectMail\\Scheduler\\MailFromDraft))\n#6 /var/www/html/vendor/typo3/cms-scheduler/Classes/Command/SchedulerCommand.php(182): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->executeOrStopTask(Object(DirectMailTeam\\DirectMail\\Scheduler\\MailFromDraft))\n#7 /var/www/html/vendor/typo3/cms-scheduler/Classes/Command/SchedulerCommand.php(116): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->loopTasks()\n#8 /var/www/html/vendor/symfony/console/Command/Command.php(279): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#9 /var/www/html/vendor/symfony/console/Application.php(1047): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#10 /var/www/html/vendor/symfony/console/Application.php(316): Symfony\\Component\\Console\\Application->doRunCommand(Object(TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#11 /var/www/html/vendor/symfony/console/Application.php(167): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#12 /var/www/html/vendor/typo3/cms-core/Classes/Console/CommandApplication.php(112): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#13 /var/www/html/vendor/typo3/cms-cli/typo3(23): TYPO3\\CMS\\Core\\Console\\CommandApplication->run()\n#14 /var/www/html/vendor/typo3/cms-cli/typo3(24): {closure}()\n#15 /var/www/html/vendor/bin/typo3(119): include('/var/www/html/v...')\n#16 {main}","exceptionFile":"/var/www/html/vendor/typo3/cms-core/Classes/Site/SiteFinder.php","exceptionLine":123,"code":1521716622,"message":"No site found in root line of page 1"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants