From 8216c5ee690f97b9f8f8ac967dac5c5f3745a00f Mon Sep 17 00:00:00 2001 From: Till Brehm <tbrehm@ispconfig.org> Date: Tue, 12 Apr 2016 06:18:24 -0400 Subject: [PATCH] Fixed: Issue #3820 v3.1 Shell user wrong default Base Dir in GUI results to corrupt shell user home directory creation. --- server/lib/classes/db_mysql.inc.php | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php index f11b8a2..7c46820 100644 --- a/server/lib/classes/db_mysql.inc.php +++ b/server/lib/classes/db_mysql.inc.php @@ -554,21 +554,24 @@ public function getDatabaseSize($database_name) { global $app; + include 'lib/mysql_clientdb.conf'; + /* Connect to the database */ - $link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password); + $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password); if (!$link) { - $app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_DEBUG); + $app->log('Unable to connect to the database'.mysqli_connect_error(), LOGLEVEL_DEBUG); return; } + /* Get database-size from information_schema */ - $result=mysql_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysql_real_escape_string($database_name)."';", $link); - $this->close; - if (!$result) { - $app->log('Unable to get the database-size'.mysql_error($link), LOGLEVEL_DEBUG); + $result = mysqli_query($link, "SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysqli_real_escape_string($link, $database_name)."'"); + if(!$result) { + $app->log('Unable to get the database-size for ' . $database_name . ': '.mysqli_error($link), LOGLEVEL_DEBUG); return; } - $database_size = mysql_fetch_row($result); + $database_size = mysqli_fetch_row($result); + mysqli_close($link); return $database_size[0]; } @@ -648,7 +651,7 @@ $old_rec = array(); $index_value = $this->insertID(); - $new_rec = $this->queryOneRecord("SELECT * FROM ?? WHERE ? = ?", $tablename, $index_field, $index_value); + $new_rec = $this->queryOneRecord("SELECT * FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value); $this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec); return $index_value; -- Gitblit v1.9.1