From 15a4d3195bd2e919b30322a39a58151d3d2357ef Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 4 Feb 2021 10:41:16 +0100 Subject: [PATCH 1/4] pass logger to contructor of SeedDMS_ExtBase --- inc/inc.ClassExtBase.php | 4 +++- inc/inc.Extension.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/inc.ClassExtBase.php b/inc/inc.ClassExtBase.php index 10237b04a..0ae1fd952 100644 --- a/inc/inc.ClassExtBase.php +++ b/inc/inc.ClassExtBase.php @@ -31,9 +31,11 @@ class SeedDMS_ExtBase { var $settings; var $dms; + var $logger; - public function __construct($settings, $dms) { + public function __construct($settings, $dms, $logger) { $this->settings = $settings; $this->dms = $dms; + $this->logger = $logger; } } diff --git a/inc/inc.Extension.php b/inc/inc.Extension.php index 5582ea4fd..e4809318b 100644 --- a/inc/inc.Extension.php +++ b/inc/inc.Extension.php @@ -43,7 +43,7 @@ foreach($extMgr->getExtensionConfiguration() as $extname=>$extconf) { $classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file']; if(file_exists($classfile)) { include($classfile); - $obj = new $extconf['class']['name']($settings, null); + $obj = new $extconf['class']['name']($settings, null, $logger); if(method_exists($obj, 'init')) $obj->init(); } From b34d06ca9b50d2ac87fd71115eb2ec315511aa44 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 4 Feb 2021 10:41:56 +0100 Subject: [PATCH 2/4] create logger before initiating extension, because it is passed to each extension --- webdav/index.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/webdav/index.php b/webdav/index.php index f7bdea5ac..0a4c5df9b 100644 --- a/webdav/index.php +++ b/webdav/index.php @@ -1,15 +1,7 @@ _logFileEnable) { if ($settings->_logFileRotation=="h") $logname=date("YmdH", time()); @@ -19,15 +11,24 @@ if($settings->_logFileEnable) { if(!file_exists($settings->_contentDir.'log')) @mkdir($settings->_contentDir.'log'); if(file_exists($settings->_contentDir.'log') && is_dir($settings->_contentDir.'log')) { - $log = Log::factory('file', $logname); - $log->setMask(Log::MAX(PEAR_LOG_DEBUG)); + $logger = Log::factory('file', $logname); + $logger->setMask(Log::MAX(PEAR_LOG_DEBUG)); } else - $log = null; + $logger = null; } else { - $log = null; + $logger = null; } -$notifier = new SeedDMS_NotificationService($log); +include("../inc/inc.Language.php"); +include("../inc/inc.Init.php"); +include("../inc/inc.Extension.php"); +include("../inc/inc.DBInit.php"); +include("../inc/inc.ClassNotificationService.php"); +include("../inc/inc.ClassEmailNotify.php"); +include("../inc/inc.ClassController.php"); +include("Log.php"); + +$notifier = new SeedDMS_NotificationService($logger); if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { @@ -51,7 +52,7 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { include("webdav.php"); $server = new HTTP_WebDAV_Server_SeedDMS(); -$server->ServeRequest($dms, $log, $notifier); +$server->ServeRequest($dms, $logger, $notifier); //$files = array(); //$options = array('path'=>'/Test1/subdir', 'depth'=>1); //echo $server->MKCOL(&$options); From a495d315e54af054a6a47f55f6587f64ab85436b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 4 Feb 2021 10:50:38 +0100 Subject: [PATCH 3/4] use global $logger --- inc/inc.Extension.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inc/inc.Extension.php b/inc/inc.Extension.php index e4809318b..b24ba1396 100644 --- a/inc/inc.Extension.php +++ b/inc/inc.Extension.php @@ -11,6 +11,8 @@ * @version Release: @package_version@ */ +global $logger; + require "inc.ClassExtensionMgr.php"; require_once "inc.ClassExtBase.php"; require_once "inc.Version.php"; From 095d187ce1cdfcf0c4d35bc9901710ac175a7577 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 4 Feb 2021 10:51:00 +0100 Subject: [PATCH 4/4] no need to include inc/inc.ClassEmailNotify.php and Log.php anymore --- webdav/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webdav/index.php b/webdav/index.php index 0a4c5df9b..e4925f371 100644 --- a/webdav/index.php +++ b/webdav/index.php @@ -24,9 +24,9 @@ include("../inc/inc.Init.php"); include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.ClassNotificationService.php"); -include("../inc/inc.ClassEmailNotify.php"); +//include("../inc/inc.ClassEmailNotify.php"); include("../inc/inc.ClassController.php"); -include("Log.php"); +//include("Log.php"); $notifier = new SeedDMS_NotificationService($logger);