Fixing logic + minor formatting of email. MDL-11893 ; merged from 19_STABLE

This commit is contained in:
stronk7
2008-04-15 20:02:59 +00:00
parent 666744d71d
commit 0fdf06cd78
+8 -8
View File
@@ -1920,16 +1920,16 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user
if (!$result && $CFG->supportemail) {
$site = get_site();
$subject = 'Insert into log failed at your moodle site '.$site->fullname;
$message = 'Insert into log table failed at '.date('l dS \of F Y h:i:s A').'. It is possible that your disk is full.';
$mseesage .= 'The failed SQL is: '.$sql;
// email_to_user is not usable because email_to_user tries to write to the logs table, and this will get caught
// in an infinite loop, if disk is full
$message = "Insert into log table failed at ". date('l dS \of F Y h:i:s A') .".\n It is possible that your disk is full.\n\n";
$message .= "The failed SQL is:\n\n" . $sql;
// email_to_user is not usable because email_to_user tries to write to the logs table,
// and this will get caught in an infinite loop, if disk is full
if (empty($CFG->noemailever)) {
$lasttime = get_config('admin', 'inserterrormail');
if(!empty($lasttime) && time()-$lasttime > 60*60*24){
$lasttime = get_config('admin', 'lastloginserterrormail');
if(empty($lasttime) || time() - $lasttime > 60*60*24) { // limit to 1 email per day
mail($CFG->supportemail, $subject, $message);
set_config('inserterrormail', time(), 'admin');
set_config('lastloginserterrormail', time(), 'admin');
}
}
}