Work on PHP 8 compatibility

This commit is contained in:
Laurent Destailleur 2023-04-15 01:52:35 +02:00
parent f5ce54728d
commit 6b7de51d21
3 changed files with 7 additions and 2 deletions

View File

@ -358,11 +358,12 @@ class Conf
if ($modulename == 'supplierproposal') {
$modulename = 'supplier_proposal';
}
$this->modules[$modulename] = $modulename; // Add this module in list of enabled modules
// deprecated
if (!isset($this->$modulename) || !is_object($this->$modulename)) {
$this->$modulename = new stdClass();
}
$this->$modulename->enabled = true;
$this->modules[] = $modulename; // Add this module in list of enabled modules
}
}
}

View File

@ -166,7 +166,9 @@ function getDolUserInt($key, $default = 0, $tmpuser = null)
function isModEnabled($module)
{
global $conf;
return !empty($conf->$module->enabled);
return !empty($conf->modules[$module]);
//return !empty($conf->$module->enabled);
}
/**

View File

@ -323,6 +323,7 @@ if (!isset($conf->syslog) || !is_object($conf->syslog)) {
$conf->syslog = new stdClass();
}
$conf->syslog->enabled = 1;
$conf->modules['syslog'] = 'syslog';
$conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
if (!defined('SYSLOG_HANDLERS')) {
define('SYSLOG_HANDLERS', '["mod_syslog_file"]');
@ -435,6 +436,7 @@ function conf($dolibarr_main_document_root)
$conf->syslog = new stdClass();
}
$conf->syslog->enabled = 1;
$conf->modules['syslog'] = 'syslog';
$conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
if (!defined('SYSLOG_HANDLERS')) {
define('SYSLOG_HANDLERS', '["mod_syslog_file"]');