user19500366
user19500366

Reputation: 3

TYPO3: Run scheduler task from extbase controller in frontend

The scheduler task is normally executed via the command line script /typo3/sysext/core/bin/typo3 scheduler:run.

Is it possible to call the task inside/with a frontend controller from an extbase extension? (as it is, from the backend module "Scheduler" by clicking "Execute selected tasks")

The goal is to run the task on every pageview of a specific page. (cache disabled)

(No exec/shell_exec available)

Thank you!

Upvotes: 0

Views: 538

Answers (1)

Rudy Gnodde
Rudy Gnodde

Reputation: 4565

The scheduler run script is a Symfony Command Controller. You can run it in your Controller using the following code:

$schedulerCommand = new \TYPO3\CMS\Scheduler\Command\SchedulerCommand();
$schedulerInput = new \Symfony\Component\Console\Input\ArrayInput([]);
$schedulerOutput = new \Symfony\Component\Console\Output\NullOutput();
$schedulerCommand->run($schedulerInput, $schedulerOutput);

Depending on which tasks you execute, it can take a while to execute and you might run into timeouts.

Upvotes: 1

Related Questions