Skip to content
Permalink
Browse files

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

…STABLE
  • Loading branch information...
stronk7
stronk7 committed Apr 15, 2008
1 parent 666744d commit 0fdf06cd78501b33d1c60d8da2a1d080260ac318
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/datalib.php
@@ -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');
}
}
}

0 comments on commit 0fdf06c

Please sign in to comment.
You can’t perform that action at this time.