Commit b125fabc authored by Florian Schaal's avatar Florian Schaal
Browse files

add domain and username to db-size-monitoring

parent 366decb5
......@@ -124,9 +124,7 @@ class tools_monitor {
$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'database_size' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
if(isset($record['data'])) {
$data = unserialize($record['data']);
/*
Format the data
*/
//* format the data
$html =
'<div class="systemmonitor-state state-'.$record['state'].'">
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">
......@@ -136,13 +134,15 @@ class tools_monitor {
<td>'.$app->lng("monitor_database_name_txt").'</td>
<td>'.$app->lng("monitor_database_size_txt").'</td>
<td>'.$app->lng("monitor_database_client_txt").'</td>
<td>'.$app->lng("monitor_database_domain_txt").'</td>
</tr>';
foreach($data as $line) {
$html .= '<tr>';
if ($line['size'] > 0) $line['size'] = $app->functions->formatBytes($line['size']);
$t=$app->db->queryOneRecord("SELECT username FROM client WHERE sys_groupid = ".$line['client_id']);
$line['client_id']=$t['username'];
unset($t);
//* get the username
$line['sys_groupid']=$app->db->queryOneRecord("SELECT client.username FROM web_database, sys_group, client WHERE web_database.sys_groupid = sys_group.groupid AND sys_group.client_id = client.client_id AND web_database.database_name='".$line['name']."'")['username'];
//* get the domain
$line['domain']=$app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id=(SELECT parent_domain_id FROM web_database WHERE database_name='".$line['name']."')")['domain'];
foreach ($line as $item) {
$html .= '<td>' . $item . '</td>';
}
......
......@@ -84,7 +84,7 @@ class cronjob_monitor_database_size extends cronjob {
for ($i = 0; $i < sizeof($records); $i++) {
$data[$i]['name'] = $records[$i]['database_name'];
$data[$i]['size'] = $app->db->getDatabaseSize($data[$i]['name']);
$data[$i]['client_id'] = $records[$i]['sys_groupid'];
$data[$i]['sys_groupid'] = $records[$i]['sys_groupid'];
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment