Project

General

Profile

Feature #52283 ยป patch.diff

Simon Schick, 2013-09-26 11:40

View differences:

typo3/sysext/install/Classes/Report/EnvironmentStatusReport.php
'ok' => array(),
'information' => array(),
'notice' => array(),
'skipped' => array(),
);
/** @var $statusObject \TYPO3\CMS\Install\Status\AbstractStatus */
/** @var $statusObject \TYPO3\CMS\Install\Status\StatusInterface */
foreach ($statusObjects as $statusObject) {
$severityIdentifier = $statusObject->getSeverity();
if (empty($severityIdentifier) || !is_array($reportStatusTypes[$severityIdentifier])) {
typo3/sysext/install/Classes/Status/SkippedStatus.php
<?php
namespace TYPO3\CMS\Install\Status;
/***************************************************************
* Copyright notice
*
* (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Warning level status
*
* @author Christian Kuhn <lolli@schwarzbu.ch>
*/
class SkippedStatus extends AbstractStatus implements StatusInterface {
/**
* @var string The severity
*/
protected $severity = 'skipped';
}
?>
typo3/sysext/install/Classes/Status/StatusUtility.php
'ok' => $this->filterBySeverity($statusObjects, 'ok'),
'information' => $this->filterBySeverity($statusObjects, 'information'),
'notice' => $this->filterBySeverity($statusObjects, 'notice'),
'skipped' => $this->filterBySeverity($statusObjects, 'skipped'),
);
return $orderedStatus;
}
typo3/sysext/install/Classes/SystemEnvironment/Check.php
* @return Status\StatusInterface
*/
protected function checkFileUploadEnabled() {
if (!ini_get('file_uploads')) {
if (PHP_SAPI === 'cli') {
$status = new Status\SkippedStatus();
$status->setTitle('File uploads not relevant on CLI');
} elseif (!ini_get('file_uploads')) {
$status = new Status\ErrorStatus();
$status->setTitle('File uploads not allowed in PHP');
$status->setMessage(
......
*/
protected function checkMaximumFileUploadSize() {
$maximumUploadFilesize = $this->getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
if ($maximumUploadFilesize < 1024 * 1024 * 10) {
if ($this->checkFileUploadEnabled() instanceof Status\SkippedStatus) {
$status = new Status\SkippedStatus();
$status->setTitle('Check for "file uploads enabled" was skipped, so the check for the upload_max_filesize');
} elseif ($maximumUploadFilesize < 1024 * 1024 * 10) {
$status = new Status\ErrorStatus();
$status->setTitle('PHP Maximum upload filesize too small');
$status->setMessage(
......
$recommendedMemoryLimit = 64;
$memoryLimit = $this->getBytesFromSizeMeasurement(ini_get('memory_limit'));
if ($memoryLimit <= 0) {
$status = new Status\WarningStatus();
$status->setTitle('Unlimited memory limit for PHP');
$status->setMessage(
'PHP is configured to not limit memory usage at all. This is a risk' .
' and should be avoided in production setup. In general it\'s best practice to limit this.' .
' To be safe, set a limit in PHP, but with a minimum of ' . $recommendedMemoryLimit . 'MB:' . LF .
'memory_limit=' . $recommendedMemoryLimit . 'M'
);
if (PHP_SAPI === 'cli') {
$status = new Status\SkippedStatus();
$status->setMessage(
'PHP is configured to not limit memory usage at all for scripts running on the commandline.'
);
} else {
$status = new Status\WarningStatus();
$status->setTitle('Unlimited memory limit for PHP');
$status->setMessage(
'PHP is configured to not limit memory usage at all. This is a risk' .
' and should be avoided in production setup. In general it\'s best practice to limit this.' .
' To be safe, set a limit in PHP, but with a minimum of ' . $recommendedMemoryLimit . 'MB:' . LF .
'memory_limit=' . $recommendedMemoryLimit . 'M'
);
}
} elseif ($memoryLimit < 1024 * 1024 * $minimumMemoryLimit) {
$status = new Status\ErrorStatus();
$status->setTitle('PHP Memory limit below ' . $minimumMemoryLimit . 'MB');
......
$currentMaximumExecutionTime = ini_get('max_execution_time');
if ($currentMaximumExecutionTime == 0) {
if (PHP_SAPI === 'cli') {
$status = new Status\OkStatus();
$status = new Status\SkippedStatus();
$status->setTitle('Infinite PHP script execution time');
$status->setMessage(
'Maximum PHP script execution time is always set to infinite (0) in cli mode.' .
typo3/sysext/install/Resources/Public/Stylesheets/Action/Common/Install.css
margin-top: 0;
}
.message-skipped,
.message-notice {
background-image: url("../../../Images/Icon/Notice.png");
background-color: #f6f7fa;
typo3/sysext/install/Resources/Public/Stylesheets/Action/Step/General.css
margin-top: 0;
}
.message-skipped,
.message-notice {
background-image: url("../../../Images/Icon/Notice.png");
background-color: #f6f7fa;
typo3/sysext/reports/Classes/Report/Status/Status.php
* @return integer The highest severity found from the statuses.
*/
public function getHighestSeverity(array $statusCollection) {
$highestSeverity = \TYPO3\CMS\Reports\Status::NOTICE;
$highestSeverity = \TYPO3\CMS\Reports\Status::SKIPPED;
foreach ($statusCollection as $statusProvider => $providerStatuses) {
/** @var $status \TYPO3\CMS\Reports\Status */
foreach ($providerStatuses as $status) {
......
$providerState = $this->sortStatuses($providerStatus);
$id = str_replace(' ', '-', $provider);
$classes = array(
\TYPO3\CMS\Reports\Status::SKIPPED => 'skipped',
\TYPO3\CMS\Reports\Status::NOTICE => 'notice',
\TYPO3\CMS\Reports\Status::INFO => 'information',
\TYPO3\CMS\Reports\Status::OK => 'ok',
typo3/sysext/reports/Classes/Status.php
*/
class Status {
const SKIPPED = -3;
const NOTICE = -2;
const INFO = -1;
const OK = 0;
......
$this->title = (string) $title;
$this->value = (string) $value;
$this->message = (string) $message;
$this->severity = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($severity, self::NOTICE, self::ERROR, self::OK);
$this->severity = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($severity, self::SKIPPED, self::ERROR, self::OK);
}
/**
......
*/
public function __toString() {
$severity = array(
self::SKIPPED => 'SKIP',
self::NOTICE => 'NOTE',
self::INFO => 'INFO',
self::OK => 'OK',
    (1-1/1)