[!!!][TASK] Rewrite install tool
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Utility / PhpOptionsUtility.php
1 <?php
2 namespace TYPO3\CMS\Core\Utility;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2010-2013 Christian Kuhn <lolli@schwarzbu.ch>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * Class to handle php environment specific options / functions
31 *
32 * @author Christian Kuhn <lolli@schwarzbu.ch>
33 */
34 class PhpOptionsUtility {
35
36 /**
37 * Check if php safe_mode is enabled
38 *
39 * @return boolean TRUE if safe_mode is enabled, FALSE if disabled
40 * @deprecated since 6.1, will be removed two versions later
41 */
42 static public function isSafeModeEnabled() {
43 GeneralUtility::logDeprecatedFunction();
44 if (version_compare(phpversion(), '5.4', '<')) {
45 return self::getIniValueBoolean('safe_mode');
46 }
47 return FALSE;
48 }
49
50 /**
51 * Check if php magic_quotes_gpc is enabled
52 *
53 * @return boolean TRUE if magic_quotes_gpc is enabled, FALSE if disabled
54 * @deprecated since 6.1, will be removed two versions later
55 */
56 static public function isMagicQuotesGpcEnabled() {
57 GeneralUtility::logDeprecatedFunction();
58 if (version_compare(phpversion(), '5.4', '<')) {
59 return self::getIniValueBoolean('magic_quotes_gpc');
60 }
61 return FALSE;
62 }
63
64 /**
65 * Check if php sql.safe_mode is enabled
66 *
67 * @return boolean TRUE if sql.safe_mode is enabled, FALSE if disabled
68 * @deprecated since 6.2, will be removed two versions later
69 */
70 static public function isSqlSafeModeEnabled() {
71 GeneralUtility::logDeprecatedFunction();
72 return self::getIniValueBoolean('sql.safe_mode');
73 }
74
75 /**
76 * Check if php session.auto_start is enabled
77 *
78 * @return boolean TRUE if session.auto_start is enabled, FALSE if disabled
79 */
80 static public function isSessionAutoStartEnabled() {
81 return self::getIniValueBoolean('session.auto_start');
82 }
83
84 /**
85 * Cast a on/off php ini value to boolean
86 *
87 * @param string $configOption
88 * @return boolean TRUE if the given option is enabled, FALSE if disabled
89 */
90 static public function getIniValueBoolean($configOption) {
91 return filter_var(ini_get($configOption), FILTER_VALIDATE_BOOLEAN, array(FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE));
92 }
93
94 }
95
96
97 ?>