SlideShare uma empresa Scribd logo
1 de 55
Baixar para ler offline
SCHEDULER & CLI 
Krystian Szymukowicz 
k.szymukowicz@sourcebroker.net
PRESENTATION ROADMAP 
WHAT IS SCHEDULER? 
SCHEDULER FOR USERS 
SCHEDULER FOR DEVELOPERS 
WHAT IS CLI? 
CLI FOR USERS 
CLI FOR DEVELOPER 
INTERESTING EXTENSIONS 
https://github.com/t33k/schedulerX 
Krystian Szymukowicz 
k.szymukowicz@sourcebroker.net
SCHEDULER 
module to set up and monitor recurring things
WHY DO WE NEED SCHEDULER? 
• system extensions and user extensions do not have to 
repeat the code 
• TYPO3 installation is better movable between hostings 
• gives overview of what scheduler jobs are there in system 
• gives overview of what jobs are currently active/running
SCHEDULER 
USER/INTEGRATOR PERSPECTIVE
NOT INSTALLED BY DEFAULT
SETTING SCHEDULER MAIN CRONJOB 
EDIT USERS CRONTABS. 
When logged to ssh console as www-data user: 
crontab -e 
*/15 * * * * php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler 
When logged to ssh console as root then probably better is to: 
su www-data -c”crontab -e” 
*/15 * * * * php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler 
EDIT SYSTEM WIDE CRONTABS. 
Go to /etc/cron.d/ and create file 
*/15 * * * * www-data php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler
SETTING SCHEDULER MAIN CRONJOB 
Different problems on limited ssh and shared hostings: 
• Fake cron to run just php script by calling Apache (no CLI) 
• Different PHP version for CLI (works from BE not form CLI) 
• php_memory limit low for CLI (works from BE not form CLI) 
• No way to see errors from CLI on shared hostings.
SETTING SCHEDULER MAIN CRONJOB 
General fake cron problem overcome: 
<php 
exec('/usr/local/php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler'); 
<php 
exec('/usr/local/php-cgi /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler'); 
Different hosting - different variations 
• Hoster - ALL-INKL 
<php 
exec('php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler'); 
AddHandler php5-cgi .php .phpsh 
/cron/cron.php 
/cron/.htaccess 
/fileadmin/ 
/typo3/ 
/typo3conf 
/etc…
SETTING SCHEDULER MAIN CRONJOB 
Be ready to fight for Scheduler cron! 
Google for: 
"typo3 cli_dispatch.phpsh [hoster name]" 
Do not hesitate to ask hoster admin!
SUCCESS
CRON FREQUENCY 
/etc/cron.d/ 
*/15 * * * * www-data php /var/www/workspace-typo3/projects/acme/typo3/cli_dispatch.phpsh scheduler 
10:00 10:15 10:30 10:45 
11:00 
21-11-14 10:10 
21-11-14 10:15 
5 10 15 20 25 35 40 50 55 
10:00 30 45 11:00 
Task with id=2 will be late by 10 minutes
SCHEDULER 
DEVELOPER PERSPECTIVE
SIMPLE EXT WITH SCHEDULER TASK 
! 
typo3conf/ext 
/Scheduler1 
https://github.com/t33k/scheduler1 
/Classes/Task/SimpleReportTask.php 
/ext_conf.php 
/ext_localconf.php
SIMPLE EXT WITH SCHEDULER TASK 
Register new extension: 
ext_conf.php 
<?php 
! 
$EM_CONF[$_EXTKEY] = array( 
'title' => 'Scheduler Test - The simplest extension with task', 
'constraints' => array(), 
); 
https://github.com/t33k/scheduler1
SIMPLE EXT WITH SCHEDULER TASK 
Register new scheduler task: 
ext_localconf.php 
<?php 
! 
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'] 
['VScheduler1TaskSampleTask'] = array( 
'extension' => $_EXTKEY, 
'title' => 'The simplest task ever', 
'description' => 'Task description' 
); 
https://github.com/t33k/scheduler1
SIMPLE EXT WITH SCHEDULER TASK 
Class with task: 
Classes/Task/SampleTask.php 
<?php 
! 
namespace VScheduler1Task; 
class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask { 
! 
public function execute() { 
$success = FALSE; 
… 
… 
return $success; 
} 
! 
} 
https://github.com/t33k/scheduler1
SIMPLE EXT WITH SCHEDULER TASK II 
https://github.com/t33k/scheduler2 
getAdditonalInformation() 
getProgress() 
implements TYPO3CMSSchedulerProgressProviderInterface()
SIMPLE EXT WITH SCHEDULER TASK II 
Classes/Task/SampleTask.php 
<?php 
! 
namespace VScheduler2Task; 
! 
class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask 
implements TYPO3CMSSchedulerProgressProviderInterface { 
! 
public $email = 'dr_who@universe.thr'; 
! 
public function execute() { 
return TRUE; 
} 
! 
public function getAdditionalInformation() { 
return 'Time now: ' . strftime('%H:%m:%S', time()) . ', Next exec time: ' . 
strftime('%x', $this->getNextDueExecution()) . ', Email: ' . $this->email; 
} 
! 
public function getProgress(){ 
return rand(0,100); 
} 
! 
} 
https://github.com/t33k/scheduler2
SIMPLE EXT WITH SCHEDULER TASK III 
Flash messages and debug: 
System flash messages 
Standard scheduler task info 
GeneralUtility::devLog(….. 
debug(ArrayUtility::convertObjectToArray($this));
SIMPLE EXT WITH SCHEDULER TASK III 
Classes/Task/SampleTask.php 
<?php 
! 
namespace VScheduler3Task; 
use TYPO3CMSCoreUtilityGeneralUtility; 
use TYPO3CMSExtbaseUtilityArrayUtility; 
! 
class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask{ 
public function execute() { 
$flashMessageOk = GeneralUtility::makeInstance( 
'TYPO3CMSCoreMessagingFlashMessage', 
'Message to be passed', 
'OK Example', 
TYPO3CMSCoreMessagingFlashMessage::OK); 
$defaultFlashMessageQueue = $this->getDefaultFlashMessageQueue(); 
$defaultFlashMessageQueue->enqueue($flashMessageOk); 
! 
GeneralUtility::devLog('Message', 'scheduler3', 2, ArrayUtility::convertObjectToArray($this)); 
! 
debug(ArrayUtility::convertObjectToArray($this)); 
return TRUE; 
} 
! 
} 
https://github.com/t33k/scheduler3
SIMPLE EXT WITH SCHEDULER TASK IV 
Additional field https://github.com/t33k/scheduler4
SIMPLE EXT WITH SCHEDULER TASK IV 
Additional field 
ext_localconf.php 
Classes/Task/SampleTaskAdditionalFieldProvider.php 
! 
class SampleTaskAdditionalFieldProvider implements TYPO3CMSSchedulerAdditionalFieldProviderInterface{ 
! 
public function getAdditionalFields 
(array &$taskInfo, $task, TYPO3CMSSchedulerControllerSchedulerModuleController $parentObject) {…} 
! 
public function validateAdditionalFields 
(array &$submittedData, TYPO3CMSSchedulerControllerSchedulerModuleController $parentObject) {…} 
! 
public function saveAdditionalFields 
(array $submittedData, TYPO3CMSSchedulerTaskAbstractTask $task) {…} 
} 
https://github.com/t33k/scheduler4 
<?php 
! 
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['VScheduler4TaskSampleTask'] = 
array( 
'extension' => $_EXTKEY, 
'title' => 'Scheduler4 test - example for new field', 
'description' => 'How to add new field to scheduler task.', 
'additionalFields' => 'VScheduler4TaskSampleTaskAdditionalFieldProvider' 
);
SIMPLE EXT WITH SCHEDULER TASK V 
Create new tasks automatically in FE and BE 
https://github.com/t33k/scheduler5 
Classes/Task/SampleTask.php 
<?php 
! 
namespace VScheduler5Task; 
use TYPO3CMSCoreUtilityGeneralUtility; 
! 
class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask { 
! 
public function execute() { 
/** @var $newTask VScheduler5TaskSampleTask */ 
$newTask = GeneralUtility::makeInstance('VScheduler5TaskSampleTask'); 
$newTask->setDescription('Task description'); 
$newTask->setTaskGroup(0); 
$newTask->registerRecurringExecution($start = time(), $interval = 86400, $end = 0, 
$multiple = FALSE, $cron_cmd = ''); 
$newTask->email = 'test.drwho+' . rand(0,10) . '@gmail.com'; 
! 
/** @var TYPO3CMSSchedulerScheduler $scheduler */ 
$scheduler = GeneralUtility::makeInstance("TYPO3CMSSchedulerScheduler"); 
$scheduler->addTask($newTask); 
! 
return TRUE; 
} 
! 
public function getAdditionalInformation() { 
return 'Email:' . $this->email; 
} 
! 
}
SIMPLE EXT WITH SCHEDULER TASK VII 
Autmaticaly disable task 
Classes/Task/SampleTask.php 
<?php 
! 
namespace VScheduler7Task; 
! 
class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask { 
! 
public $counter = 10; 
! 
public function execute() { 
$this->counter = $this->counter - 1; 
if ($this->counter === 0) { 
// $this->remove(); 
$this->setDisabled(TRUE); 
} 
$this->save(); 
return TRUE; 
} 
! 
public function getAdditionalInformation() { 
return $this->counter; 
} 
! 
}
THINGS TO REMEMBER 
Object is serialized once on creation of scheduler task so all 
future changes to methods or properties can lead to errors. 
The solution then is to delete the scheduler task and create 
new one.
CLI 
USER PERSPECTIVE
CLI 
Command Line Interface 
! 
One of SAPI the PHP interact with different env - here with 
shell. Others SAPI examples: CGI, fpm , apache2handler 
CLI points: 
• No execution time limit by default. 
• No headers are send. 
• No path is changed while running by default
CLI Command Line Interface 
php typo3/cli_dispatch.phpsh
lowlevel_admin setBElock
lowlevel_cleaner [option] -r
lowlevel_refindex
extbase
CLI 
DEVELOPER PERSPECTIVE
EXTBASE COMMAND CENTER 
Backport from TYPO3 FLOW 
$ php cli_dispatch.phpsh extbase <command identifier> --argumentName=value 
$ php cli_dispatch.phpsh extbase scheduler6:sample:second --name=adam --number=12 --enabled 
This will call: 
—> extension scheduler6 
—> class SampleCommandController 
—> method secondCommand 
typo3conf/ext/scheduler6/Classes/Command/SampleCommandController.php 
secondCommand($name, $number, $enabled = true)
ext_localconf.php 
<?php 
! 
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'VScheduler6Command 
SampleCommandController'; 
typo3conf/ext/scheduler6/Classes/Command/SampleCommandController.php 
/** 
* Class SampleCommandController 
* @package VScheduler6Command 
*/ 
class SampleCommandController extends TYPO3CMSExtbaseMvcControllerCommandController { ! 
/** 
* Get Faq title for given uid 
* 
* This text goes into description of CLI 
* so you see when you will do php typo3/cli_dispatch.phpsh extbase help scheduler6:sample:newsTitle. 
* Second line of description. 
* Third line of description. 
* 
* @param integer $faqUid Faq uid 
* @return void 
*/ 
public function faqTitleCommand($faqUid) { 
$faqUid = intval($faqUid); 
if ($faqUid) { 
$faqRepository = $this->getFaqRepository(); 
$faq = $faqRepository->findByUid($faqUid); 
if(NULL !== $faq){ 
$this->outputLine($faq->getQuestion()); 
} 
} 
}
php typo3/cli_dispatch.phpsh extbase help scheduler6:sample:faqTitle 
All texts are taken from class comment / arguments !!!
EXTBASE COMMAND CENTER 
ext_localconf.php 
<?php 
! 
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'VScheduler6Command 
SampleCommandController'; 
typo3conf/ext/scheduler6/Classes/Command/SampleCommandController.php 
/** 
* Class SampleCommandController 
* @package VScheduler6Command 
*/ 
class SampleCommandController extends TYPO3CMSExtbaseMvcControllerCommandController { ! 
/** 
* Get Faq title for given uid 
* 
* This text goes into description of CLI 
* so you see when you will do php typo3/cli_dispatch.phpsh extbase help scheduler6:sample:newsTitle. 
* Second line of description. 
* Third line of description. 
* 
* @param integer $faqUid Faq uid 
* @return void 
*/ 
public function faqTitleCommand($faqUid) { 
$faqUid = intval($faqUid); 
if ($faqUid) { 
$faqRepository = $this->getFaqRepository(); 
$faq = $faqRepository->findByUid($faqUid); 
if(NULL !== $faq){ 
$this->outputLine($faq->getQuestion()); 
} 
} 
}
EXTBASE COMMAND CENTER
SCHEDULER/CLI 
INTERESTING EXTENSIONS
CLEARTYPO3CACHE 
$ php cli_dispatch.phpsh cleartypo3cache all 
$ php cli_dispatch.phpsh cleartypo3cache pages 
https://github.com/t33k/cleartypo3cache 
$ php cli_dispatch.phpsh cleartypo3cache system 
Create BE user "_cli_cleartypo3cache" with TS settings 
options.clearCache.all=1 
options.clearCache.pages=1 
options.clearCache.system=1
CLEARTYPO3CACHE https://github.com/t33k/cleartypo3cache
T3DEPLOY 
https://github.com/AOEmedia/t3deploy 
Update only (more safe) 
php typo3/cli_dispatch.phpsh t3deploy database updateStructure --verbose --execute 
Remove also 
php typo3/cli_dispatch.phpsh t3deploy database updateStructure --remove --verbose --execute
THANK YOU! 
Krystian Szymukowicz 
k.szymukowicz@sourcebroker.net

Mais conteúdo relacionado

Mais procurados

Locators in selenium - BNT 09
Locators in selenium - BNT 09Locators in selenium - BNT 09
Locators in selenium - BNT 09weekendtesting
 
HTML & CSS: Chapter 03
HTML & CSS: Chapter 03HTML & CSS: Chapter 03
HTML & CSS: Chapter 03Steve Guinan
 
Front-end technologies for Wonderful User Experience through Websites
Front-end technologies for Wonderful User Experience through WebsitesFront-end technologies for Wonderful User Experience through Websites
Front-end technologies for Wonderful User Experience through WebsitesReady Bytes Software labs
 
Html,javascript & css
Html,javascript & cssHtml,javascript & css
Html,javascript & cssPredhin Sapru
 
Présentation jQuery pour débutant
Présentation jQuery pour débutantPrésentation jQuery pour débutant
Présentation jQuery pour débutantStanislas Chollet
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examplesAlfredo Torre
 
HTML 5 - intro - en francais
HTML 5 - intro - en francaisHTML 5 - intro - en francais
HTML 5 - intro - en francaisVlad Posea
 
Introduction to flexbox
Introduction  to  flexboxIntroduction  to  flexbox
Introduction to flexboxJyoti Gautam
 
Intégration Web HTML 5 & CSS 3
Intégration Web HTML 5 & CSS 3Intégration Web HTML 5 & CSS 3
Intégration Web HTML 5 & CSS 3Stephane PERES
 
Foster - Getting started with Angular
Foster - Getting started with AngularFoster - Getting started with Angular
Foster - Getting started with AngularMukundSonaiya1
 
HTML & CSS: Chapter 07
HTML & CSS: Chapter 07HTML & CSS: Chapter 07
HTML & CSS: Chapter 07Steve Guinan
 
Let's Go (golang)
Let's Go (golang)Let's Go (golang)
Let's Go (golang)상욱 송
 
Html 5 -_aula_1
Html 5 -_aula_1Html 5 -_aula_1
Html 5 -_aula_1Pedro Neto
 
Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09mihaiionescu
 
Modernising AEM Sites Codebase (AEM Meetup 2019)
Modernising AEM Sites Codebase  (AEM Meetup 2019)Modernising AEM Sites Codebase  (AEM Meetup 2019)
Modernising AEM Sites Codebase (AEM Meetup 2019)Hanish Bansal
 

Mais procurados (20)

Locators in selenium - BNT 09
Locators in selenium - BNT 09Locators in selenium - BNT 09
Locators in selenium - BNT 09
 
HTML & CSS: Chapter 03
HTML & CSS: Chapter 03HTML & CSS: Chapter 03
HTML & CSS: Chapter 03
 
Front-end technologies for Wonderful User Experience through Websites
Front-end technologies for Wonderful User Experience through WebsitesFront-end technologies for Wonderful User Experience through Websites
Front-end technologies for Wonderful User Experience through Websites
 
Html,javascript & css
Html,javascript & cssHtml,javascript & css
Html,javascript & css
 
Présentation jQuery pour débutant
Présentation jQuery pour débutantPrésentation jQuery pour débutant
Présentation jQuery pour débutant
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examples
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
 
HTML 5 - intro - en francais
HTML 5 - intro - en francaisHTML 5 - intro - en francais
HTML 5 - intro - en francais
 
Introduction to flexbox
Introduction  to  flexboxIntroduction  to  flexbox
Introduction to flexbox
 
Intégration Web HTML 5 & CSS 3
Intégration Web HTML 5 & CSS 3Intégration Web HTML 5 & CSS 3
Intégration Web HTML 5 & CSS 3
 
Html form tag
Html form tagHtml form tag
Html form tag
 
Foster - Getting started with Angular
Foster - Getting started with AngularFoster - Getting started with Angular
Foster - Getting started with Angular
 
HTML & CSS: Chapter 07
HTML & CSS: Chapter 07HTML & CSS: Chapter 07
HTML & CSS: Chapter 07
 
Let's Go (golang)
Let's Go (golang)Let's Go (golang)
Let's Go (golang)
 
Java script
Java scriptJava script
Java script
 
jQuery
jQueryjQuery
jQuery
 
Html 5 -_aula_1
Html 5 -_aula_1Html 5 -_aula_1
Html 5 -_aula_1
 
Page object pattern
Page object patternPage object pattern
Page object pattern
 
Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09
 
Modernising AEM Sites Codebase (AEM Meetup 2019)
Modernising AEM Sites Codebase  (AEM Meetup 2019)Modernising AEM Sites Codebase  (AEM Meetup 2019)
Modernising AEM Sites Codebase (AEM Meetup 2019)
 

Destaque

TYPO3 - optymalizacja pracy z instancjami
TYPO3 - optymalizacja pracy z instancjamiTYPO3 - optymalizacja pracy z instancjami
TYPO3 - optymalizacja pracy z instancjamiKrystian Szymukowicz
 
Insurance company - Andrina
Insurance company - AndrinaInsurance company - Andrina
Insurance company - Andrinaastoeckling
 
Redaccion de textos
Redaccion de textosRedaccion de textos
Redaccion de textosMelanie Rico
 
Northware - AX Services and Support - LITE
Northware - AX Services and Support - LITENorthware - AX Services and Support - LITE
Northware - AX Services and Support - LITEImre Szenttornyay, MSc.
 
Clini cast datapalooza presentation (1)
Clini cast  datapalooza presentation (1)Clini cast  datapalooza presentation (1)
Clini cast datapalooza presentation (1)Jack Challis
 
286.fiestas navideñas
286.fiestas navideñas286.fiestas navideñas
286.fiestas navideñasdec-admin
 
410. problemáticas que existen en el entorno
410. problemáticas que existen en el entorno410. problemáticas que existen en el entorno
410. problemáticas que existen en el entornodec-admin
 
Ciel mech webinar_sneakpeak
Ciel mech webinar_sneakpeakCiel mech webinar_sneakpeak
Ciel mech webinar_sneakpeakKamal Karimanal
 
Solids, Liquids and Gases
Solids, Liquids and GasesSolids, Liquids and Gases
Solids, Liquids and Gasesastoeckling
 
Market vision capabilities for goma - 083112 [final]
Market vision   capabilities for goma  - 083112 [final]Market vision   capabilities for goma  - 083112 [final]
Market vision capabilities for goma - 083112 [final]mvculture
 
Architecture portfolio mujahid habib
Architecture portfolio mujahid habibArchitecture portfolio mujahid habib
Architecture portfolio mujahid habibMUJAHID HABIB
 
71. el espacio del saber
71. el espacio del saber71. el espacio del saber
71. el espacio del saberdec-admin
 
427. ecoambiente
427. ecoambiente427. ecoambiente
427. ecoambientedec-admin
 
Redaccion de textos
Redaccion de textosRedaccion de textos
Redaccion de textosMelanie Rico
 

Destaque (20)

TYPO3 - optymalizacja pracy z instancjami
TYPO3 - optymalizacja pracy z instancjamiTYPO3 - optymalizacja pracy z instancjami
TYPO3 - optymalizacja pracy z instancjami
 
Insurance company - Andrina
Insurance company - AndrinaInsurance company - Andrina
Insurance company - Andrina
 
Recommended safer work practices for nursing
Recommended safer work practices for nursingRecommended safer work practices for nursing
Recommended safer work practices for nursing
 
Redaccion de textos
Redaccion de textosRedaccion de textos
Redaccion de textos
 
Very berry!
Very berry!Very berry!
Very berry!
 
Northware - AX Services and Support - LITE
Northware - AX Services and Support - LITENorthware - AX Services and Support - LITE
Northware - AX Services and Support - LITE
 
Clini cast datapalooza presentation (1)
Clini cast  datapalooza presentation (1)Clini cast  datapalooza presentation (1)
Clini cast datapalooza presentation (1)
 
286.fiestas navideñas
286.fiestas navideñas286.fiestas navideñas
286.fiestas navideñas
 
410. problemáticas que existen en el entorno
410. problemáticas que existen en el entorno410. problemáticas que existen en el entorno
410. problemáticas que existen en el entorno
 
Ciel mech webinar_sneakpeak
Ciel mech webinar_sneakpeakCiel mech webinar_sneakpeak
Ciel mech webinar_sneakpeak
 
Solids, Liquids and Gases
Solids, Liquids and GasesSolids, Liquids and Gases
Solids, Liquids and Gases
 
Market vision capabilities for goma - 083112 [final]
Market vision   capabilities for goma  - 083112 [final]Market vision   capabilities for goma  - 083112 [final]
Market vision capabilities for goma - 083112 [final]
 
Architecture portfolio mujahid habib
Architecture portfolio mujahid habibArchitecture portfolio mujahid habib
Architecture portfolio mujahid habib
 
Sección 5. infracciones de la vida silvestre
Sección 5. infracciones de la vida silvestreSección 5. infracciones de la vida silvestre
Sección 5. infracciones de la vida silvestre
 
71. el espacio del saber
71. el espacio del saber71. el espacio del saber
71. el espacio del saber
 
427. ecoambiente
427. ecoambiente427. ecoambiente
427. ecoambiente
 
Spinfinityrussian
SpinfinityrussianSpinfinityrussian
Spinfinityrussian
 
Redaccion de textos
Redaccion de textosRedaccion de textos
Redaccion de textos
 
Spinfinityrussian
SpinfinityrussianSpinfinityrussian
Spinfinityrussian
 
Sección 4. unidad 8
Sección 4. unidad 8Sección 4. unidad 8
Sección 4. unidad 8
 

Semelhante a TYPO3 Scheduler

Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3kognate
 
Symfony console: build awesome command line scripts with ease
Symfony console: build awesome command line scripts with easeSymfony console: build awesome command line scripts with ease
Symfony console: build awesome command line scripts with easeOscar Merida
 
Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineBehzod Saidov
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証ME iBotch
 
Tools and Tips for Moodle Developers - #mootus16
 Tools and Tips for Moodle Developers - #mootus16 Tools and Tips for Moodle Developers - #mootus16
Tools and Tips for Moodle Developers - #mootus16Dan Poltawski
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90minsLarry Cai
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2Hugo Hamon
 
DevOps in PHP environment
DevOps in PHP environment DevOps in PHP environment
DevOps in PHP environment Evaldo Felipe
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applicationschartjes
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-TranslatorDashamir Hoxha
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction PresentationNerd Tzanetopoulos
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnSandro Zaccarini
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionIan Barber
 
Php 5.6 From the Inside Out
Php 5.6 From the Inside OutPhp 5.6 From the Inside Out
Php 5.6 From the Inside OutFerenc Kovács
 

Semelhante a TYPO3 Scheduler (20)

Catalyst MVC
Catalyst MVCCatalyst MVC
Catalyst MVC
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 
Symfony console: build awesome command line scripts with ease
Symfony console: build awesome command line scripts with easeSymfony console: build awesome command line scripts with ease
Symfony console: build awesome command line scripts with ease
 
Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command line
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証
 
Tools and Tips for Moodle Developers - #mootus16
 Tools and Tips for Moodle Developers - #mootus16 Tools and Tips for Moodle Developers - #mootus16
Tools and Tips for Moodle Developers - #mootus16
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90mins
 
Pyramid deployment
Pyramid deploymentPyramid deployment
Pyramid deployment
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
DevOps in PHP environment
DevOps in PHP environment DevOps in PHP environment
DevOps in PHP environment
 
Introduction to Slurm
Introduction to SlurmIntroduction to Slurm
Introduction to Slurm
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
Php 5.6 From the Inside Out
Php 5.6 From the Inside OutPhp 5.6 From the Inside Out
Php 5.6 From the Inside Out
 

Último

Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...SUHANI PANDEY
 
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...nilamkumrai
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...roncy bisnoi
 
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Datingkojalkojal131
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls DubaiEscorts Call Girls
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.soniya singh
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...SUHANI PANDEY
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...SUHANI PANDEY
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...SUHANI PANDEY
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 

Último (20)

(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 

TYPO3 Scheduler

  • 1. SCHEDULER & CLI Krystian Szymukowicz k.szymukowicz@sourcebroker.net
  • 2. PRESENTATION ROADMAP WHAT IS SCHEDULER? SCHEDULER FOR USERS SCHEDULER FOR DEVELOPERS WHAT IS CLI? CLI FOR USERS CLI FOR DEVELOPER INTERESTING EXTENSIONS https://github.com/t33k/schedulerX Krystian Szymukowicz k.szymukowicz@sourcebroker.net
  • 3. SCHEDULER module to set up and monitor recurring things
  • 4. WHY DO WE NEED SCHEDULER? • system extensions and user extensions do not have to repeat the code • TYPO3 installation is better movable between hostings • gives overview of what scheduler jobs are there in system • gives overview of what jobs are currently active/running
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. SETTING SCHEDULER MAIN CRONJOB EDIT USERS CRONTABS. When logged to ssh console as www-data user: crontab -e */15 * * * * php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler When logged to ssh console as root then probably better is to: su www-data -c”crontab -e” */15 * * * * php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler EDIT SYSTEM WIDE CRONTABS. Go to /etc/cron.d/ and create file */15 * * * * www-data php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler
  • 12. SETTING SCHEDULER MAIN CRONJOB Different problems on limited ssh and shared hostings: • Fake cron to run just php script by calling Apache (no CLI) • Different PHP version for CLI (works from BE not form CLI) • php_memory limit low for CLI (works from BE not form CLI) • No way to see errors from CLI on shared hostings.
  • 13. SETTING SCHEDULER MAIN CRONJOB General fake cron problem overcome: <php exec('/usr/local/php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler'); <php exec('/usr/local/php-cgi /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler'); Different hosting - different variations • Hoster - ALL-INKL <php exec('php /var/www/workspace-typo3/projects/62/typo3/cli_dispatch.phpsh scheduler'); AddHandler php5-cgi .php .phpsh /cron/cron.php /cron/.htaccess /fileadmin/ /typo3/ /typo3conf /etc…
  • 14. SETTING SCHEDULER MAIN CRONJOB Be ready to fight for Scheduler cron! Google for: "typo3 cli_dispatch.phpsh [hoster name]" Do not hesitate to ask hoster admin!
  • 16. CRON FREQUENCY /etc/cron.d/ */15 * * * * www-data php /var/www/workspace-typo3/projects/acme/typo3/cli_dispatch.phpsh scheduler 10:00 10:15 10:30 10:45 11:00 21-11-14 10:10 21-11-14 10:15 5 10 15 20 25 35 40 50 55 10:00 30 45 11:00 Task with id=2 will be late by 10 minutes
  • 17.
  • 18.
  • 19.
  • 21. SIMPLE EXT WITH SCHEDULER TASK ! typo3conf/ext /Scheduler1 https://github.com/t33k/scheduler1 /Classes/Task/SimpleReportTask.php /ext_conf.php /ext_localconf.php
  • 22. SIMPLE EXT WITH SCHEDULER TASK Register new extension: ext_conf.php <?php ! $EM_CONF[$_EXTKEY] = array( 'title' => 'Scheduler Test - The simplest extension with task', 'constraints' => array(), ); https://github.com/t33k/scheduler1
  • 23. SIMPLE EXT WITH SCHEDULER TASK Register new scheduler task: ext_localconf.php <?php ! $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'] ['VScheduler1TaskSampleTask'] = array( 'extension' => $_EXTKEY, 'title' => 'The simplest task ever', 'description' => 'Task description' ); https://github.com/t33k/scheduler1
  • 24. SIMPLE EXT WITH SCHEDULER TASK Class with task: Classes/Task/SampleTask.php <?php ! namespace VScheduler1Task; class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask { ! public function execute() { $success = FALSE; … … return $success; } ! } https://github.com/t33k/scheduler1
  • 25.
  • 26.
  • 27.
  • 28. SIMPLE EXT WITH SCHEDULER TASK II https://github.com/t33k/scheduler2 getAdditonalInformation() getProgress() implements TYPO3CMSSchedulerProgressProviderInterface()
  • 29. SIMPLE EXT WITH SCHEDULER TASK II Classes/Task/SampleTask.php <?php ! namespace VScheduler2Task; ! class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask implements TYPO3CMSSchedulerProgressProviderInterface { ! public $email = 'dr_who@universe.thr'; ! public function execute() { return TRUE; } ! public function getAdditionalInformation() { return 'Time now: ' . strftime('%H:%m:%S', time()) . ', Next exec time: ' . strftime('%x', $this->getNextDueExecution()) . ', Email: ' . $this->email; } ! public function getProgress(){ return rand(0,100); } ! } https://github.com/t33k/scheduler2
  • 30. SIMPLE EXT WITH SCHEDULER TASK III Flash messages and debug: System flash messages Standard scheduler task info GeneralUtility::devLog(….. debug(ArrayUtility::convertObjectToArray($this));
  • 31. SIMPLE EXT WITH SCHEDULER TASK III Classes/Task/SampleTask.php <?php ! namespace VScheduler3Task; use TYPO3CMSCoreUtilityGeneralUtility; use TYPO3CMSExtbaseUtilityArrayUtility; ! class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask{ public function execute() { $flashMessageOk = GeneralUtility::makeInstance( 'TYPO3CMSCoreMessagingFlashMessage', 'Message to be passed', 'OK Example', TYPO3CMSCoreMessagingFlashMessage::OK); $defaultFlashMessageQueue = $this->getDefaultFlashMessageQueue(); $defaultFlashMessageQueue->enqueue($flashMessageOk); ! GeneralUtility::devLog('Message', 'scheduler3', 2, ArrayUtility::convertObjectToArray($this)); ! debug(ArrayUtility::convertObjectToArray($this)); return TRUE; } ! } https://github.com/t33k/scheduler3
  • 32. SIMPLE EXT WITH SCHEDULER TASK IV Additional field https://github.com/t33k/scheduler4
  • 33. SIMPLE EXT WITH SCHEDULER TASK IV Additional field ext_localconf.php Classes/Task/SampleTaskAdditionalFieldProvider.php ! class SampleTaskAdditionalFieldProvider implements TYPO3CMSSchedulerAdditionalFieldProviderInterface{ ! public function getAdditionalFields (array &$taskInfo, $task, TYPO3CMSSchedulerControllerSchedulerModuleController $parentObject) {…} ! public function validateAdditionalFields (array &$submittedData, TYPO3CMSSchedulerControllerSchedulerModuleController $parentObject) {…} ! public function saveAdditionalFields (array $submittedData, TYPO3CMSSchedulerTaskAbstractTask $task) {…} } https://github.com/t33k/scheduler4 <?php ! $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['VScheduler4TaskSampleTask'] = array( 'extension' => $_EXTKEY, 'title' => 'Scheduler4 test - example for new field', 'description' => 'How to add new field to scheduler task.', 'additionalFields' => 'VScheduler4TaskSampleTaskAdditionalFieldProvider' );
  • 34. SIMPLE EXT WITH SCHEDULER TASK V Create new tasks automatically in FE and BE https://github.com/t33k/scheduler5 Classes/Task/SampleTask.php <?php ! namespace VScheduler5Task; use TYPO3CMSCoreUtilityGeneralUtility; ! class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask { ! public function execute() { /** @var $newTask VScheduler5TaskSampleTask */ $newTask = GeneralUtility::makeInstance('VScheduler5TaskSampleTask'); $newTask->setDescription('Task description'); $newTask->setTaskGroup(0); $newTask->registerRecurringExecution($start = time(), $interval = 86400, $end = 0, $multiple = FALSE, $cron_cmd = ''); $newTask->email = 'test.drwho+' . rand(0,10) . '@gmail.com'; ! /** @var TYPO3CMSSchedulerScheduler $scheduler */ $scheduler = GeneralUtility::makeInstance("TYPO3CMSSchedulerScheduler"); $scheduler->addTask($newTask); ! return TRUE; } ! public function getAdditionalInformation() { return 'Email:' . $this->email; } ! }
  • 35. SIMPLE EXT WITH SCHEDULER TASK VII Autmaticaly disable task Classes/Task/SampleTask.php <?php ! namespace VScheduler7Task; ! class SampleTask extends TYPO3CMSSchedulerTaskAbstractTask { ! public $counter = 10; ! public function execute() { $this->counter = $this->counter - 1; if ($this->counter === 0) { // $this->remove(); $this->setDisabled(TRUE); } $this->save(); return TRUE; } ! public function getAdditionalInformation() { return $this->counter; } ! }
  • 36. THINGS TO REMEMBER Object is serialized once on creation of scheduler task so all future changes to methods or properties can lead to errors. The solution then is to delete the scheduler task and create new one.
  • 38. CLI Command Line Interface ! One of SAPI the PHP interact with different env - here with shell. Others SAPI examples: CGI, fpm , apache2handler CLI points: • No execution time limit by default. • No headers are send. • No path is changed while running by default
  • 39. CLI Command Line Interface php typo3/cli_dispatch.phpsh
  • 45. EXTBASE COMMAND CENTER Backport from TYPO3 FLOW $ php cli_dispatch.phpsh extbase <command identifier> --argumentName=value $ php cli_dispatch.phpsh extbase scheduler6:sample:second --name=adam --number=12 --enabled This will call: —> extension scheduler6 —> class SampleCommandController —> method secondCommand typo3conf/ext/scheduler6/Classes/Command/SampleCommandController.php secondCommand($name, $number, $enabled = true)
  • 46. ext_localconf.php <?php ! $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'VScheduler6Command SampleCommandController'; typo3conf/ext/scheduler6/Classes/Command/SampleCommandController.php /** * Class SampleCommandController * @package VScheduler6Command */ class SampleCommandController extends TYPO3CMSExtbaseMvcControllerCommandController { ! /** * Get Faq title for given uid * * This text goes into description of CLI * so you see when you will do php typo3/cli_dispatch.phpsh extbase help scheduler6:sample:newsTitle. * Second line of description. * Third line of description. * * @param integer $faqUid Faq uid * @return void */ public function faqTitleCommand($faqUid) { $faqUid = intval($faqUid); if ($faqUid) { $faqRepository = $this->getFaqRepository(); $faq = $faqRepository->findByUid($faqUid); if(NULL !== $faq){ $this->outputLine($faq->getQuestion()); } } }
  • 47. php typo3/cli_dispatch.phpsh extbase help scheduler6:sample:faqTitle All texts are taken from class comment / arguments !!!
  • 48. EXTBASE COMMAND CENTER ext_localconf.php <?php ! $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'VScheduler6Command SampleCommandController'; typo3conf/ext/scheduler6/Classes/Command/SampleCommandController.php /** * Class SampleCommandController * @package VScheduler6Command */ class SampleCommandController extends TYPO3CMSExtbaseMvcControllerCommandController { ! /** * Get Faq title for given uid * * This text goes into description of CLI * so you see when you will do php typo3/cli_dispatch.phpsh extbase help scheduler6:sample:newsTitle. * Second line of description. * Third line of description. * * @param integer $faqUid Faq uid * @return void */ public function faqTitleCommand($faqUid) { $faqUid = intval($faqUid); if ($faqUid) { $faqRepository = $this->getFaqRepository(); $faq = $faqRepository->findByUid($faqUid); if(NULL !== $faq){ $this->outputLine($faq->getQuestion()); } } }
  • 49.
  • 52. CLEARTYPO3CACHE $ php cli_dispatch.phpsh cleartypo3cache all $ php cli_dispatch.phpsh cleartypo3cache pages https://github.com/t33k/cleartypo3cache $ php cli_dispatch.phpsh cleartypo3cache system Create BE user "_cli_cleartypo3cache" with TS settings options.clearCache.all=1 options.clearCache.pages=1 options.clearCache.system=1
  • 54. T3DEPLOY https://github.com/AOEmedia/t3deploy Update only (more safe) php typo3/cli_dispatch.phpsh t3deploy database updateStructure --verbose --execute Remove also php typo3/cli_dispatch.phpsh t3deploy database updateStructure --remove --verbose --execute
  • 55. THANK YOU! Krystian Szymukowicz k.szymukowicz@sourcebroker.net