From f13cb3eaef47beea509a681c9befbd4bede96c85 Mon Sep 17 00:00:00 2001 From: loiclau <loic.lau@gmail.com> Date: Wed, 10 May 2017 14:05:58 +0200 Subject: [PATCH] * fix knowledge cron compatibility php < 5.4 and check api configuration --- cron/centKnowledgeSynchronizer.php | 3 ++- www/class/centreon-knowledge/wikiApi.class.php | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cron/centKnowledgeSynchronizer.php b/cron/centKnowledgeSynchronizer.php index 84ecf6a306..c0168e7ad1 100644 --- a/cron/centKnowledgeSynchronizer.php +++ b/cron/centKnowledgeSynchronizer.php @@ -35,4 +35,5 @@ require_once realpath(dirname(__FILE__) . "/../www/class/centreon-knowledge/wikiApi.class.php"); -(New WikiApi)->synchronize(); \ No newline at end of file +$wikiApi = new WikiApi(); +$wikiApi->synchronize(); diff --git a/www/class/centreon-knowledge/wikiApi.class.php b/www/class/centreon-knowledge/wikiApi.class.php index cdcbce7c11..9ebc85caed 100644 --- a/www/class/centreon-knowledge/wikiApi.class.php +++ b/www/class/centreon-knowledge/wikiApi.class.php @@ -90,7 +90,11 @@ class WikiApi $version = $result['query']['general']['generator']; $version = explode(' ', $version); - return (float)$version[1]; + if (isset($version[1])) { + return (float)$version[1]; + } else { + throw new \Exception("An error occured, please check your Knowledge base configuration"); + } } public function login() -- GitLab