Skip to content

Commit

Permalink
MDL-60347 core: debugsmtp should be a developer only setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
danmarsden authored and stronk7 committed Jul 1, 2019
1 parent 7d12c36 commit 22dfa6d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
1 change: 0 additions & 1 deletion admin/settings/development.php
Expand Up @@ -35,7 +35,6 @@
$temp = new admin_settingpage('debugging', new lang_string('debugging', 'admin'));
$temp->add(new admin_setting_special_debug());
$temp->add(new admin_setting_configcheckbox('debugdisplay', new lang_string('debugdisplay', 'admin'), new lang_string('configdebugdisplay', 'admin'), ini_get_bool('display_errors')));
$temp->add(new admin_setting_configcheckbox('debugsmtp', new lang_string('debugsmtp', 'admin'), new lang_string('configdebugsmtp', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('perfdebug', new lang_string('perfdebug', 'admin'), new lang_string('configperfdebug', 'admin'), '7', '15', '7'));
$temp->add(new admin_setting_configcheckbox('debugstringids', new lang_string('debugstringids', 'admin'), new lang_string('debugstringids_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('debugvalidators', new lang_string('debugvalidators', 'admin'), new lang_string('configdebugvalidators', 'admin'), 0));
Expand Down
4 changes: 4 additions & 0 deletions config-dist.php
Expand Up @@ -641,6 +641,10 @@
// Enable verbose debug information during fetching of email messages from IMAP server.
// $CFG->debugimap = true;
//
// Enable verbose debug information during sending of email messages to SMTP server.
// Note: also requires $CFG->debug set to DEBUG_DEVELOPER.
// $CFG->debugsmtp = true;
//
// Prevent JS caching
// $CFG->cachejs = false; // NOT FOR PRODUCTION SERVERS!
//
Expand Down
2 changes: 0 additions & 2 deletions lang/en/admin.php
Expand Up @@ -199,7 +199,6 @@
$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['configdebugpageinfo'] = 'Enable if you want page information printed in page footer.';
$string['configdebugsmtp'] = 'Enable verbose debug information during sending of email messages to SMTP server.';
$string['configdebugvalidators'] = 'Enable if you want to have links to external validator servers in page footer. You may need to create new user with username <em>w3cvalidator</em>, and enable guest access. These changes may allow unauthorized access to server, do not enable on production sites!';
$string['configdefaulthomepage'] = 'This determines the home page for logged in users';
$string['configdefaultrequestcategory'] = 'Courses requested by users will be automatically placed in this category.';
Expand Down Expand Up @@ -448,7 +447,6 @@
$string['debugnone'] = 'NONE: Do not show any errors or warnings';
$string['debugnormal'] = 'NORMAL: Show errors, warnings and notices';
$string['debugpageinfo'] = 'Show page information';
$string['debugsmtp'] = 'Debug email sending';
$string['debugstringids'] = 'Show origin of languages strings';
$string['debugstringids_desc'] = 'If enabled, language string components and identifiers are displayed when ?strings=1 or &strings=1 is appended to the page URL.';
$string['debugvalidators'] = 'Show validator links';
Expand Down
8 changes: 8 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -3394,5 +3394,13 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2019060600.02);
}

if ($oldversion < 2019062900.00) {
// Debugsmtp is now only available via config.php.
$DB->delete_records('config', array('name' => 'debugsmtp'));

// Main savepoint reached.
upgrade_main_savepoint(true, 2019062900.00);
}

return true;
}
2 changes: 1 addition & 1 deletion lib/moodlelib.php
Expand Up @@ -5770,7 +5770,7 @@ function get_mailer($action='get') {
} else {
// Use SMTP directly.
$mailer->isSMTP();
if (!empty($CFG->debugsmtp)) {
if (!empty($CFG->debugsmtp) && (!empty($CFG->debugdeveloper))) {
$mailer->SMTPDebug = 3;
}
// Specify main and backup servers.
Expand Down
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2019062800.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019062900.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.

Expand Down

0 comments on commit 22dfa6d

Please sign in to comment.