[FEATURE] Log to sys_log when changes are made to scheduler tasks
authorSoren Malling <soren.malling@gmail.com>
Sun, 19 Feb 2012 00:29:15 +0000 (01:29 +0100)
committerTolleiv Nietsch <info@tolleiv.de>
Mon, 20 Feb 2012 18:33:50 +0000 (19:33 +0100)
To keep track of who created what task, introduce logging.

Logging is done for create, edit and delete.

Change-Id: I50003c6a8e9fc68137b06b7c692ba89bad02f87e
Resolves: #34056
Releases: 4.7
Reviewed-on: http://review.typo3.org/9095
Reviewed-by: Joh. Feustel
Tested-by: Joh. Feustel
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Georg Ringer
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
typo3/sysext/scheduler/class.tx_scheduler_module.php
typo3/sysext/scheduler/class.tx_scheduler_task.php

index 2848f62..5d5c899 100644 (file)
@@ -532,6 +532,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                                $this->addMessage($GLOBALS['LANG']->getLL('msg.maynotDeleteRunningTask'), t3lib_FlashMessage::ERROR);
                        } else {
                                if ($this->scheduler->removeTask($task)) {
+                                       $GLOBALS['BE_USER']->writeLog(4, 0, 0, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was deleted', array($task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()));
                                        $this->addMessage($GLOBALS['LANG']->getLL('msg.deleteSuccess'));
                                } else {
                                        $this->addMessage($GLOBALS['LANG']->getLL('msg.deleteError'), t3lib_FlashMessage::ERROR);
@@ -1273,6 +1274,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                                // Save to database
                        $result = $this->scheduler->saveTask($task);
                        if ($result) {
+                               $GLOBALS['BE_USER']->writeLog(4, 0, 0, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was updated', array($task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()));
                                $this->addMessage($GLOBALS['LANG']->getLL('msg.updateSuccess'));
                        } else {
                                $this->addMessage($GLOBALS['LANG']->getLL('msg.updateError'), t3lib_FlashMessage::ERROR);
@@ -1306,6 +1308,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                                // Add to database
                        $result = $this->scheduler->addTask($task);
                        if ($result) {
+                               $GLOBALS['BE_USER']->writeLog(4, 0, 0, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was added', array($task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()));
                                $this->addMessage($GLOBALS['LANG']->getLL('msg.addSuccess'));
                        } else {
                                $this->addMessage($GLOBALS['LANG']->getLL('msg.addError'), t3lib_FlashMessage::ERROR);
index 7a07e99..caa6832 100755 (executable)
@@ -121,6 +121,33 @@ abstract class tx_scheduler_Task {
                return $this->taskUid;
        }
 
+       /**
+        * This method returns the title of the scheduler task
+        *
+        * @return string
+        */
+       public function getTaskTitle() {
+               return $GLOBALS['LANG']->sL($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][get_class($this)]['title']);
+       }
+
+       /**
+        * This method returns the description of the scheduler task
+        *
+        * @return string
+        */
+       public function getTaskDescription() {
+               return $GLOBALS['LANG']->sL($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][get_class($this)]['description']);
+       }
+
+       /**
+        * This method returns the class name of the scheduler task
+        *
+        * @return string
+        */
+       public function getTaskClassName() {
+               return get_class($this);
+       }
+
        /**
         * This method returns the disable status of the task
         *