@@ -49,7 +49,7 @@ public function onBeforeRun() {
4949
5050 public function onRunJob () {
5151 global $ app , $ conf ;
52-
52+
5353 /* used for all monitor cronjobs */
5454 $ app ->load ('monitor_tools ' );
5555 $ this ->_tools = new monitor_tools ();
@@ -88,7 +88,11 @@ public function onRunJob() {
8888 if ($ rec ['traffic_quota_lock ' ] != 'y ' && ($ web_config ['overtraffic_notify_admin ' ] == 'y ' || $ web_config ['overtraffic_notify_client ' ] == 'y ' )) {
8989
9090 $ placeholders = array ('{domain} ' => $ rec ['domain ' ],
91- '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ));
91+ '{admin_mail} ' => ($ global_config ['admin_mail ' ] != '' ? $ global_config ['admin_mail ' ] : 'root ' ),
92+ '{used} ' => $ web_traffic ,
93+ '{limit} ' => $ web_traffic_quota ,
94+ '{ratio} ' => number_format (($ web_traffic_quota > 0 ? $ web_traffic /$ web_traffic_quota : 0 ) * 100 , 2 , '. ' , '' ).'% '
95+ );
9296
9397 $ recipients = array ();
9498 //* send email to admin
@@ -410,12 +414,12 @@ public function onRunJob() {
410414 $ monitor_data = array ();
411415 foreach ($ tmp_rec as $ tmp_mon ) {
412416 $ tmp_array = unserialize ($ app ->db ->unquote ($ tmp_mon ['data ' ]));
413- if (is_array ($ tmp_array ))
417+ if (is_array ($ tmp_array ))
414418 foreach ($ tmp_array as $ sys_groupid => $ data )
415419 $ monitor_data [$ data ['sys_groupid ' ]][] = $ data ;
416420 }
417421 //* remove duplicates from monitor-data
418- foreach ($ monitor_data as $ _monitor_data )
422+ foreach ($ monitor_data as $ _monitor_data )
419423 $ monitor_data [$ _monitor_data [0 ]['sys_groupid ' ]]=array_map ("unserialize " , array_unique (array_map ("serialize " , $ _monitor_data )));
420424 }
421425
@@ -492,11 +496,11 @@ public function onRunJob() {
492496 $ recipients = array ();
493497
494498 //* send email to admin
495- if ($ global_config ['admin_mail ' ] != '' && $ web_config ['overquota_db_notify_admin ' ] == 'y ' )
499+ if ($ global_config ['admin_mail ' ] != '' && $ web_config ['overquota_db_notify_admin ' ] == 'y ' )
496500 $ recipients [] = $ global_config ['admin_mail ' ];
497501
498502 //* Send email to client
499- if ($ web_config ['overquota_db_notify_client ' ] == 'y ' && $ client ['email ' ] != '' )
503+ if ($ web_config ['overquota_db_notify_client ' ] == 'y ' && $ client ['email ' ] != '' )
500504 $ recipients [] = $ client ['email ' ];
501505
502506 $ this ->_tools ->send_notification_email ('db_quota_ok_notification ' , $ placeholders , $ recipients );
@@ -507,7 +511,7 @@ public function onRunJob() {
507511
508512 }
509513
510- }
514+ }
511515
512516 }
513517
0 commit comments