Laurent Destailleur 2 tahun lalu
induk
melakukan
44da230012

+ 3 - 3
htdocs/admin/system/perf.php

@@ -82,14 +82,14 @@ print '<br>';
 // Module log
 print '<br>';
 print '<strong>'.$langs->trans("Syslog").'</strong>: ';
-$test = empty($conf->syslog->enabled);
+$test = !isModEnabled('syslog');
 if ($test) {
 	print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").'  <span class="opacitymedium">'.$langs->trans("NotSlowedDownByThis").'</span>';
 } else {
-	if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) {
+	if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) {
 		print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
 	} else {
-		print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL);
+		print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL'));
 	}
 	//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
 }

+ 3 - 3
htdocs/admin/system/security.php

@@ -453,14 +453,14 @@ print load_fiche_titre($langs->trans("Modules"), '', 'folder');
 
 // Module log
 print '<strong>'.$langs->trans("Syslog").'</strong>: ';
-$test = empty($conf->syslog->enabled);
+$test = !isModEnabled('syslog');
 if ($test) {
 	print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
 } else {
-	if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) {
+	if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) {
 		print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
 	} else {
-		print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL);
+		print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL'));
 	}
 	//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
 }

+ 3 - 3
htdocs/admin/tools/purge.php

@@ -38,8 +38,8 @@ $nbsecondsold = GETPOSTINT('nbsecondsold');
 
 // Define filelog to discard it from purge
 $filelog = '';
-if (!empty($conf->syslog->enabled)) {
-	$filelog = $conf->global->SYSLOG_FILE;
+if (isModEnabled('syslog')) {
+	$filelog = getDolGlobalString('SYSLOG_FILE');
 	$filelog = preg_replace('/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog);
 }
 
@@ -96,7 +96,7 @@ print '<table class="border centpercent">';
 
 print '<tr class="border"><td style="padding: 4px">';
 
-if (!empty($conf->syslog->enabled)) {
+if (isModEnabled('syslog')) {
 	print '<input type="radio" name="choice" id="choicelogfile" value="logfile"';
 	print ($choice && $choice == 'logfile') ? ' checked' : '';
 	$filelogparam = $filelog;

+ 7 - 3
htdocs/core/class/conf.class.php

@@ -47,6 +47,12 @@ class Conf
 	//! To store browser info
 	public $browser;
 
+	//! To store some setup of generic modules
+	public $mycompany;
+	public $admin;
+	public $medias;
+
+
 	//! To store if javascript/ajax is enabked
 	public $use_javascript_ajax;
 	//! To store if javascript/ajax is enabked
@@ -141,7 +147,6 @@ class Conf
 
 		// First level object that are modules.
 		// TODO Remove this part.
-		$this->syslog = new stdClass();
 		$this->multicompany = new stdClass();
 		$this->expedition_bon = new stdClass();
 		$this->delivery_note = new stdClass();
@@ -212,7 +217,6 @@ class Conf
 
 		// First level object
 		// TODO Remove this part.
-		$this->syslog = new stdClass();
 		$this->expedition_bon = new stdClass();
 		$this->delivery_note = new stdClass();
 		$this->fournisseur = new stdClass();
@@ -1018,7 +1022,7 @@ class Conf
 				}
 			}
 
-			if (!empty($this->syslog->enabled)) {
+			if (isModEnabled('syslog')) {
 				// We init log handlers
 				if (!empty($this->global->SYSLOG_HANDLERS)) {
 					$handlers = json_decode($this->global->SYSLOG_HANDLERS);

+ 1 - 1
htdocs/core/class/utils.class.php

@@ -121,7 +121,7 @@ class Utils
 					$filesarray = dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*(\.gz)?$', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1);
 				}
 
-				if (!empty($conf->syslog->enabled)) {
+				if (isModEnabled('syslog')) {
 					$filelog = $conf->global->SYSLOG_FILE;
 					$filelog = preg_replace('/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog);
 

+ 1 - 1
htdocs/core/lib/functions.lib.php

@@ -1641,7 +1641,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
 	global $conf, $user, $debugbar;
 
 	// If syslog module enabled
-	if (empty($conf->syslog->enabled)) {
+	if (!isModEnabled('syslog')) {
 		return;
 	}
 

+ 6 - 0
htdocs/install/inc.php

@@ -232,6 +232,9 @@ if ($islocked) {	// Pages are locked
 
 
 // Force usage of log file for install and upgrades
+if (!isset($conf->syslog) || !is_object($conf->syslog)) {
+	$conf->syslog = new stdClass();
+}
 $conf->syslog->enabled = 1;
 $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
 if (!defined('SYSLOG_HANDLERS')) {
@@ -341,6 +344,9 @@ function conf($dolibarr_main_document_root)
 	$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
 
 	// Force usage of log file for install and upgrades
+	if (!isset($conf->syslog) || !is_object($conf->syslog)) {
+		$conf->syslog = new stdClass();
+	}
 	$conf->syslog->enabled = 1;
 	$conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
 	if (!defined('SYSLOG_HANDLERS')) {

+ 3 - 1
htdocs/support/inc.php

@@ -39,7 +39,9 @@ $conf = new stdClass(); // instantiate $conf explicitely
 $conf->global	= new stdClass();
 $conf->file = new stdClass();
 $conf->db = new stdClass();
-$conf->syslog	= new stdClass();
+if (!isset($conf->syslog) || !is_object($conf->syslog)) {
+	$conf->syslog = new stdClass();
+}
 
 // Force $_REQUEST["logtohtml"]
 $_REQUEST["logtohtml"] = 1;