Get rid of debug_level (#6298)

pull/6302/head
Aleksander Machniak 7 years ago
parent d0205f613d
commit 4b97f40af9

@ -66,6 +66,7 @@ CHANGELOG Roundcube Webmail
- Plugin API: Added 'show_bytes' hook (#5001) - Plugin API: Added 'show_bytes' hook (#5001)
- Add option to not indent quoted text on top-posting reply (#5105) - Add option to not indent quoted text on top-posting reply (#5105)
- Removed global $CONFIG variable - Removed global $CONFIG variable
- Removed debug_level setting
- Support AUTHENTICATE LOGIN for IMAP connections (#5563) - Support AUTHENTICATE LOGIN for IMAP connections (#5563)
- Support LDAP GSSAPI authentication (#5703) - Support LDAP GSSAPI authentication (#5703)
- Localized timezone selector (#4983) - Localized timezone selector (#4983)

@ -76,7 +76,9 @@ and configure your installation to be not surprised by default behaviour.
Roundcube writes internal errors to the 'errors' log file located in the logs Roundcube writes internal errors to the 'errors' log file located in the logs
directory which can be configured in config/config.inc.php. If you want ordinary directory which can be configured in config/config.inc.php. If you want ordinary
PHP errors to be logged there as well, set error_log php.ini or .htaccess file. PHP errors to be logged there as well, set error_log in php.ini or .htaccess file.
Roundcube forces display_errors=Off and log_errors=On.
By default the session cookie settings of PHP are not modified by Roundcube. By default the session cookie settings of PHP are not modified by Roundcube.
However if you want to limit the session cookies to the directory where However if you want to limit the session cookies to the directory where

@ -63,9 +63,6 @@ $config['db_max_allowed_packet'] = null;
// LOGGING/DEBUGGING // LOGGING/DEBUGGING
// ---------------------------------- // ----------------------------------
// system error reporting, sum of: 1 = log; 4 = show
$config['debug_level'] = 1;
// log driver: 'syslog', 'stdout' or 'file'. // log driver: 'syslog', 'stdout' or 'file'.
$config['log_driver'] = 'file'; $config['log_driver'] = 'file';

@ -11,7 +11,6 @@ $RCI->bool_config_props = array(
'auto_create_user' => 1, 'auto_create_user' => 1,
'smtp_log' => 1, 'smtp_log' => 1,
'prefer_html' => 1, 'prefer_html' => 1,
'debug_level' => 1,
); );
// allow the current user to get to the next step // allow the current user to get to the next step
@ -196,21 +195,6 @@ echo $input_ilevel->show($RCI->getprop('identities_level'), 0);
<legend>Logging & Debugging</legend> <legend>Logging & Debugging</legend>
<dl class="loggingblock"> <dl class="loggingblock">
<dt class="propname">debug_level</dt>
<dd>
<?php
$value = $RCI->getprop('debug_level');
$check_debug = new html_checkbox(array('name' => '_debug_level[]'));
echo $check_debug->show(($value & 1) ? 1 : 0 , array('value' => 1, 'id' => 'cfgdebug1'));
echo '<label for="cfgdebug1">Log errors</label><br />';
echo $check_debug->show(($value & 4) ? 4 : 0, array('value' => 4, 'id' => 'cfgdebug4'));
echo '<label for="cfgdebug4">Print errors (to the browser)</label><br />';
?>
</dd>
<dt class="propname">log_driver</dt> <dt class="propname">log_driver</dt>
<dd> <dd>
<?php <?php

@ -206,16 +206,7 @@ class rcmail_install
} }
// convert some form data // convert some form data
if ($prop == 'debug_level' && !$is_default) { if ($prop == 'db_dsnw' && !empty($_POST['_dbtype'])) {
if (is_array($value)) {
$val = 0;
foreach ($value as $dbgval) {
$val += intval($dbgval);
}
$value = $val;
}
}
else if ($prop == 'db_dsnw' && !empty($_POST['_dbtype'])) {
if ($_POST['_dbtype'] == 'sqlite') { if ($_POST['_dbtype'] == 'sqlite') {
$value = sprintf('%s://%s?mode=0646', $_POST['_dbtype'], $value = sprintf('%s://%s?mode=0646', $_POST['_dbtype'],
$_POST['_dbname']{0} == '/' ? '/' . $_POST['_dbname'] : $_POST['_dbname']); $_POST['_dbname']{0} == '/' ? '/' . $_POST['_dbname'] : $_POST['_dbname']);

@ -1352,7 +1352,7 @@ class rcube
} }
/** /**
* Report error according to configured debug_level * Log an error
* *
* @param array $arg_arr Named parameters * @param array $arg_arr Named parameters
* @see self::raise_error() * @see self::raise_error()
@ -1360,15 +1360,8 @@ class rcube
public static function log_bug($arg_arr) public static function log_bug($arg_arr)
{ {
$program = strtoupper($arg_arr['type'] ?: 'php'); $program = strtoupper($arg_arr['type'] ?: 'php');
$level = self::get_instance()->config->get('debug_level');
// disable errors for ajax requests, write to log instead (#1487831)
if (($level & 4) && !empty($_REQUEST['_remote'])) {
$level = ($level ^ 4) | 1;
}
// write error to local log file // write error to local log file
if (($level & 1) || !empty($arg_arr['fatal'])) {
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
foreach (array('_task', '_action') as $arg) { foreach (array('_task', '_action') as $arg) {
if ($_POST[$arg] && !$_GET[$arg]) { if ($_POST[$arg] && !$_GET[$arg]) {
@ -1395,26 +1388,6 @@ class rcube
} }
} }
// report the bug to the global bug reporting system
if ($level & 2) {
// TODO: Send error via HTTP
}
// show error if debug_mode is on
if ($level & 4) {
print "<b>$program Error";
if (!empty($arg_arr['file']) && !empty($arg_arr['line'])) {
print " in $arg_arr[file] ($arg_arr[line])";
}
print ':</b>&nbsp;';
print nl2br($arg_arr['message']);
print '<br />';
flush();
}
}
/** /**
* Write debug info to the log * Write debug info to the log
* *

@ -245,20 +245,14 @@ class rcube_config
} }
// set PHP error logging according to config // set PHP error logging according to config
if ($this->prop['debug_level'] & 1) {
$error_log = $this->prop['log_driver']; $error_log = $this->prop['log_driver'];
if ($error_log != 'syslog') { if ($error_log != 'syslog') {
$error_log = $this->prop['log_dir'] . '/errors'; $error_log = $this->prop['log_dir'] . '/errors';
$error_log .= isset($this->prop['log_file_ext']) ? $this->prop['log_file_ext'] : '.log'; $error_log .= isset($this->prop['log_file_ext']) ? $this->prop['log_file_ext'] : '.log';
}
ini_set('error_log', $error_log); ini_set('error_log', $error_log);
ini_set('log_errors', 1);
} }
// enable display_errors in 'show' level, but not for ajax requests
ini_set('display_errors', intval(empty($_REQUEST['_remote']) && ($this->prop['debug_level'] & 4)));
// remove deprecated properties // remove deprecated properties
unset($this->prop['dst_active']); unset($this->prop['dst_active']);
} }

@ -96,14 +96,7 @@ else if ($ERROR_CODE == 603) {
// system error // system error
else { else {
$__error_title = "SERVICE CURRENTLY NOT AVAILABLE!"; $__error_title = "SERVICE CURRENTLY NOT AVAILABLE!";
$__error_text = "Please contact your server-administrator.";
if (($rcmail->config->get('debug_level') & 4) && $ERROR_MESSAGE) {
$__error_text = $ERROR_MESSAGE;
}
else {
$__error_text = sprintf('Error No. [%s]', $ERROR_CODE); $__error_text = sprintf('Error No. [%s]', $ERROR_CODE);
}
} }
// inform plugins // inform plugins

Loading…
Cancel
Save