Introducing $CFG->debugdisplay -- mimics PHPs display_errors, controls debugging()

This commit is contained in:
martinlanghoff 2006-12-21 04:30:03 +00:00
parent 4bd0ddeafa
commit 47b8b9eb80
3 changed files with 36 additions and 0 deletions

View File

@ -84,6 +84,7 @@ $ADMIN->add('server', $temp);
// "debugging" settingpage
$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_special_perfdebug());
$ADMIN->add('server', $temp);

View File

@ -64,6 +64,7 @@ $string['configcoursemanager'] = 'This setting allows you to control who appears
$string['configcoursesperpage'] = 'Enter the number of courses to be display per page in a course listing.';
$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['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.';
@ -205,6 +206,7 @@ $string['dbmigrationdeprecateddb'] = '<font color=\"#ff0000\">This database is m
$string['dbmigrationdupfailed'] = 'Database duplication failed with possible error:<font color=\"#ff0000\"><pre>$a</pre></font>';
$string['dbsessions'] = 'Use database for session information';
$string['debug'] = 'Debug messages';
$string['debugdisplay'] = 'Display debug messages';
$string['debugall'] = 'ALL: Show all reasonable PHP debug messages';
$string['debugdeveloper'] = 'DEVELOPER: extra Moodle debug messages for developers';
$string['debugging'] = 'Debugging';

View File

@ -2489,6 +2489,39 @@ class admin_setting_special_perfdebug extends admin_setting_configcheckbox {
}
class admin_setting_special_debugdisplay extends admin_setting_configcheckbox {
function admin_setting_special_debugdisplay() {
$name = 'debugdisplay';
$visiblename = get_string('debugdisplay', 'admin');
$description = get_string('configdebugdisplay', 'admin');
parent::admin_setting_configcheckbox($name, $visiblename, $description, '');
}
function write_setting($data) {
if ($data == '1') {
return (set_config($this->name,1) ? '' : get_string('errorsetting', 'admin') . $this->visiblename . '<br />');
} else {
return (set_config($this->name,0) ? '' : get_string('errorsetting', 'admin') . $this->visiblename . '<br />');
}
}
function output_html() {
if ($this->get_setting() === NULL) {
$currentsetting = ini_get('display_error');
} else {
$currentsetting = $this->get_setting();
}
$return = '<input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'" name="s_'. $this->name .'" value="1" ' . ($currentsetting == 1 ? 'checked="checked"' : '') . ' />';
return format_admin_setting($this->name, $this->visiblename, $return, $this->description);
}
}
// Code for a function that helps externalpages print proper headers and footers
// N.B.: THIS FUNCTION HANDLES AUTHENTICATION
function admin_externalpage_setup($section, $adminroot) {