From 95dc6d2327b057ae6467312f3e64dc3235d96b50 Mon Sep 17 00:00:00 2001 From: Laurent Pinsivy <lpinsivy@gmail.com> Date: Tue, 30 May 2017 13:10:26 +0200 Subject: [PATCH] ref #5269 - check if wiki is configured and extend error message (#5278) * ref #5269 - check if wiki is configured and extend error message * better wheck of kb wiki url * Fix kb synhcronization error display --- cron/centKnowledgeSynchronizer.php | 8 ++++++-- www/class/centreon-knowledge/wiki.class.php | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cron/centKnowledgeSynchronizer.php b/cron/centKnowledgeSynchronizer.php index c0168e7ad1..e911e7901c 100644 --- a/cron/centKnowledgeSynchronizer.php +++ b/cron/centKnowledgeSynchronizer.php @@ -35,5 +35,9 @@ require_once realpath(dirname(__FILE__) . "/../www/class/centreon-knowledge/wikiApi.class.php"); -$wikiApi = new WikiApi(); -$wikiApi->synchronize(); +try { + $wikiApi = new WikiApi(); + $wikiApi->synchronize(); +} catch (Exception $e) { + echo $e->getMessage() . "\n"; +} diff --git a/www/class/centreon-knowledge/wiki.class.php b/www/class/centreon-knowledge/wiki.class.php index e5f873521a..25ba580ae8 100644 --- a/www/class/centreon-knowledge/wiki.class.php +++ b/www/class/centreon-knowledge/wiki.class.php @@ -64,8 +64,10 @@ class Wiki } $res->free(); - if (!count($options)) { - throw new \Exception('Wiki is not configured.'); + if (!isset($options['kb_wiki_url']) || $options['kb_wiki_url'] == '') { + throw new \Exception( + 'Wiki is not configured. ' . + 'You can disable cron in /etc/crond.d/centreon for wiki synchronization.'); } if (!preg_match('#^http://|https://#', $options['kb_wiki_url'])) { -- GitLab