[TYPO3-mvc] Using configuration in schedular tasks
Patrick Broens
patrick at patrickbroens.nl
Tue Jan 31 20:39:17 CET 2012
Hi Henjo,
I've digged up some old code of mine for this. Think it was for an
extension in TYPO3 4.5
In ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_extension_System_Tasks_YourClass']
= array(
'extension' => $_EXTKEY,
'title' => 'Bla',
'description' => 'More bla',
'additionalFields' => ''
);
And your task:
tx_extension_System_Tasks_YourClass extends tx_scheduler_Task {
/**
* Public method, usually called by scheduler.
*
* Because we are using ExtBase, we need to do some hacking here.
*
* @return boolean True on success
* @author Patrick Broens <patrick at patrickbroens.nl>
*/
public function execute() {
$configuration = array(
'extensionName' => 'Extension',
'pluginName' => 'Pi1'
);
$_GET['tx_extension_pi1']['controller'] = 'TheController';
$_GET['tx_extension_pi1']['action'] = 'index';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['extension']['modules']['Pi1']['controllers']
= array(
'TheController' => array('actions' => array('index'))
);
$bootstrap = new Tx_Extbase_Core_Bootstrap();
$bootstrap->run('', $configuration);
return TRUE;
}
}
As you can see, $_GET variables are declared here and the bootstrap is
used. Now the controller can call $this->settings
As Claus already said, this submitted Scheduler Integration Feature for
ExtBase should work also.
Cheers
Patrick
On 31-1-12 11:46 , Henjo Hoeksma wrote:
> Hi Claus,
>
> thanks, for now the client will set a normal cronjob. I will take a look at
> your implementation in FED in the near future, will be needing it then for
> real... ;-)
>
> Thanks.
>
> Kind regards,
>
> Henjo
>
> Problems are small because we learned how to deal with them.
> Problems are big because we need to learn how to deal with them.
>
>
> On Mon, Jan 30, 2012 at 23:11, Claus Due <claus at wildside.dk> wrote:
>
>> Hi guys,
>>
>>> PS: $this->request might not be available because you are in cli mode;
>> just substitute it with the appropriate strings.
>>
>> If you are using the Scheduler integration feature I submitted for Extbase
>> or the one from FED, then $this->request should be available.
>>
>> --
>> Cheers,
>> Claus
>> http://fedext.net
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>
More information about the TYPO3-project-typo3v4mvc
mailing list