简体   繁体   English

找不到Typo3调度程序类

[英]Typo3 scheduler class not found

I am trying to get a scheduler class running on typo3. 我正在尝试在typo3上运行调度程序类。

ext_autoload.php: 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: 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.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. 这是没有道理的:a)我在该函数上使用了debug,并且它加载了所有其他类,并且b)我在类命名中看不到差异。

The version of php is 5.3.10 (there was a bug like this with 5.3.2, but it disappeared) php的版本是5.3.10(5.3.2中有一个类似的错误,但是它消失了)

Your class naming is obviously wrong. 您的班级命名显然是错误的。 Your extension key is "mh_compass", so your class name needs to start with "tx_mhcompass_". 您的扩展密钥是“ mh_compass”,因此您的类名称必须以“ tx_mhcompass_”开头。 The beginning of the class name always contains "tx_" followed up with the extension key without underscores. 类名的开头始终包含“ tx_”,后跟扩展名,不带下划线。

Try renaming your class to "tx_mhcompass_Task_Reset" for example. 例如,尝试将您的类重命名为“ tx_mhcompass_Task_Reset”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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