Skip to content

Commit b125fab

Browse files
author
florian030
committed
add domain and username to db-size-monitoring
1 parent 366decb commit b125fab

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

interface/lib/classes/tools_monitor.inc.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ function showDatabaseSize () {
124124
$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");
125125
if(isset($record['data'])) {
126126
$data = unserialize($record['data']);
127-
/*
128-
Format the data
129-
*/
127+
//* format the data
130128
$html =
131129
'<div class="systemmonitor-state state-'.$record['state'].'">
132130
<div class="systemmonitor-content icons32 ico-'.$record['state'].'">
@@ -136,13 +134,15 @@ function showDatabaseSize () {
136134
<td>'.$app->lng("monitor_database_name_txt").'</td>
137135
<td>'.$app->lng("monitor_database_size_txt").'</td>
138136
<td>'.$app->lng("monitor_database_client_txt").'</td>
137+
<td>'.$app->lng("monitor_database_domain_txt").'</td>
139138
</tr>';
140139
foreach($data as $line) {
141140
$html .= '<tr>';
142141
if ($line['size'] > 0) $line['size'] = $app->functions->formatBytes($line['size']);
143-
$t=$app->db->queryOneRecord("SELECT username FROM client WHERE sys_groupid = ".$line['client_id']);
144-
$line['client_id']=$t['username'];
145-
unset($t);
142+
//* get the username
143+
$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'];
144+
//* get the domain
145+
$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'];
146146
foreach ($line as $item) {
147147
$html .= '<td>' . $item . '</td>';
148148
}

server/lib/classes/cron.d/100-monitor_database_size.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function onRunJob() {
8484
for ($i = 0; $i < sizeof($records); $i++) {
8585
$data[$i]['name'] = $records[$i]['database_name'];
8686
$data[$i]['size'] = $app->db->getDatabaseSize($data[$i]['name']);
87-
$data[$i]['client_id'] = $records[$i]['sys_groupid'];
87+
$data[$i]['sys_groupid'] = $records[$i]['sys_groupid'];
8888
}
8989
}
9090

0 commit comments

Comments
 (0)