User-visible changes:
* UTF8 now saved correctly in database. #1151
* Unit tests added at engine/tests/suites.php
+ * Debug values output to screen when enabled in admin settings
Bugfixes:
* Searching by tag with extended characters now works. #1151, #1231
$debug = get_input('debug');
if ($debug) {
- set_config('debug', 1, $site->getGUID());
+ set_config('debug', $debug, $site->getGUID());
} else {
unset_config('debug', $site->getGUID());
}
$debug = get_input('debug');
if ($debug) {
- set_config('debug', 1, $site->getGUID());
+ set_config('debug', $debug, $site->getGUID());
} else {
unset_config('debug', $site->getGUID());
}
// only log when debugging is enabled
if (isset($CONFIG->debug)) {
+ // debug to screen or log?
+ $to_screen = !($CONFIG->debug == 'NOTICE');
+
switch ($level) {
case 'DEBUG':
case 'ERROR':
// always report
- elgg_dump("$level: $message");
+ elgg_dump("$level: $message", $to_screen);
break;
case 'WARNING':
// report execept if user wants only errors
- if ($config->debug != 'ERROR') {
- elgg_dump("$level: $message");
+ if ($CONFIG->debug != 'ERROR') {
+ elgg_dump("$level: $message", $to_screen);
}
break;
case 'NOTICE':
default:
// only report when lowest level is desired
- if ($config->debug == 'NOTICE') {
- elgg_dump("$level: $message");
+ if ($CONFIG->debug == 'NOTICE') {
+ elgg_dump("$level: $message", FALSE);
}
break;
}
* Extremely generic var_dump-esque wrapper
*
* Immediately dumps the given $value to the screen as a human-readable string.
+ * The $value can instead be written to the system log through the use of the
+ * $to_screen flag.
*
* @param mixed $value
+ * @param bool $to_screen
* @return void
*/
-function elgg_dump($value) {
- echo '<pre>';
- print_r($value);
- echo '</pre>';
+function elgg_dump($value, $to_screen = TRUE) {
+ if ($to_screen == TRUE) {
+ echo '<pre>';
+ print_r($value);
+ echo '</pre>';
+ }
+ else
+ {
+ error_log($value);
+ }
}
/**
'installation:sitepermissions' => "The default access permissions:",
'installation:language' => "The default language for your site:",
'installation:debug' => "Debug mode provides extra information which can be used to diagnose faults, however it can slow your system down so should only be used if you are having problems:",
- 'installation:debug:label' => "Turn on debug mode",
+ 'installation:debug:none' => 'Turn off debug mode (recommended)',
+ 'installation:debug:error' => 'Display only critical errors',
+ 'installation:debug:warning' => 'Display errors and warnings',
+ 'installation:debug:notice' => 'Log all errors, warnings and notices',
'installation:httpslogin' => "Enable this to have user logins performed over HTTPS. You will need to have https enabled on your server for this to work.",
'installation:httpslogin:label' => "Enable HTTPS logins",
'installation:usage' => "This option lets Elgg send anonymous usage statistics back to Curverider.",
$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:simplecache:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:simplecache:label')), 'internalname' => 'simplecache_enabled', 'value' => ($vars['config']->simplecache_enabled ? elgg_echo('installation:simplecache:label') : "") )) . "</p>";
$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:viewpathcache:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:viewpathcache:label')), 'internalname' => 'viewpath_cache_enabled', 'value' => (($vars['config']->viewpath_cache_enabled) ? elgg_echo('installation:viewpathcache:label') : "") )) . "</p>";
-$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:debug') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('installation:debug:label') : "") )) . "</p>";
+$debug_options = array('0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice'));
+$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:debug');
+$form_body .= elgg_view('input/pulldown', array('options_values' => $debug_options, 'internalname' => 'debug', 'value' => $vars['config']->debug));
+$form_body .= '</p>';
$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:httpslogin') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:httpslogin:label')), 'internalname' => 'https_login', 'value' => ($vars['config']->https_login ? elgg_echo('installation:httpslogin:label') : "") )) . "</p>";
$form_body .= "<p>" . elgg_echo('installation:sitepermissions') . elgg_view('input/access', array('internalname' => 'default_access','value' => ACCESS_LOGGED_IN)) . "</p>";
-$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:debug') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('installation:debug:label') : "") )) . "</p>";
+$debug_options = array('0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice'));
+$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:debug');
+$form_body .= elgg_view('input/pulldown', array('options_values' => $debug_options, 'internalname' => 'debug', 'value' => $vars['config']->debug));
+$form_body .= '</p>';
$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:httpslogin') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:httpslogin:label')), 'internalname' => 'https_login', 'value' => ($vars['config']->https_login ? elgg_echo('installation:httpslogin:label') : "") )) . "</p>";