Skip to content

Commit c213e66

Browse files
author
Till Brehm
committed
Merge branch 'sql_mode' into 'master'
SQL mode fixed (install.php and update.php) This should simplify https://www.howtoforge.com/the-perfect-server-opensuse-13.1-with-apache2-mysql-php-postfix-and-ispconfig-3-p4 **step 8** and fix !480 See merge request !517
2 parents a00cc14 + 75c4f02 commit c213e66

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

install/lib/installer_base.lib.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,8 @@ public function reconfigure_app($service, $reconfigure_services_answer) {
224224
public function configure_database() {
225225
global $conf;
226226

227-
//* check sql-mode
228-
$check_sql_mode = $this->db->queryOneRecord("SELECT @@sql_mode");
229-
if ($check_sql_mode['@@sql_mode'] != '' && strpos($check_sql_mode['@@sql_mode'],'NO_ENGINE_SUBSTITUTION')===false) {
230-
echo "Wrong SQL-mode. You should use NO_ENGINE_SUBSTITUTION. Add\n\n";
231-
echo " sql-mode=\"NO_ENGINE_SUBSTITUTION\"\n\n";
232-
echo"to the mysqld-section in your mysql-config on the server\n";
233-
die();
234-
}
227+
//* ensure no modes with errors for ENGINE=MyISAM
228+
$this->db->query("SET sql_mode = ''");
235229

236230
//** Create the database
237231
if(!$this->db->query('CREATE DATABASE IF NOT EXISTS ?? DEFAULT CHARACTER SET ?', $conf['mysql']['database'], $conf['mysql']['charset'])) {

install/lib/update.lib.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,8 @@ function checkDbHealth() {
123123
function updateDbAndIni() {
124124
global $inst, $conf;
125125

126-
//* check sql-mode
127-
$check_sql_mode = $inst->db->queryOneRecord("SELECT @@sql_mode");
128-
if ($check_sql_mode['@@sql_mode'] != '' && strpos($check_sql_mode['@@sql_mode'],'NO_ENGINE_SUBSTITUTION')===false) {
129-
echo "Wrong SQL-mode. You should use NO_ENGINE_SUBSTITUTION. Add\n\n";
130-
echo " sql-mode=\"NO_ENGINE_SUBSTITUTION\"\n\n";
131-
echo"to the mysqld-section in your mysql-config on the server\n";
132-
die();
133-
}
126+
//* ensure no modes with errors for ENGINE=MyISAM
127+
$this->db->query("SET sql_mode = ''");
134128

135129
//* Update $conf array with values from the server.ini that shall be preserved
136130
$tmp = $inst->db->queryOneRecord("SELECT * FROM ?? WHERE server_id = ?", $conf["mysql"]["database"] . '.server', $conf['server_id']);

0 commit comments

Comments
 (0)