Skip to content

Commit 0543b21

Browse files
author
florian030
committed
1 parent 18b5195 commit 0543b21

22 files changed

+326
-46
lines changed

install/sql/ispconfig3.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ CREATE TABLE `client` (
214214
`default_dbserver` int(11) NOT NULL DEFAULT '1',
215215
`dns_servers` blob NOT NULL DEFAULT '',
216216
`limit_database` int(11) NOT NULL DEFAULT '-1',
217+
`limit_database_quota` int(11) NOT NULL default '-1',
217218
`limit_cron` int(11) NOT NULL DEFAULT '0',
218219
`limit_cron_type` enum('url','chrooted','full') NOT NULL DEFAULT 'url',
219220
`limit_cron_frequency` int(11) NOT NULL DEFAULT '5',
@@ -317,6 +318,7 @@ CREATE TABLE `client_template` (
317318
`limit_dns_slave_zone` int(11) NOT NULL default '-1',
318319
`limit_dns_record` int(11) NOT NULL default '-1',
319320
`limit_database` int(11) NOT NULL default '-1',
321+
`limit_database_quota` int(11) NOT NULL default '-1',
320322
`limit_cron` int(11) NOT NULL default '0',
321323
`limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url',
322324
`limit_cron_frequency` int(11) NOT NULL default '5',
@@ -1757,6 +1759,7 @@ CREATE TABLE `web_database` (
17571759
`type` varchar(16) NOT NULL DEFAULT 'y',
17581760
`database_name` varchar(64) DEFAULT NULL,
17591761
`database_name_prefix` varchar(50) NOT NULL default '',
1762+
`database_quota` int(11) unsigned DEFAULT NULL,
17601763
`database_user_id` int(11) unsigned DEFAULT NULL,
17611764
`database_ro_user_id` int(11) unsigned DEFAULT NULL,
17621765
`database_charset` varchar(64) DEFAULT NULL,

install/tpl/server.ini.master

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ php_ini_check_minutes=1
101101
overquota_notify_admin=y
102102
overquota_notify_client=y
103103
overquota_notify_freq=7
104+
overquota_db_notify_admin=y
105+
overquota_db_notify_client=y
104106
overquota_notify_onok=n
105107

106108
[dns]

interface/lib/classes/tools_monitor.inc.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,32 +124,35 @@ 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'].'">
133-
<table>
134-
<thead>
135-
<tr>
131+
<table><thead><tr>
136132
<td>'.$app->lng("monitor_database_name_txt").'</td>
137133
<td>'.$app->lng("monitor_database_size_txt").'</td>
138134
<td>'.$app->lng("monitor_database_client_txt").'</td>
135+
<td>'.$app->lng("monitor_database_domain_txt").'</td>
139136
</tr>';
140137
foreach($data as $line) {
141138
$html .= '<tr>';
142139
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);
140+
141+
//* get the client
142+
$line['client']=$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['database_name']."'")['username'];
143+
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['database_name']."')")['domain'];
146+
147+
//* remove the sys_groupid from output
148+
unset($line['sys_groupid']);
149+
146150
foreach ($line as $item) {
147151
$html .= '<td>' . $item . '</td>';
148152
}
149153
$html .= '</tr></tmpl loop>';
150154
}
151-
$html .= '</tbody></table>';
152-
$html .= '</div></div>';
155+
$html .= '</tbody></table></div></div>';
153156
} else {
154157
$html = '<p>'.$app->lng("no_data_database_size_txt").'</p>';
155158
}

interface/web/admin/form/server_config.tform.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,18 @@
688688
'default' => 'y',
689689
'value' => array(0 => 'n', 1 => 'y')
690690
),
691+
'overquota_db_notify_admin' => array(
692+
'datatype' => 'VARCHAR',
693+
'formtype' => 'CHECKBOX',
694+
'default' => 'y',
695+
'value' => array(0 => 'n', 1 => 'y')
696+
),
697+
'overquota_db_notify_client' => array(
698+
'datatype' => 'VARCHAR',
699+
'formtype' => 'CHECKBOX',
700+
'default' => 'y',
701+
'value' => array(0 => 'n', 1 => 'y')
702+
),
691703
'overquota_notify_freq' => array(
692704
'datatype' => 'INTEGER',
693705
'formtype' => 'TEXT',

interface/web/admin/lib/lang/en_server_config.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,6 @@ $wb["v6_prefix_length"] = 'Prefix too long according to defined IPv6 ';
197197
$wb['backup_dir_is_mount_txt'] = 'Backup directory is a mount?';
198198
$wb['backup_dir_mount_cmd_txt'] = 'Mount command, if backup directory not mounted';
199199
$wb['backup_delete_txt'] = 'Delete backups on domain/website delete';
200+
$wb["overquota_db_notify_admin_txt"] = 'Send DB quota warnings to admin';
201+
$wb["overquota_db_notify_client_txt"] = 'Send DB quota warnings to client';
200202
?>

interface/web/admin/templates/server_config_web_edit.htm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ <h2><tmpl_var name="list_head_txt"></h2>
125125
{tmpl_var name='overquota_notify_client'}
126126
</div>
127127
</div>
128+
<div class="ctrlHolder">
129+
<p class="label">{tmpl_var name='overquota_db_notify_admin_txt'}</p>
130+
<div class="multiField">
131+
{tmpl_var name='overquota_db_notify_admin'}
132+
</div>
133+
</div>
134+
<div class="ctrlHolder">
135+
<p class="label">{tmpl_var name='overquota_db_notify_client_txt'}</p>
136+
<div class="multiField">
137+
{tmpl_var name='overquota_db_notify_client'}
138+
</div>
139+
</div>
128140
<div class="ctrlHolder">
129141
<label for="overquota_notify_freq">{tmpl_var name='overquota_notify_freq_txt'}</label>
130142
<input name="overquota_notify_freq" id="overquota_notify_freq" value="{tmpl_var name='overquota_notify_freq'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='overquota_notify_freq_note_txt'}

interface/web/client/form/client.tform.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,20 @@
10931093
'rows' => '',
10941094
'cols' => ''
10951095
),
1096+
'limit_database_quota' => array (
1097+
'datatype' => 'INTEGER',
1098+
'formtype' => 'TEXT',
1099+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
1100+
'errmsg'=> 'limit_database_quota_error_notint'),
1101+
),
1102+
'default' => '-1',
1103+
'value' => '',
1104+
'separator' => '',
1105+
'width' => '10',
1106+
'maxlength' => '10',
1107+
'rows' => '',
1108+
'cols' => ''
1109+
),
10961110
'limit_cron' => array (
10971111
'datatype' => 'INTEGER',
10981112
'formtype' => 'TEXT',

interface/web/client/form/client_template.tform.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,20 @@
557557
'rows' => '',
558558
'cols' => ''
559559
),
560+
'limit_database_quota' => array (
561+
'datatype' => 'INTEGER',
562+
'formtype' => 'TEXT',
563+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
564+
'errmsg'=> 'limit_database_quota_error_notint'),
565+
),
566+
'default' => '-1',
567+
'value' => '',
568+
'separator' => '',
569+
'width' => '10',
570+
'maxlength' => '10',
571+
'rows' => '',
572+
'cols' => ''
573+
),
560574
'limit_cron' => array (
561575
'datatype' => 'INTEGER',
562576
'formtype' => 'TEXT',

interface/web/client/lib/lang/en_client.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,6 @@ $wb['added_by_txt'] = 'Added by';
172172
$wb['added_date_txt'] = 'Added date';
173173
$wb['parent_client_id_txt'] = 'Client of reseller';
174174
$wb['none_txt'] = 'none';
175+
$wb['limit_database_quota_txt'] = 'Database quota';
176+
$wb['limit_database_quota_error_notint'] = 'The database quota limit must be a number.';
175177
?>

interface/web/client/lib/lang/en_client_template.lng

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,7 @@ $wb['aps_limits_txt'] = 'APS Installer Limits';
8989
$wb['limit_aps_txt'] = 'Max. number of APS instances';
9090
$wb['limit_aps_error_notint'] = 'The APS instances limit must be a number.';
9191
$wb['limit_domainmodule_txt'] = 'Domainmodule Limit';
92-
$wb['client_limits_txt'] = 'Client Limits'
93-
?>
92+
$wb['client_limits_txt'] = 'Client Limits';
93+
$wb['limit_database_quota_txt'] = 'Database quota';
94+
$wb['limit_database_quota_error_notint'] = 'The database quota limit must be a number.';
95+
?>

0 commit comments

Comments
 (0)