2
0
forked from Wavyzz/dolibarr

Fix compatibility with the removal of "constant".

This commit is contained in:
Laurent Destailleur
2017-04-29 18:30:36 +02:00
parent ff0f40ab37
commit a8c775dcbd
12 changed files with 51 additions and 32 deletions

View File

@@ -48,7 +48,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
{
global $langs;
return $this->isActive()?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php');
return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php');
}
/**
@@ -73,7 +73,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
if ($res)
{
return 1;
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler
}
else
{

View File

@@ -51,7 +51,8 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
*/
public function isActive()
{
return 1;
global $conf;
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FILE)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FILE to 1 to disable this loghandler
}
/**

View File

@@ -56,7 +56,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
{
global $langs;
return $this->isActive()?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path);
return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path);
}
/**
@@ -76,7 +76,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
$res = @include_once self::$firephp_class_path;
restore_include_path();
if ($res) {
return 1;
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler
} else {
return 0;
}

View File

@@ -48,10 +48,12 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
*/
public function isActive()
{
global $conf;
// This function does not exists on some ISP (Ex: Free in France)
if (!function_exists('openlog')) return 0;
return 1;
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler
}
/**
@@ -111,11 +113,11 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler
if (! empty($conf->global->SYSLOG_FACILITY))
if (! empty($conf->global->SYSLOG_FACILITY)) // Example LOG_USER
{
$facility = constant($conf->global->SYSLOG_FACILITY);
}
else $facility = LOG_USER;
else $facility = constant('LOG_USER');
// (int) is required to avoid error parameter 3 expected to be long
openlog('dolibarr', LOG_PID | LOG_PERROR, (int) $facility);