2 namespace TYPO3\CMS\Install\SystemEnvironment;
18 use TYPO3\CMS\Install\Status;
38 'STRICT_TRANS_TABLES',
39 'NO_BACKSLASH_ESCAPES'
49 $statusArray = array();
50 if ($this->
isDbalEnabled() || !$this->getDatabaseConnection()) {
66 if (!empty($detectedIncompatibleSqlModes)) {
68 $status->setTitle(
'Incompatible SQL modes found!');
70 'Incompatible SQL modes have been detected:' .
71 ' ' . implode(
', ', $detectedIncompatibleSqlModes) .
'.' .
72 ' The listed modes are not compatible with TYPO3 CMS.' .
73 ' You have to change that setting in your MySQL environment' .
74 ' or in $GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'setDBinit\']'
78 $status->setTitle(
'No incompatible SQL modes found.');
91 $minimumMysqlVersion =
'5.5.0';
92 $currentMysqlVersion =
'';
93 $resource = $this->getDatabaseConnection()->sql_query(
'SHOW VARIABLES LIKE \'version\';');
94 if ($resource !==
false) {
95 $result = $this->getDatabaseConnection()->sql_fetch_row($resource);
96 if (isset($result[1])) {
97 $currentMysqlVersion = $result[1];
100 if (version_compare($currentMysqlVersion, $minimumMysqlVersion) < 0) {
102 $status->setTitle(
'MySQL version too low');
104 'Your MySQL version ' . $currentMysqlVersion .
' is too old. TYPO3 CMS does not run' .
105 ' with this version. Update to at least MySQL ' . $minimumMysqlVersion
109 $status->setTitle(
'MySQL version is fine');
123 $resource = $this->getDatabaseConnection()->sql_query(
'SELECT @@SESSION.sql_mode;');
124 if ($resource !==
false) {
125 $result = $this->getDatabaseConnection()->sql_fetch_row($resource);
126 if (isset($result[0])) {
127 $sqlModes = explode(
',', $result[0]);
130 return array_intersect($this->incompatibleSqlModes, $sqlModes);
139 protected function getDatabaseConnection()
142 if (!is_object($database)) {
145 $database->setDatabaseUsername(
$GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'username']);
146 $database->setDatabasePassword(
$GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'password']);
147 $database->setDatabaseHost(
$GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'host']);
148 $database->setDatabasePort(
$GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'port']);
149 $database->setDatabaseSocket(
$GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'socket']);
150 $database->setDatabaseName(
$GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'database']);
151 $database->initialize();
152 $database->connectDB();
164 return \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(
'dbal');