[TYPO3-mvc] Using configuration in schedular tasks

Henjo Hoeksma me at henjohoeksma.nl
Mon Feb 6 16:44:18 CET 2012


Hi all,

thanks. Will take a peak again somewhere soon.

I ran into a post which was handling settings like this:

===
$settings = unserialize($GLOBALS['TYPO3_**CONF_VARS']['EXT']['extConf'][**'
myext']);
$configuration = array(
       'pluginName' => 'Pi1',
       'extensionName' => 'myext',
       'settings' => '< plugin.tx_myext.settings',
       'persistence' => '< plugin.tx_myext.persistence',
       'view' => '< plugin.tx_myext.view',
       'persistence' => array(
               'storagePid' => $settings['storagePid']
       ),
       '_LOCAL_LANG' => '< plugin.tx_myext._LOCAL_LANG',
       'controller' => 'ControllerName',
       'action' => 'actionName',
       'switchableControllerActions' => array (
               '1' => array('controller' => 'ControllerName', 'actions' =>
'actionName')
       )
);
t3lib_div::_GETset(1,'id'); // Root page uid where we include plugin
t3lib_div::_GETset('**ControllerName','tx_myext_pi1|**controller');
t3lib_div::_GETset('**actionName','tx_myext_pi1|**action');
$GLOBALS['TYPO3_CONF_VARS']['**EXTCONF']['extbase']['**extension
s']['myext']['**modules']['Pi1']['controllers'**] = array(
       'ControllerName' => array('actions' => array('actionName'))
);
$dispatcher = new Tx_Extbase_Dispatcher();
$dispatcher->dispatch('', $configuration);
return true;
===

Enough to play with I would say ;-)
I will post my findings when I am working on that again.


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 Tue, Jan 31, 2012 at 20:39, Patrick Broens <patrick at patrickbroens.nl>wrote:

> 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
> >>
>
> _______________________________________________
> 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