MDL-8834 smtp debugging can now be turned off - now independent on $CFG->debug; merged from MOODLE_18_STABLE

This commit is contained in:
skodak 2007-03-09 20:16:48 +00:00
parent 532daab479
commit 854f5ef034
3 changed files with 11 additions and 1 deletions

View File

@ -85,6 +85,7 @@ $ADMIN->add('server', $temp);
$temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
$temp->add(new admin_setting_special_debug());
$temp->add(new admin_setting_special_debugdisplay());
$temp->add(new admin_setting_configcheckbox('debugsmtp', get_string('debugsmtp', 'admin'), get_string('configdebugsmtp', 'admin'), 0));
$temp->add(new admin_setting_special_perfdebug());
$ADMIN->add('server', $temp);

View File

@ -69,6 +69,7 @@ $string['configcoursesperpage'] = 'Enter the number of courses to be display per
$string['configdbsessions'] = 'If enabled, this setting will use the database to store information about current sessions. This is especially useful for large/busy sites or sites built on cluster of servers. For most sites this should probably be left disabled so that the server disk is used instead. Note that changing this setting now will log out all current users (including you). If you are using MySQL please make sure that \'max_allowed_packet\' in my.cnf (or my.ini) is at least 4M.';
$string['configdebug'] = 'If you turn this on, then PHP\'s error_reporting will be increased so that more warnings are printed. This is only useful for developers.';
$string['configdebugdisplay'] = 'Set to on, the error reporting will go to the HTML page. This is practical, but breaks XHTML, JS, cookies and HTTP headers in general. Set to off, it will send the output to your server logs, allowing better debugging. The PHP setting error_log controls which log this goes to.';
$string['configdebugsmtp'] = 'Enable verbose debug information during sending of email messages to SMTP server.';
$string['configdefaultallowedmodules'] = 'For the courses which fall into the above category, which modules do you want to allow by default <b>when the course is created</b>?';
$string['configdefaultcourseroleid'] = 'Users who enrol in a course will be automatically assigned this role.';
$string['configdefaultrequestcategory'] = 'Courses requested by users will be automatically placed in this category.';
@ -221,6 +222,7 @@ $string['dbmigrationdupfailed'] = 'Database duplication failed with possible err
$string['dbsessions'] = 'Use database for session information';
$string['debug'] = 'Debug messages';
$string['debugdisplay'] = 'Display debug messages';
$string['debugsmtp'] = 'Debug email sending';
$string['debugall'] = 'ALL: Show all reasonable PHP debug messages';
$string['debugdeveloper'] = 'DEVELOPER: extra Moodle debug messages for developers';
$string['debugging'] = 'Debugging';

View File

@ -3306,7 +3306,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
} else {
$mail->IsSMTP(); // use SMTP directly
if (debugging()) {
if (!empty($CFG->debugsmtp)) {
echo '<pre>' . "\n";
$mail->SMTPDebug = true;
}
@ -3426,10 +3426,17 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
if ($mail->Send()) {
set_send_count($user);
$mail->IsSMTP(); // use SMTP directly
if (!empty($CFG->debugsmtp)) {
echo '</pre>';
}
return true;
} else {
mtrace('ERROR: '. $mail->ErrorInfo);
add_to_log(SITEID, 'library', 'mailer', $FULLME, 'ERROR: '. $mail->ErrorInfo);
if (!empty($CFG->debugsmtp)) {
echo '</pre>';
}
return false;
}
}