Commit 2d1e0ddb authored by Till Brehm's avatar Till Brehm

Merge branch 'stable-3.1' into 'stable-3.1'

Stable 3.1



See merge request !429
parents b4b4c1b9 7fc30f82
......@@ -442,15 +442,17 @@ class cronjob_quota_notify extends cronjob {
else $used_ratio = 0;
//* send notifications only if 90% or more of the quota are used
if($used_ratio > 0.9) {
if($used_ratio > 0.9 && $user_ratio != 0) {
//* reset notification date
if($rec['last_quota_notification']) $app->dbmaster->datalogUpdate('web_database', array("last_quota_notification" => null), 'database_id', $rec['database_id']);
//* could a notification be sent?
$send_notification = false;
if(!$rec['last_quota_notification']) $send_notification = true; //* not yet notified
elseif($web_config['overquota_notify_freq'] > 0 && $rec['notified_before'] >= $web_config['overquota_notify_freq']) $send_notification = true;
$app->dbmaster->datalogUpdate('web_database', array("last_quota_notification" => array("SQL" => "CURDATE()")), 'database_id', $rec['database_id']);
// send notification - everything ok again
if($rec['last_quota_notification'] && $web_config['overquota_notify_onok'] == 'y' && ($web_config['overquota_db_notify_admin'] == 'y' || $web_config['overquota_db_notify_client'] == 'y')) {
//* Send quota notifications
if(($web_config['overquota_db_notify_admin'] == 'y' || $web_config['overquota_db_notify_client'] == 'y') && $send_notification == true) {
$app->dbmaster->datalogUpdate('web_database', array("last_quota_notification" => array("SQL" => "CURDATE()")), 'database_id', $rec['database_id']);
$placeholders = array(
'{database_name}' => $rec['database_name'],
'{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
......@@ -462,27 +464,25 @@ class cronjob_quota_notify extends cronjob {
$recipients = array();
//* send email to admin
if($global_config['admin_mail'] != '' && $web_config['overquota_db_notify_admin'] == 'y')
if($global_config['admin_mail'] != '' && $web_config['overquota_db_notify_admin'] == 'y')
$recipients[] = $global_config['admin_mail'];
//* Send email to client
if($web_config['overquota_db_notify_client'] == 'y' && $client['email'] != '')
if($web_config['overquota_db_notify_client'] == 'y' && $client['email'] != '')
$recipients[] = $client['email'];
$this->_tools->send_notification_email('db_quota_ok_notification', $placeholders, $recipients);
$this->_tools->send_notification_email('db_quota_notification', $placeholders, $recipients);
}
} else {
//* reset notification date
if($rec['last_quota_notification']) $app->dbmaster->datalogUpdate('web_database', array("last_quota_notification" => null), 'database_id', $rec['database_id']);
//* could a notification be sent?
$send_notification = false;
if(!$rec['last_quota_notification']) $send_notification = true; //* not yet notified
elseif($web_config['overquota_notify_freq'] > 0 && $rec['notified_before'] >= $web_config['overquota_notify_freq']) $send_notification = true;
$app->dbmaster->datalogUpdate('web_database', array("last_quota_notification" => array("SQL" => "CURDATE()")), 'database_id', $rec['database_id']);
//* Send quota notifications
if(($web_config['overquota_db_notify_admin'] == 'y' || $web_config['overquota_db_notify_client'] == 'y') && $send_notification == true) {
$app->dbmaster->datalogUpdate('web_database', array("last_quota_notification" => array("SQL" => "CURDATE()")), 'database_id', $rec['database_id']);
// send notification - everything ok again
if($rec['last_quota_notification'] && $web_config['overquota_notify_onok'] == 'y' && ($web_config['overquota_db_notify_admin'] == 'y' || $web_config['overquota_db_notify_client'] == 'y')) {
$placeholders = array(
'{database_name}' => $rec['database_name'],
'{admin_mail}' => ($global_config['admin_mail'] != ''? $global_config['admin_mail'] : 'root'),
......@@ -494,16 +494,17 @@ class cronjob_quota_notify extends cronjob {
$recipients = array();
//* send email to admin
if($global_config['admin_mail'] != '' && $web_config['overquota_db_notify_admin'] == 'y')
if($global_config['admin_mail'] != '' && $web_config['overquota_db_notify_admin'] == 'y')
$recipients[] = $global_config['admin_mail'];
//* Send email to client
if($web_config['overquota_db_notify_client'] == 'y' && $client['email'] != '')
if($web_config['overquota_db_notify_client'] == 'y' && $client['email'] != '')
$recipients[] = $client['email'];
$this->_tools->send_notification_email('db_quota_notification', $placeholders, $recipients);
$this->_tools->send_notification_email('db_quota_ok_notification', $placeholders, $recipients);
}
}
}
......
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