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