From 8b18bcbe7be53bcfdacec0511ed1010d98d6a697 Mon Sep 17 00:00:00 2001
From: Alexander Stehlik <alexander.stehlik@gmail.com>
Date: Fri, 2 Dec 2016 15:32:10 +0100
Subject: [PATCH] [BUGFIX] Re-enable environment status report in Backend

The condition that checks for CLI mode in the ext_tables.php of
the install tool is fixed.

The EnvironmentStatusReport is now active in the Backend and
not on CLI.

The additional checks added in #78786 are not required any more
and are reverted.

Change-Id: I4d364fc08c68c7c25d9210c08b813247bee7d47f
Resolves: #78854
Relates: #78786
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/50825
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
---
 typo3/sysext/install/Classes/SystemEnvironment/Check.php  | 8 ++------
 .../install/Classes/SystemEnvironment/SetupCheck.php      | 3 ---
 typo3/sysext/install/ext_tables.php                       | 2 +-
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/typo3/sysext/install/Classes/SystemEnvironment/Check.php b/typo3/sysext/install/Classes/SystemEnvironment/Check.php
index 68fcf16dc5ff..087d7c60babc 100644
--- a/typo3/sysext/install/Classes/SystemEnvironment/Check.php
+++ b/typo3/sysext/install/Classes/SystemEnvironment/Check.php
@@ -311,11 +311,8 @@ class Check
     {
         $minimumMaximumExecutionTime = 30;
         $recommendedMaximumExecutionTime = 240;
-        $currentMaximumExecutionTime = (int)ini_get('max_execution_time');
-        if (PHP_SAPI === 'cli' && $currentMaximumExecutionTime === 0) {
-            $status = new Status\NoticeStatus();
-            $status->setTitle('Infinite PHP script execution time detected, which is admissible on the CLI');
-        } elseif ($currentMaximumExecutionTime === 0) {
+        $currentMaximumExecutionTime = ini_get('max_execution_time');
+        if ($currentMaximumExecutionTime == 0) {
             $status = new Status\WarningStatus();
             $status->setTitle('Infinite PHP script execution time');
             $status->setMessage(
@@ -351,7 +348,6 @@ class Check
             $status->setTitle('Maximum PHP script execution time is equal to or more than '
                 . $recommendedMaximumExecutionTime);
         }
-
         return $status;
     }
 
diff --git a/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php b/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php
index 2479fd150056..14c19c17d341 100644
--- a/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php
+++ b/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php
@@ -60,9 +60,6 @@ class SetupCheck
             $status = new Status\WarningStatus();
             $status->setTitle('Trusted hosts pattern is insecure');
             $status->setMessage('Trusted hosts pattern is configured to allow all header values. Check the pattern defined in Install Tool -> All configuration -> System -> trustedHostsPattern and adapt it to expected host value(s).');
-        } elseif (PHP_SAPI === 'cli') {
-            $status = new Status\NoticeStatus();
-            $status->setTitle('Trusted hosts pattern cannot be checked on the CLI');
         } else {
             if (GeneralUtility::hostHeaderValueMatchesTrustedHostsPattern($_SERVER['HTTP_HOST'])) {
                 $status = new Status\OkStatus();
diff --git a/typo3/sysext/install/ext_tables.php b/typo3/sysext/install/ext_tables.php
index 1b3e4bf65c5f..5fef66943327 100644
--- a/typo3/sysext/install/ext_tables.php
+++ b/typo3/sysext/install/ext_tables.php
@@ -7,7 +7,7 @@ if (TYPO3_MODE === 'BE') {
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['security'][] = \TYPO3\CMS\Install\Report\SecurityStatusReport::class;
 
     // Only add the environment status report if not in CLI mode
-    if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
+    if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) {
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['system'][] = \TYPO3\CMS\Install\Report\EnvironmentStatusReport::class;
     }
 
-- 
GitLab