[BUGFIX] Disable not required checks on cli 77/50777/6
authorMarkus Sommer <markussom@posteo.de>
Fri, 25 Nov 2016 10:54:27 +0000 (11:54 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 1 Dec 2016 13:22:50 +0000 (14:22 +0100)
* $_SERVER['HTTP_HOST'] is not avalible on cli
* Mostly max_execution_time is not set on cli

Resolves: #78786
Releases: master, 7.6
Change-Id: If19dab862e2762fab5fec113c93eba80f75a4aaf
Reviewed-on: https://review.typo3.org/50777
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Eglseder <typo3org@vxvr.de>
Tested-by: Oliver Eglseder <typo3org@vxvr.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/install/Classes/SystemEnvironment/Check.php
typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php

index 087d7c6..68fcf16 100644 (file)
@@ -311,8 +311,11 @@ class Check
     {
         $minimumMaximumExecutionTime = 30;
         $recommendedMaximumExecutionTime = 240;
-        $currentMaximumExecutionTime = ini_get('max_execution_time');
-        if ($currentMaximumExecutionTime == 0) {
+        $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) {
             $status = new Status\WarningStatus();
             $status->setTitle('Infinite PHP script execution time');
             $status->setMessage(
@@ -348,6 +351,7 @@ class Check
             $status->setTitle('Maximum PHP script execution time is equal to or more than '
                 . $recommendedMaximumExecutionTime);
         }
+
         return $status;
     }
 
index 14c19c1..2479fd1 100644 (file)
@@ -60,6 +60,9 @@ 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();