@@ -55,6 +55,8 @@ public function onRunJob() {
5555 $ this ->_tools = new monitor_tools ();
5656 /* end global section for monitor cronjobs */
5757
58+ $ web_config = $ app ->getconf ->get_server_config ($ conf ['server_id ' ], 'web ' );
59+
5860 //######################################################################################################
5961 // enforce traffic quota (run only on the "master-server")
6062 //######################################################################################################
@@ -471,36 +473,37 @@ public function onRunJob() {
471473
472474 }
473475
474- }
476+ } else {
475477
476- //* could a notification be sent?
477- $ send_notification = false ;
478- if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; //* not yet notified
479- elseif ($ web_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ web_config ['overquota_notify_freq ' ]) $ send_notification = true ;
478+ //* could a notification be sent?
479+ $ send_notification = false ;
480+ if (!$ rec ['last_quota_notification ' ]) $ send_notification = true ; //* not yet notified
481+ elseif ($ web_config ['overquota_notify_freq ' ] > 0 && $ rec ['notified_before ' ] >= $ web_config ['overquota_notify_freq ' ]) $ send_notification = true ;
480482
481- //* Send quota notifications
482- if (($ web_config ['overquota_db_notify_admin ' ] == 'y ' || $ web_config ['overquota_db_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
483- $ app ->dbmaster ->datalogUpdate ('web_database ' , array ("last_quota_notification " => array ("SQL " => "CURDATE() " )), 'database_id ' , $ rec ['database_id ' ]);
484- $ placeholders = array (
485- '{database_name} ' => $ rec ['database_name ' ],
486- '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
487- '{used} ' => $ app ->functions ->formatBytes ($ monitor ['size ' ]),
488- '{quota} ' => $ quota .' MB ' ,
489- '{ratio} ' => number_format ($ used_ratio * 100 , 2 , '. ' , '' ).'% '
490- );
483+ //* Send quota notifications
484+ if (($ web_config ['overquota_db_notify_admin ' ] == 'y ' || $ web_config ['overquota_db_notify_client ' ] == 'y ' ) && $ send_notification == true ) {
485+ $ app ->dbmaster ->datalogUpdate ('web_database ' , array ("last_quota_notification " => array ("SQL " => "CURDATE() " )), 'database_id ' , $ rec ['database_id ' ]);
486+ $ placeholders = array (
487+ '{database_name} ' => $ rec ['database_name ' ],
488+ '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
489+ '{used} ' => $ app ->functions ->formatBytes ($ monitor ['size ' ]),
490+ '{quota} ' => $ quota .' MB ' ,
491+ '{ratio} ' => number_format ($ used_ratio * 100 , 2 , '. ' , '' ).'% '
492+ );
491493
492- $ recipients = array ();
494+ $ recipients = array ();
493495
494- //* send email to admin
495- if ($ global_config ['admin_mail ' ] != '' && $ web_config ['overquota_db_notify_admin ' ] == 'y ' )
496- $ recipients [] = $ global_config ['admin_mail ' ];
496+ //* send email to admin
497+ if ($ global_config ['admin_mail ' ] != '' && $ web_config ['overquota_db_notify_admin ' ] == 'y ' )
498+ $ recipients [] = $ global_config ['admin_mail ' ];
497499
498- //* Send email to client
499- if ($ web_config ['overquota_db_notify_client ' ] == 'y ' && $ client ['email ' ] != '' )
500- $ recipients [] = $ client ['email ' ];
500+ //* Send email to client
501+ if ($ web_config ['overquota_db_notify_client ' ] == 'y ' && $ client ['email ' ] != '' )
502+ $ recipients [] = $ client ['email ' ];
501503
502- $ this ->_tools ->send_notification_email ('db_quota_notification ' , $ placeholders , $ recipients );
504+ $ this ->_tools ->send_notification_email ('db_quota_notification ' , $ placeholders , $ recipients );
503505
506+ }
504507 }
505508
506509 }
0 commit comments