Skip to content
Snippets Groups Projects
Commit 506e6e53 authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[TASK] Use Environment API in scheduler

Resolves: #85279
Releases: master
Change-Id: I2d63540be1883fb2faea763d72a875800eae1cfa
Reviewed-on: https://review.typo3.org/57236


Reviewed-by: default avatarJan Helke <typo3@helke.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Tested-by: default avatarJan Helke <typo3@helke.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent f1ae421d
Branches
Tags
No related merge requests found
......@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Scheduler\Example;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -43,7 +44,7 @@ class TestTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
// Get execution information
$exec = $this->getExecution();
// Get call method
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
if (Environment::isCli()) {
$calledBy = 'CLI module dispatcher';
$site = '-';
} else {
......
......@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Scheduler\Task;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -437,11 +438,6 @@ abstract class AbstractTask implements LoggerAwareInterface
// (we need to know that number, because it is returned at the end of the method)
$numExecutions = count($runningExecutions);
$runningExecutions[$numExecutions] = time();
// Define the context in which the script is running
$context = 'BE';
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
$context = 'CLI';
}
GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_scheduler_task')
->update(
......@@ -449,7 +445,8 @@ abstract class AbstractTask implements LoggerAwareInterface
[
'serialized_executions' => serialize($runningExecutions),
'lastexecution_time' => time(),
'lastexecution_context' => $context
// Define the context in which the script is running
'lastexecution_context' => Environment::isCli() ? 'CLI' : 'BE'
],
[
'uid' => $this->taskUid
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment