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
| | |
| | | |
| | | $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; |
| | | } |
| | |
| | | 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'] : ''; |