[TASK] Replace Space Indent into Tab indent (CGL Cleanup)
[Packages/TYPO3.CMS.git] / typo3 / sysext / scheduler / examples / class.tx_scheduler_sleeptask.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009-2011 Fran├žois Suter <francois@typo3.org>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Class "tx_scheduler_SleepTask" provides a task that sleeps for some time
27 * This is useful for testing parallel executions
28 *
29 * @author Fran├žois Suter <francois@typo3.org>
30 * @package TYPO3
31 * @subpackage tx_scheduler
32 */
33 class tx_scheduler_SleepTask extends tx_scheduler_Task {
34
35 /**
36 * Number of seconds the task should be sleeping for
37 *
38 * @var integer $sleepTime
39 */
40 public $sleepTime = 10;
41
42 /**
43 * Function executed from the Scheduler.
44 * Goes to sleep ;-)
45 *
46 * @return boolean
47 */
48 public function execute() {
49 $time = 10;
50
51 if (!empty($this->sleepTime)) {
52 $time = $this->sleepTime;
53 }
54
55 sleep($time);
56
57 return TRUE;
58 }
59
60 /**
61 * This method returns the sleep duration as additional information
62 *
63 * @return string Information to display
64 */
65 public function getAdditionalInformation() {
66 return $GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:label.sleepTime') . ': ' . $this->sleepTime;
67 }
68 }
69 ?>