From b98151db9463ed9145748c81e522ac5392bdd30c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Jan 2013 12:22:12 +0100 Subject: [PATCH] Fix: A log handler can be loaded twice. --- htdocs/core/class/conf.class.php | 2 +- htdocs/install/etape5.php | 4 ++++ htdocs/install/inc.php | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 75414d8f109..500d215ef44 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -454,7 +454,7 @@ class Conf throw new Exception('Log handler does not extend LogHandlerInterface'); } - $this->loghandlers[]=$loghandlerinstance; + $this->loghandlers[$handler]=$loghandlerinstance; } } } diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 4f7803c9786..1fb4f45e80f 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -142,6 +142,10 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); + // Create the global $hookmanager object + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($db); + $ok = 0; // If first install diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 866bb471d78..18648ab8680 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -228,7 +228,7 @@ foreach ($handlers as $handler) throw new Exception('Log handler does not extend LogHandlerInterface'); } - $conf->loghandlers[]=$loghandlerinstance; + if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler]=$loghandlerinstance; } @@ -331,8 +331,8 @@ function conf($dolibarr_main_document_root) { throw new Exception('Log handler does not extend LogHandlerInterface'); } - - $conf->loghandlers[]=$loghandlerinstance; + + if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler]=$loghandlerinstance; } return 1;