]> git.mjollnir.org Git - moodle.git/commitdiff
Introducing $CFG->debugdisplay -- mimics PHPs display_errors, controls debugging()
authormartinlanghoff <martinlanghoff>
Thu, 21 Dec 2006 04:30:03 +0000 (04:30 +0000)
committermartinlanghoff <martinlanghoff>
Thu, 21 Dec 2006 04:30:03 +0000 (04:30 +0000)
admin/settings/server.php
lang/en_utf8/admin.php
lib/adminlib.php

index e32b4b8d4da32879c08c1921582bd46251b2a185..24373a74170efa903ee636eeb9e0100e5e63280e 100644 (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);
 
index 75af044fa6232d9a4e39342cb76d09a3123e4eeb..206e00fe686174e8102e3f52f755d9b822c40628 100644 (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';
index b707add61054f381e6eb5acd4388b4a2a4282fce..7fc110dff1306d2dda4f4bfacd099fb445702273 100644 (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) {