[TASK] Merge submodule version into core
[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-2013 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 /**
28 * Provides a task that sleeps for some time
29 * This is useful for testing parallel executions
30 *
31 * @author Fran├žois Suter <francois@typo3.org>
32 */
33 class SleepTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
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 if (!empty($this->sleepTime)) {
51 $time = $this->sleepTime;
52 }
53 sleep($time);
54 return TRUE;
55 }
56
57 /**
58 * This method returns the sleep duration as additional information
59 *
60 * @return string Information to display
61 */
62 public function getAdditionalInformation() {
63 return $GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:label.sleepTime') . ': ' . $this->sleepTime;
64 }
65
66 }
67
68
69 ?>