[TYPO3-dev] My Own Task: Class not found

DirkHo dirk_studivz at web.de
Thu Jun 4 15:25:16 CEST 2015


Hi,

I created an own extension (myExt) that shall only contain one task. 
Therefore I added the following files:

myExt\ext_emconf.php
myExt\ext_localconf.php
myExt\Classes\Command\MyExtCommandController.php

I can install the exentsion and it's selectable in the scheduler, but 
when I save the new schedule task, a fatal error occurres: Class 
'MyExt\\Command\\MyExtCommandController' not found in 
/var/www/typo3_src-6.2.11/typo3/sysext/core/Classes/Utility/GeneralUtility.php

There are no misspellings in the namespace, classname,... I also cleared 
caches in the typo3 backend and with the install tool. Please find the 
source code/config I added below.

ext_emconf.php:
<?php
$EM_CONF[$_EXTKEY] = array(
     'title'            => 'my ext title',
     'description'      => 'Desc',
     'category'         => 'be',
     'author'           => 'Me',
     'author_email'     => '',
     'shy'              => '',
     'dependencies'     => 'extbase',
     'conflicts'        => '',
     'priority'         => '',
     'module'           => '',
     'state'            => 'stable',
     'internal'         => '',
     'uploadfolder'     => 1,
     'modify_tables'    => '',
     'clearCacheOnLoad' => 0,
     'lockType'         => '',
     'author_company'   => '',
     'version'          => '0.0.9',
     'constraints' => array(
         'depends'   => array(
             'typo3'   => '6.0.0-6.2.99',
             'php'     => '5.3.0-0.0.0',
             'extbase' => ''
         ),
         'conflicts' => array(),
         'suggests'  => array(),
     ),
     '_md5_values_when_last_written' => '',
     'suggests'        => array(),
);


ext_localconf.php
<?php

if (!defined('TYPO3_MODE')) {
     die ('Access denied.');
}

if (TYPO3_MODE === 'BE') {
 
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['MyExt\\Command\\MyExtCommandController'] 
= array(
         'extension'        => $EXTKEY,
         'title'            => 'my ext title ',
         'description'      => 'desc',
         'additionalFields' => ''
     );
}

MyExtCommandController.php
<?php

namespace MyExt\Command;


/**
  * Command controller which is called in CLI mode.
  *
  * @author Me
  */
class MyExtCommandController extends 
\TYPO3\CMS\Scheduler\Task\AbstractTask {

     /**
      * @var \Tx_Extbase_Configuration_ConfigurationManagerInterface
      * @inject
      */
     protected $configurationManager;

     /**
      * TS settings
      *
      * @var array
      */
     protected $settings = array();

     public function execute() {
         file_put_contents('/var/www/bla.txt', 'Hello');
     }
}

Thanks and kind regards,

Dirk



More information about the TYPO3-dev mailing list