[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / scheduler / Classes / Example / SleepTask.php
1 <?php
2 namespace TYPO3\CMS\Scheduler\Example;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Provides a task that sleeps for some time
19 * This is useful for testing parallel executions
20 *
21 * @author Fran├žois Suter <francois@typo3.org>
22 */
23 class SleepTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
24
25 /**
26 * Number of seconds the task should be sleeping for
27 *
28 * @var integer $sleepTime
29 */
30 public $sleepTime = 10;
31
32 /**
33 * Function executed from the Scheduler.
34 * Goes to sleep ;-)
35 *
36 * @return boolean
37 */
38 public function execute() {
39 $time = 10;
40 if (!empty($this->sleepTime)) {
41 $time = $this->sleepTime;
42 }
43 sleep($time);
44 return TRUE;
45 }
46
47 /**
48 * This method returns the sleep duration as additional information
49 *
50 * @return string Information to display
51 */
52 public function getAdditionalInformation() {
53 return $GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xlf:label.sleepTime') . ': ' . $this->sleepTime;
54 }
55
56 }