Marius Burkard
2016-02-18 e6c83e73b40054457c6ab1c3d3105ba0876564c9
- Fixed database quota (Fixes #3766 and #3765)
1 files modified
9 ■■■■■ changed files
server/lib/classes/db_mysql.inc.php 9 ●●●●● patch | view | raw | blame | history
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 = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
        if (!$link) {
            $app->log('Unable to connect to the database'.mysqli_connect_error(), LOGLEVEL_DEBUG);
            return;
        }
        /* Get database-size from information_schema */
        $result=mysqli_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysqli_real_escape_string($database_name)."';", $link);
        $this->close;
        $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'.mysqli_error($link), LOGLEVEL_DEBUG);
            $app->log('Unable to get the database-size for ' . $database_name . ': '.mysqli_error($link), LOGLEVEL_DEBUG);
            return;
        }
        $database_size = mysqli_fetch_row($result);
        mysqli_close($link);
        return $database_size[0];
    }