From 88850144a2ffe3a960ddcde44b8e441f595ae714 Mon Sep 17 00:00:00 2001 From: Markus Sommer <markussom@posteo.de> Date: Fri, 25 Nov 2016 11:54:27 +0100 Subject: [PATCH] [BUGFIX] Disable not required checks on cli * $_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 | 8 ++++++-- .../install/Classes/SystemEnvironment/SetupCheck.php | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/install/Classes/SystemEnvironment/Check.php b/typo3/sysext/install/Classes/SystemEnvironment/Check.php index 087d7c60babc..68fcf16dc5ff 100644 --- a/typo3/sysext/install/Classes/SystemEnvironment/Check.php +++ b/typo3/sysext/install/Classes/SystemEnvironment/Check.php @@ -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; } diff --git a/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php b/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php index 14c19c17d341..2479fd150056 100644 --- a/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php +++ b/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php @@ -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(); -- GitLab