From 8661808ce472dabed1660cfac80273d30cf194bc Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Tue, 14 Jul 2015 23:05:00 +0200
Subject: [PATCH] [BUGFIX] Scheduler tasks of deactivated exts should be
 considered invalid

If a scheduler task is created and the extension which provides the task is
deactivated the task must be shown as invalid in the list- and edit-view.

Change-Id: Iaf63c48c73ddaad64e153046d548eef5bbbcc7ae
Resolves: #68140
Releases: master
Reviewed-on: http://review.typo3.org/41246
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 .../Classes/Controller/SchedulerModuleController.php         | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
index 82c84daefa85..d8212cbf6790 100644
--- a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
+++ b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
@@ -563,7 +563,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
 				$taskInfo['task_group'] = $taskRecord['task_group'];
 
 				// Check that the task object is valid
-				if ($this->scheduler->isValidTaskObject($task)) {
+				if (isset($registeredClasses[get_class($task)]) && $this->scheduler->isValidTaskObject($task)) {
 					// The task object is valid, process with fetching current data
 					$taskInfo['class'] = get_class($task);
 					// Get execution information
@@ -944,6 +944,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
 				$temporaryResult[$row['task_group']]['groupDescription'] = $row['taskGroupDescription'];
 				$temporaryResult[$row['task_group']]['tasks'][] = $row;
 			}
+			$registeredClasses = $this->getRegisteredClasses();
 			foreach ($temporaryResult as $taskGroup) {
 				if (!empty($taskGroup['groupName'])) {
 					$groupText = '<strong>' . htmlspecialchars($taskGroup['groupName']) . '</strong>';
@@ -995,7 +996,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
 						$lastExecution .= ' (' . $context . ')';
 					}
 
-					if ($this->scheduler->isValidTaskObject($task)) {
+					if (isset($registeredClasses[get_class($task)]) && $this->scheduler->isValidTaskObject($task)) {
 						// The task object is valid
 						$labels = array();
 						$name = htmlspecialchars($registeredClasses[$class]['title'] . ' (' . $registeredClasses[$class]['extension'] . ')');
-- 
GitLab