From 0fdf06cd78501b33d1c60d8da2a1d080260ac318 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 15 Apr 2008 20:02:59 +0000 Subject: [PATCH] Fixing logic + minor formatting of email. MDL-11893 ; merged from 19_STABLE --- lib/datalib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/datalib.php b/lib/datalib.php index 799963dcb3..796b721a92 100644 --- a/lib/datalib.php +++ b/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'); } } } -- 2.39.5