简体   繁体   中英

Typo3 scheduler class not found

I am trying to get a scheduler class running on typo3.

ext_autoload.php:

$extensionPath = t3lib_extMgm::extPath('mh_compass');
$loaderClass = array(
    'tx_monitorcompassdailyreset_sched' => $extensionPath.'scheduler/class.tx_monitorcompassdailyreset_sched.php',
);
return $loaderClass;

ext_localconf.php:

  $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_monitorcompassdailyreset_sched'] = array(
      'extension'        => $_EXTKEY,
      'title'            => 'Compass Monitor Daily Reset Scheduler',
      'description'      => 'Reset daily Monitor Jobs',
  );

class.tx_monitorcompassdailyreset_sched.php:

class tx_monitorcompassdailyreset_sched extends tx_scheduler_Task {

    public function execute() {
        error_log( "Start Compass Monitor Daily Reset Scheduled Job" );
        //do some stuff
        error_log( "Finished Compass Monitor Scheduled Job" );
    }
}

When I try to add the task in the scheduler in the backend, I get the following error:

Fatal error: Class 'tx_monitorcompassdailyreset_sched' not found in /var/www/typo3_src-4.5.22/t3lib/class.t3lib_div.php on line 5375

This doesn't make sense as a) I have used debug on that function and it loads all the other classes, and b) I cannot see a discrepancy in my class naming.

The version of php is 5.3.10 (there was a bug like this with 5.3.2, but it disappeared)

Your class naming is obviously wrong. Your extension key is "mh_compass", so your class name needs to start with "tx_mhcompass_". The beginning of the class name always contains "tx_" followed up with the extension key without underscores.

Try renaming your class to "tx_mhcompass_Task_Reset" for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM