From 28c62fb214c215262f9fcaeca1836948ab0df41f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Sep 2015 12:21:26 +0200 Subject: [PATCH] Introduce a function to return a warning by loggers. --- htdocs/admin/syslog.php | 6 ++++- htdocs/core/modules/syslog/logHandler.php | 14 ++++++++++-- .../modules/syslog/logHandlerInterface.php | 7 ++++++ .../modules/syslog/mod_syslog_chromephp.php | 22 +++++++++++++++---- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 7d713760382..44002dc4c74 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -225,7 +225,11 @@ foreach ($syslogModules as $moduleName) print ''; if ($module->getInfo()) { - print $form->textwithpicto('', $module->getInfo()); + print $form->textwithpicto('', $module->getInfo(), 1, 'help'); + } + if ($module->getWarning()) + { + print $form->textwithpicto('', $module->getWarning(), 1, 'warning'); } print ''; print "\n"; diff --git a/htdocs/core/modules/syslog/logHandler.php b/htdocs/core/modules/syslog/logHandler.php index 1701ca2bdce..fa013f4b083 100644 --- a/htdocs/core/modules/syslog/logHandler.php +++ b/htdocs/core/modules/syslog/logHandler.php @@ -28,13 +28,23 @@ class LogHandler /** * Content of the info tooltip. * - * @return false|string + * @return string */ public function getInfo() { - return false; + return ''; } + /** + * Return warning if something is wrong with logger + * + * @return string + */ + public function getWarning() + { + return ''; + } + /** * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') * diff --git a/htdocs/core/modules/syslog/logHandlerInterface.php b/htdocs/core/modules/syslog/logHandlerInterface.php index f0d78735155..6f59482a1c0 100644 --- a/htdocs/core/modules/syslog/logHandlerInterface.php +++ b/htdocs/core/modules/syslog/logHandlerInterface.php @@ -48,6 +48,13 @@ interface LogHandlerInterface */ public function getInfo(); + /** + * Return warning if something is wrong with logger + * + * @return string Warning message + */ + public function getWarning(); + /** * Return array of configuration data * diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index e47a0059828..adcaa9d7f00 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -32,19 +32,29 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface /** * Content of the info tooltip. * - * @return false|string + * @return string */ public function getInfo() + { + return ''; + } + + /** + * Return warning if something is wrong with logger + * + * @return string + */ + public function getWarning() { global $langs; return $this->isActive()?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php'); } - + /** * Is the module active ? * - * @return int + * @return int -1 if not active, 0 if active but lib/path not found, 1 if OK */ public function isActive() { @@ -65,6 +75,10 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface { return 1; } + else + { + return 0; + } } catch(Exception $e) { @@ -89,7 +103,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', 'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/', 'attr' => 'size="60"', - 'example' =>'/usr/share/php' + 'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/' ) ); }