Skip to content

Commit c59ab58

Browse files
author
Marius Burkard
committed
Merge branch 'stable-3.1'
2 parents 295bd9c + e6c83e7 commit c59ab58

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

server/lib/classes/db_mysql.inc.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,21 +554,24 @@ public function diffrec($record_old, $record_new) {
554554

555555
public function getDatabaseSize($database_name) {
556556
global $app;
557+
557558
include 'lib/mysql_clientdb.conf';
559+
558560
/* Connect to the database */
559561
$link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
560562
if (!$link) {
561563
$app->log('Unable to connect to the database'.mysqli_connect_error(), LOGLEVEL_DEBUG);
562564
return;
563565
}
566+
564567
/* Get database-size from information_schema */
565-
$result=mysqli_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysqli_real_escape_string($database_name)."';", $link);
566-
$this->close;
567-
if (!$result) {
568-
$app->log('Unable to get the database-size'.mysqli_error($link), LOGLEVEL_DEBUG);
568+
$result = mysqli_query($link, "SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysqli_real_escape_string($link, $database_name)."'");
569+
if(!$result) {
570+
$app->log('Unable to get the database-size for ' . $database_name . ': '.mysqli_error($link), LOGLEVEL_DEBUG);
569571
return;
570572
}
571573
$database_size = mysqli_fetch_row($result);
574+
mysqli_close($link);
572575
return $database_size[0];
573576
}
574577

0 commit comments

Comments
 (0)