[BUGFIX] max_execution_time check fails 79/20679/6
authorAdrian Dymorz <dev@adrian.dymorz.ch>
Thu, 9 May 2013 20:48:32 +0000 (22:48 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 12 May 2013 00:50:37 +0000 (02:50 +0200)
Fix for wrong error message in system environment check. Checking
max_execution_time fails in cli mode.

Resolves: #48095
Releases: 6.1, 6.2
Change-Id: I5cfe59dfab680d49a2b1b023a09e2d8d458345f4
Reviewed-on: https://review.typo3.org/20679
Reviewed-by: Markus Klein
Reviewed-by: Laurent Cherpit
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index 02df222..08f5bfe 100644 (file)
@@ -319,15 +319,24 @@ class Check {
                $minimumMaximumExecutionTime = 30;
                $recommendedMaximumExecutionTime = 240;
                $currentMaximumExecutionTime = ini_get('max_execution_time');
-               if ($currentMaximumExecutionTime == 0 && PHP_SAPI !== 'cli') {
-                       $status = new Status\WarningStatus();
-                       $status->setTitle('Infinite PHP script execution time');
-                       $status->setMessage(
-                               'Your max_execution_time is set to 0 (infinite). While TYPO3 is fine' .
-                               ' with this, you risk a denial-of-service of you system if for whatever' .
-                               ' reason some script hangs in an infinite loop. You are usually on safe side ' .
-                               ' if max_execution_time is reduced to ' . $recommendedMaximumExecutionTime
-                       );
+               if ($currentMaximumExecutionTime == 0) {
+                       if (PHP_SAPI === 'cli') {
+                               $status = new Status\OkStatus();
+                               $status->setTitle('Infinite PHP script execution time');
+                               $status->setMessage(
+                                       'Maximum PHP script execution time is always set to infinite (0) in cli mode.' .
+                                       ' The setting used for web requests can not be checked from command line.'
+                               );
+                       } else {
+                               $status = new Status\WarningStatus();
+                               $status->setTitle('Infinite PHP script execution time');
+                               $status->setMessage(
+                                       'Your max_execution_time is set to 0 (infinite). While TYPO3 is fine' .
+                                       ' with this, you risk a denial-of-service of you system if for whatever' .
+                                       ' reason some script hangs in an infinite loop. You are usually on safe side ' .
+                                       ' if max_execution_time is reduced to ' . $recommendedMaximumExecutionTime
+                               );
+                       }
                } elseif ($currentMaximumExecutionTime < $minimumMaximumExecutionTime) {
                        $status = new Status\ErrorStatus();
                        $status->setTitle('Low PHP script execution time');
@@ -348,7 +357,7 @@ class Check {
                        );
                } else {
                        $status = new Status\OkStatus();
-                       $status->setTitle('Maximum PHP script execution equals ' . $recommendedMaximumExecutionTime . ' or more');
+                       $status->setTitle('Maximum PHP script execution time equals ' . $recommendedMaximumExecutionTime . ' or more');
                }
                return $status;
        }