From c8cd0a043fc1e8df54f62fc15aeae45d329c9b5d Mon Sep 17 00:00:00 2001 From: Ingo Renner <ingo.renner@typo3.org> Date: Tue, 18 Jan 2011 10:20:41 +0000 Subject: [PATCH] Added feature #17101: [reports] Warning in reports module for enabled PHP safe_mode, credits Christian Kuhn git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10115 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 4 +++ typo3/sysext/reports/ChangeLog | 4 +++ typo3/sysext/reports/reports/locallang.xml | 2 ++ ...rts_reports_status_configurationstatus.php | 26 +++++++++++++++++-- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 458667e31e88..0b902f70d5d4 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-01-18 Ingo Renner <ingo@typo3.org> + + * Added feature #17101: [reports] Warning in reports module for enabled PHP safe_mode, credits Christian Kuhn + 2011-01-17 Ernesto Baschny <ernst@cron-it.de> * Follow-up to #15611: Mention the change of behaviour on copy/translate (hidden by default) in NEWS.txt diff --git a/typo3/sysext/reports/ChangeLog b/typo3/sysext/reports/ChangeLog index 6cdfbd08991c..1f0bf9d7d3bf 100644 --- a/typo3/sysext/reports/ChangeLog +++ b/typo3/sysext/reports/ChangeLog @@ -1,3 +1,7 @@ +2011-01-18 Ingo Renner <ingo@typo3.org> + + * Added feature #17101: Warning in reports module for enabled PHP safe_mode, credits Christian Kuhn + 2011-01-17 Ingo Renner <ingo@typo3.org> * Added feature #17033: Notification Emails for system status updates diff --git a/typo3/sysext/reports/reports/locallang.xml b/typo3/sysext/reports/reports/locallang.xml index 0a396db26776..1fee1a882601 100644 --- a/typo3/sysext/reports/reports/locallang.xml +++ b/typo3/sysext/reports/reports/locallang.xml @@ -26,6 +26,7 @@ <label index="status_configuration">Configuration</label> <label index="status_referenceIndex">Reference Index</label> <label index="status_memcachedConfiguration">Memcached Configuration</label> + <label index="status_PhpSafeMode">PHP safe_mode</label> <label index="status_adminUserAccount">Admin User Account</label> <label index="status_encryptionKey">Encryption Key</label> <label index="status_fileDenyPattern">File Deny Pattern</label> @@ -50,6 +51,7 @@ <label index="status_configuration_DeprecationLogEnabled">The deprecation log tracks whether old APIs are being used in extensions. Depending on the extensions you use and whether they use deprecated APIs it can happen that the log takes up quite some space over time. The more space it takes up, the more it may affect your installation's performance. It is recommended to disable deprecation log in production environments.</label> <label index="status_configuration_DeprecationLogFile">You can find the deprecation log file at %s.</label> <label index="status_configuration_DeprecationLogSize">Your deprecation log file currently takes up %s.</label> + <label index="status_configuration_PhpSafeModeEnabled">PHP INI setting safe_mode "On" is discouraged since PHP 5.2 and deprecated since PHP 5.3 and should not be used anymore.</label> <label index="status_updateTaskTitle">System Status Update</label> <label index="status_updateTaskDescription">Runs a system status check and sends notifications if problems have been found.</label> <label index="status_updateTaskField_notificationEmail">Notification Email Address</label> diff --git a/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php b/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php index 37360c13bce9..f93f907bb46a 100644 --- a/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php +++ b/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php @@ -41,7 +41,7 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status /** * Backpath to the typo3 main directory - * + * * @var string */ protected $backPath = '../'; @@ -55,7 +55,8 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status public function getStatus() { $statuses = array( 'emptyReferenceIndex' => $this->getReferenceIndexStatus(), - 'deprecationLog' => $this->getDeprecationLogStatus() + 'deprecationLog' => $this->getDeprecationLogStatus(), + 'safeModeEnabled' => $this->getPhpSafeModeStatus() ); if ($this->isMemcachedUsed()) { @@ -96,6 +97,27 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status ); } + /** + * Checks if PHP safe_mode is enabled. + * + * @return tx_reports_reports_status_Status A tx_reports_reports_status_Status object representing whether the safe_mode is enabled or not + */ + protected function getPhpSafeModeStatus() { + $value = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:disabled'); + $message = ''; + $severity = tx_reports_reports_status_Status::OK; + + if (t3lib_utility_PhpOptions::isSafeModeEnabled()) { + $value = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:enabled'); + $severity = tx_reports_reports_status_Status::WARNING; + $message = $GLOBALS['LANG']->sL('status_configuration_PhpSafeModeEnabled'); + } + + return t3lib_div::makeInstance('tx_reports_reports_status_Status', + $GLOBALS['LANG']->getLL('status_PhpSafeMode'), $value, $message, $severity + ); + } + /** * Checks whether memcached is configured, if that's the case we asume it's also used. * -- GitLab