[TASK] Re-work/simplify copyright header in PHP files - Part 8
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Scheduler / Task.php
index 589d6bd..6fbd16c 100644 (file)
@@ -1,32 +1,18 @@
 <?php
 namespace TYPO3\CMS\Extbase\Scheduler;
 
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2013 Extbase Team (http://forge.typo3.org/projects/typo3v4-mvc)
- *  Extbase is a backport of TYPO3 Flow. All credits go to the TYPO3 Flow team.
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
+/**
+ * This file is part of the TYPO3 CMS project.
  *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
  *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
  *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ * The TYPO3 project - inspiring people to share!
+ */
 /**
  * Scheduler task to execute CommandController commands
  */
@@ -63,9 +49,34 @@ class Task extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
        protected $taskExecutor;
 
        /**
-        * Intanciates the Object Manager
+        * Instantiates the Object Manager
         */
        public function __construct() {
+               parent::__construct();
+               $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               $this->commandManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager');
+               $this->taskExecutor = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Scheduler\\TaskExecutor');
+       }
+
+       /**
+        * Sleep
+        *
+        * @return array Properties to serialize
+        */
+       public function __sleep() {
+               $properties = get_object_vars($this);
+               unset($properties['commandManager']);
+               unset($properties['objectManager']);
+               unset($properties['taskExecutor']);
+               return array_keys($properties);
+       }
+
+       /**
+        * Wakeup
+        *
+        * @return void
+        */
+       public function __wakeup() {
                $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                $this->commandManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager');
                $this->taskExecutor = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Scheduler\\TaskExecutor');
@@ -134,7 +145,7 @@ class Task extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
         */
        public function addDefaultValue($argumentName, $argumentValue) {
                if (is_bool($argumentValue)) {
-                       $argumentValue = intval($argumentValue);
+                       $argumentValue = (int)$argumentValue;
                }
                $this->defaults[$argumentName] = $argumentValue;
        }
@@ -165,5 +176,3 @@ class Task extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
                \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($e->getMessage(), $this->commandIdentifier, 3);
        }
 }
-
-?>
\ No newline at end of file