Discussion:
[TYPO3-english] Typo3 scheduler: Can i somehow execute Action of controllers of my extension with it or my code?
christian ewigfrost
2017-11-06 08:01:32 UTC
Permalink
A while ago i was tasked to write a Typo3 extension to write so called .conf files for the icinga2 montoring tool (has nothing to do with Typo3). Still let me explain some parts of it: Basically the backend user needs to create records of records of specific classes and set values for each records properties. Then i need to process the records to create these .conf files with the specific values with a php script.

I was tasked to use the scheduler in Typo3 for this. And here come the problems: How do i use this? I checked the documentation (https://docs.typo3.org/typo3cms/extensions/scheduler/Introduction/Index.html), but i still can't wrap my head around how to use it for my task. I can easily write an Action in a controller of a class to be executed in the frontend and in turn generate the con files... basically manually without the scheduler. But where do i put my php code to be run by the scheduler? I somehow seem not to understand the basical principle of the scheduler. Can i just run an Action of a specific controller of a class of my extension like i would in the Frontend via the scheduler?
Mikel
2017-11-06 09:26:39 UTC
Permalink
Hi Christian,

have you found the developers guide for the scheduler?
https://docs.typo3.org/typo3cms/extensions/scheduler/DevelopersGuide/CreatingTasks/Index.html <https://docs.typo3.org/typo3cms/extensions/scheduler/DevelopersGuide/CreatingTasks/Index.html>

Additionally, you need to setup a cronjob on your server to trigger the scheduler to run its jobs.

Does that help?

Mikel
christian ewigfrost
2017-11-06 10:26:19 UTC
Permalink
Yeah, i checked that out already. My problem is that i don't know where to put that code.

The documentation states:

"A task is represented by a PHP class that extends the base task class..."

So is the task basically an additional class in my extension and do i therefore create a seperate php file where the other extension class php files are or how should i understand this. It may be because i'm pretty new to Typo3 and especially extension developement (or because i had not enough sleep last night), but i just can't wrap my head around this.
christian ewigfrost
2017-11-06 14:15:16 UTC
Permalink
I've tried this step by step guide, but the Command simply doesn't pop up in the Scheduler:

http://blog.scwebs.in/typo3/typo3-commandcontroller-in-scheduler-task
Mikel
2017-11-06 15:46:30 UTC
Permalink
See here https://docs.typo3.org/typo3cms/extensions/scheduler/DevelopersGuide/CreatingTasks/Index.html <https://docs.typo3.org/typo3cms/extensions/scheduler/DevelopersGuide/CreatingTasks/Index.html>
Scroll down to „Declaring the task class“.

So you have to declare the task in your ext_localconf.php.
E.g.
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['Vendor\\ExtName\\Task\\LogManagerTask'] = array(
'extension' => $_EXTKEY,
'title' => 'Log Manager',
'description' => 'Your description showing up in the scheduler overview'
);

Mikel
christian ewigfrost
2017-11-07 07:56:54 UTC
Permalink
Thanks.

I'm working with a CommandController now btw. Is still need to figure out how to use it properly but it seems i learn how to properly use the scheduler the way it's supposed to be used.
Loading...