[TYPO3-mvc] Scheduling Extbase Action (version 1.4.2)

SotirisBK swtos at hotmail.com
Fri Jun 22 12:26:28 CEST 2012


Hi all,

I have seen a thread here having many replies and a lot of people 
responding that had a confirmed solution. I believe this was for extbase 
version 1.3.
Following your example I have created an extension and I have set a 
Schedule action. I see the scheduled action correctly in the schedule 
module and when I execute it through BE runs normally and completes what 
is to be done.

so what I've done so far:


(ext_localconf.php)
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_extensionname_utility_scheduler'] 
= array(
     'extension'        => $_EXTKEY,
     'title'            => 'This is a scheduler blah blah',
     'description'      => 'And does this and that',
);



(ext_autoload.php)
<?php
$extensionPath = t3lib_extMgm::extPath('extensionname');

return array(
     'tx_extensionname_utility_scheduler' => $extensionPath . 
'Utility/Scheduler.php',
);
?>



(I created under Utility folder the file Scheduler.php)
<?php

class tx_extensionname_utility_scheduler extends tx_scheduler_Task {
     public function execute() {
         try {
             t3lib_div::devlog('--- working ---', 'extensionname', 0);
             $configuration = array(
                 'extensionName' => 'extensionname',
                 'pluginName' => 'Pi1',
                 'controller' => 'Mycontroller',
                 'action' => 'myaction',
                 'switchableControllerActions' => array(
                     'Mycontroller' => array(
                         'actions' => 'myaction'
                     )
                 )
             );
             $_SERVER['REQUEST_METHOD'] = 'GET';
             $_GET['tx_extensionname_plugin']['controller'] = 
'Mycontroller';
             $_GET['tx_extensionname_plugin']['action'] = 'myaction';
 
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['extensionname']['modules']['Pi1']['controllers'] 
= array(
               'Mycontroller' => array(
                     'actions' => array(
                       'myaction'
                     )
                 )
             );
             $bootstrap = 
t3lib_div::makeInstance('Tx_Extbase_Core_Bootstrap');
             $result = $bootstrap->run('', $configuration);
             t3lib_div::devlog($result , 'extensionname', 0);
             return TRUE;
         }
         catch(Exception $e) {
             t3lib_div::devlog('--- error ---'.$e->getMessage(), 
'extensionname', 3);
             return FALSE;
         }
     }
}

?>

The problem:
Unfortunately this doesn't happen when I try to execute it through 
"cli_dispatch.phpsh scheduler" command. In this case it seems that it 
gets into the scheduler class, reads configuration but never reaches 
into the Controller's Action but ends the scheduler normally. Of course 
no action was taken! The error that I get from Bootstrap is:

Extbase 1.4.2 usage: ./cli_dispatch.phpsh extbase <command identifier> 
See './cli_dispatch.phpsh extbase help' for a list of all available 
commands.


Does anybody have a clue why I can execute manually through Scheduler 
and fails when it comes to cronjob?

Thanks,
Sotiris


More information about the TYPO3-project-typo3v4mvc mailing list