Fix: the syslog handler for chromphp an fiefoxphp was not visible when

they should not.
This commit is contained in:
Laurent Destailleur 2015-02-07 19:30:28 +01:00
parent 64963ef9bd
commit 1d1b3da182
4 changed files with 10 additions and 14 deletions

View File

@ -94,7 +94,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
/** /**
* Return if configuration is valid * Return if configuration is valid
* *
* @return boolean True if configuration ok * @return array Array of errors. Empty array if ok.
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {
@ -102,17 +102,11 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
$errors = array(); $errors = array();
$oldinclude = get_include_path(); if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php'))
set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
if (!file_exists('ChromePhp.class.php'))
{ {
$errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php'); $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php');
$errors[] = $langs->trans("IncludePath").' : '.get_include_path();
} }
set_include_path($oldinclude);
return $errors; return $errors;
} }
@ -129,7 +123,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler
//We check the configuration to avoid showing PHP warnings //We check the configuration to avoid showing PHP warnings
if (count($this->checkConfiguration())) return false; if (count($this->checkConfiguration()) > 0) return false;
try try
{ {
@ -137,8 +131,10 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
// database or config file because we must be able to log data before database or config file read. // database or config file because we must be able to log data before database or config file read.
$oldinclude=get_include_path(); $oldinclude=get_include_path();
set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
include_once 'ChromePhp.class.php'; $res = @include_once('ChromePhp.php');
if (! $res) $res=@include_once('ChromePhp.class.php');
set_include_path($oldinclude); set_include_path($oldinclude);
ob_start(); // To be sure headers are not flushed until all page is completely processed ob_start(); // To be sure headers are not flushed until all page is completely processed
if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']);
elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']);

View File

@ -74,7 +74,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
/** /**
* Return if configuration is valid * Return if configuration is valid
* *
* @return boolean True if configuration ok * @return array Array of errors. Empty array if ok.
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {

View File

@ -86,7 +86,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
/** /**
* Return if configuration is valid * Return if configuration is valid
* *
* @return boolean True if configuration ok * @return array Array of errors. Empty array if ok.
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {

View File

@ -73,7 +73,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
/** /**
* Return if configuration is valid * Return if configuration is valid
* *
* @return boolean True if configuration ok * @return array Array of errors. Empty array if ok.
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {