Till Brehm
2016-06-16 8225ad2d0778160477c5b23e6fc14d608578b796
Merge branch 'fix-db-stats' into 'stable-3.1'

Fix db stats - Please review

I think I found the fix... Please review if that's correct tough.
I just added sys_group.groupid = web_database.sys_groupid AND

closes ispconfig/ispconfig3#3963
closes ispconfig/ispconfig3#3920

See merge request !355
2 files modified
6 ■■■■ changed files
interface/lib/classes/quota_lib.inc.php 4 ●●●● patch | view | raw | blame | history
interface/web/sites/database_quota_stats.php 2 ●●● patch | view | raw | blame | history
interface/lib/classes/quota_lib.inc.php
@@ -312,13 +312,13 @@
    
                $databases[$i]['quota_raw'] = $databases[$i]['database_quota'];
                $databases[$i]['used_raw'] = $databases[$i]['used'] / 1024 / 1024; //* quota is stored as MB - calculated bytes
                $databases[$i]['used_percentage'] = (($databases[$i]['database_quota'] > 0) && ($databases[$i]['used'] > 0)) ? round($databases[$i]['used'] * 100 / $databases[$i]['database_quota']) : 0;
                $databases[$i]['used_percentage'] = (($databases[$i]['database_quota'] > 0) && ($databases[$i]['used'] > 0)) ? round($databases[$i]['used_raw'] * 100 / $databases[$i]['database_quota']) : 0;
    
                if ($readable) {
                    // colours
                    $databases[$i]['display_colour'] = '#000000';
                    if($databases[$i]['database_quota'] > 0){
                        $used_ratio = $databases[$i]['used']/$databases[$i]['database_quota'];
                        $used_ratio = $databases[$i]['used'] / $databases[$i]['database_quota'];
                    } else {
                        $used_ratio = 0;
                    }
interface/web/sites/database_quota_stats.php
@@ -29,7 +29,7 @@
        foreach($tmp_array as $database_name => $data) {
            $db_name = $data['database_name'];
            $temp = $app->db->queryOneRecord("SELECT client.username, web_database.database_quota FROM web_database, sys_group, client WHERE sys_group.client_id = client.client_id AND web_database.database_name = ?", $db_name);
            $temp = $app->db->queryOneRecord("SELECT client.username, web_database.database_quota FROM web_database, sys_group, client WHERE sys_group.groupid = web_database.sys_groupid AND sys_group.client_id = client.client_id AND web_database.database_name = ?", $db_name);
            if(is_array($temp) && !empty($temp)) {
                $monitor_data[$server_id.'.'.$db_name]['database_name'] = $data['database_name'];
                $monitor_data[$server_id.'.'.$db_name]['client'] = isset($temp['username']) ? $temp['username'] : '';