Commit 0ed26d12 authored by Petr Skoda's avatar Petr Skoda
Browse files

MDL-25150 new debugusers setting

parent 740952e4
......@@ -359,6 +359,11 @@ $CFG->admin = 'admin';
// $CFG->debug = 38911; // DEBUG_DEVELOPER // NOT FOR PRODUCTION SERVERS!
// $CFG->debugdisplay = true; // NOT FOR PRODUCTION SERVERS!
//
// You can specify a comma separated list of user ids that that always see
// debug messages, this overrides the debug flag in $CFG->debug and $CFG->debugdisplay
// for these users only.
// $CFG->debugusers = '2';
//
// Prevent theme caching
// $CFG->themerev = -1; // NOT FOR PRODUCTION SERVERS!
//
......
......@@ -2843,9 +2843,15 @@ function get_docs_url($path) {
* @return bool
*/
function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) {
global $CFG, $UNITTEST;
global $CFG, $USER, $UNITTEST;
if (empty($CFG->debug) || $CFG->debug < $level) {
$forcedebug = false;
if (!empty($CFG->debugusers)) {
$debugusers = explode(',', $CFG->debugusers);
$forcedebug = in_array($USER->id, $debugusers);
}
if (!$forcedebug and (empty($CFG->debug) || $CFG->debug < $level)) {
return false;
}
......@@ -2871,7 +2877,7 @@ function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) {
// we send the info to error log instead
error_log('Debugging: ' . $message . $from);
} else if ($CFG->debugdisplay) {
} else if ($forcedebug or $CFG->debugdisplay) {
if (!defined('DEBUGGING_PRINTED')) {
define('DEBUGGING_PRINTED', 1); // indicates we have printed something
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment