diff --git a/htdocs/core/conf.class.php b/htdocs/core/conf.class.php index b4654a74862..51557965a23 100644 --- a/htdocs/core/conf.class.php +++ b/htdocs/core/conf.class.php @@ -66,9 +66,15 @@ class Conf */ function setValues($db) { + global $conf; + dol_syslog("Conf::setValues"); $this->global->PRODUIT_CONFIRM_DELETE_LINE=1; // Par defaut, a oui + + $rootfordata = DOL_DATA_ROOT; + // If multicompany module is enabled, we redefine the root of data + if (! empty($conf->multicompany) && ! empty($conf->entity)) $rootfordata.='/'.$conf->entity; /* * Definition de toutes les Constantes globales d'environnement @@ -104,6 +110,13 @@ class Conf $this->tabs_modules[$params[0]][]=$value; //print 'xxx'.$params[0].'-'.$value; } + // If this is constant for module directories + if (eregi('^MAIN_MODULE_([A-Z_]+)_DIR_([A-Z_]+)$',$key,$reg) && $value) + { + $module=strtolower($reg[1]); + $dir_name="dir_".strtolower($reg[2]); + $this->$module->$dir_name = $rootfordata.$this->entity.$value; + } // If this is a module constant if (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value) { @@ -139,9 +152,8 @@ class Conf // Load translation object with current language if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US"; - $rootfordata = DOL_DATA_ROOT; - // If multicompany module is enabled, we redefine the root of data - if (! empty($conf->multicompany) && ! empty($conf->entity)) $rootfordata.='/'.$conf->entity; + // Other global parameters + $this->users->dir_output=$rootfordata."/users"; // For backward compatibility $this->comptaexpert->enabled=defined("MAIN_MODULE_COMPTABILITE_EXPERT")?MAIN_MODULE_COMPTABILITE_EXPERT:0; diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index 430d9dfb402..b3c69f927d2 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -992,7 +992,7 @@ class DolibarrModules if ($resql) { // On defini l'entite - $dir = DOL_DATA_ROOT."/entity_".$conf->entity.$dir; + $dir = DOL_DATA_ROOT."/".$conf->entity.$dir; if ($dir && ! file_exists($dir)) { diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 4e180fc19a2..b8f49649818 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -185,6 +185,11 @@ function dol_syslog($message, $level=LOG_INFO) { $filelog=SYSLOG_FILE; $filelog=eregi_replace('DOL_DATA_ROOT',DOL_DATA_ROOT,$filelog); + // Check if syslog module use the default path + if (!eregi('(^[A-Za-z0-9_\-\\/:]+[\\/]+)([A-Za-z0-9_\-]+[.]?[A-Za-z0-9]+)?$', SYSLOG_FILE) && $conf->syslog->dir_output) + { + $filelog = $conf->syslog->dir_output."/".$filelog; + } if (defined("SYSLOG_FILE_NO_ERROR")) $file=@fopen($filelog,"a+"); else $file=fopen($filelog,"a+");