[TYPO3-english] Find out if method is called from the scheduler
Bernhard Kraft
kraftb at kraftb.at
Fri Jan 9 18:34:32 CET 2015
Hi,
On 2015-01-06 13:24, Jennifer Koenig wrote:
> This no longer seems to work. I googled around but couldn't find
> anything. Does anyone have a trick?
I guess there are two ways:
1. Create an alternative implementation of
"TYPO3\CMS\Scheduler\Scheduler" and overwrite the method "executeTask".
Set some global variable before and after calling parent::executeTask().
2. In your code use "GeneralUtility::getSingletonInstances" and check if
"TYPO3\CMS\Scheduler\Scheduler" is already instanciated. If this is the
case it is most likely that the current code is getting executed by the
scheduler.
Version 1 uses an alternative implementation (XCLASS in 4.x times) and
depends on no other extension is doing the same.
Version 2 could yield wrong results if some piece of code is making an
instance of the scheduler while still not running any tasks.
I would implement version 1.
greetings,
Bernhard
More information about the TYPO3-english
mailing list