"MDL-15469, limit email notification"
This commit is contained in:
+17
-3
@@ -156,9 +156,23 @@ global $HTTPSPAGEREQUIRED;
|
||||
error_log('ADODB Error: '.$db->ErrorMsg()); // see MDL-14628
|
||||
|
||||
if (!empty($CFG->emailconnectionerrorsto)) {
|
||||
mail($CFG->emailconnectionerrorsto,
|
||||
'WARNING: Database connection error: '.$CFG->wwwroot,
|
||||
'Connection error: '.$CFG->wwwroot);
|
||||
if (file_exists($CFG->dataroot.'/emailcount')){
|
||||
$fp = fopen($CFG->dataroot.'/emailcount', 'r');
|
||||
$content = fread($fp, 24);
|
||||
if((time() - (int)$content) > 600){
|
||||
mail($CFG->emailconnectionerrorsto,
|
||||
'WARNING: Database connection error: '.$CFG->wwwroot,
|
||||
'Connection error: '.$CFG->wwwroot);
|
||||
$fp = fopen($CFG->dataroot.'/emailcount', 'w');
|
||||
fwrite($fp, time());
|
||||
}
|
||||
} else {
|
||||
mail($CFG->emailconnectionerrorsto,
|
||||
'WARNING: Database connection error: '.$CFG->wwwroot,
|
||||
'Connection error: '.$CFG->wwwroot);
|
||||
$fp = fopen($CFG->dataroot.'/emailcount', 'w');
|
||||
fwrite($fp, time());
|
||||
}
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user