A little speed improvment

This commit is contained in:
Laurent Destailleur 2010-04-18 23:17:41 +00:00
parent a66d44431d
commit 7bccb7dd86

View File

@ -116,27 +116,29 @@ class Conf
if (! defined("$key")) define ("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE during install) if (! defined("$key")) define ("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE during install)
$this->global->$key=$value; $this->global->$key=$value;
if ($value)
{
// If this is constant for a css file activated by a module // If this is constant for a css file activated by a module
if (preg_match('/^MAIN_MODULE_([A-Z_]+)_CSS$/i',$key) && $value) if (preg_match('/^MAIN_MODULE_([A-Z_]+)_CSS$/i',$key))
{ {
$this->css_modules[]=$value; $this->css_modules[]=$value;
} }
// If this is constant for a new tab page activated by a module // If this is constant for a new tab page activated by a module
if (preg_match('/^MAIN_MODULE_([A-Z_]+)_TABS_/i',$key) && $value) elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_TABS_/i',$key))
{ {
$params=explode(':',$value,2); $params=explode(':',$value,2);
$this->tabs_modules[$params[0]][]=$value; $this->tabs_modules[$params[0]][]=$value;
//print 'xxx'.$params[0].'-'.$value; //print 'xxx'.$params[0].'-'.$value;
} }
// If this is constant for triggers activated by a module // If this is constant for triggers activated by a module
if (preg_match('/^MAIN_MODULE_([A-Z_]+)_TRIGGERS$/i',$key,$regs) && $value) elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_TRIGGERS$/i',$key,$regs))
{ {
$modulename = strtolower($regs[1]); $modulename = strtolower($regs[1]);
$this->triggers_modules[] = DOL_DOCUMENT_ROOT.'/'.$modulename.'/inc/triggers/'; $this->triggers_modules[] = DOL_DOCUMENT_ROOT.'/'.$modulename.'/inc/triggers/';
} }
// If this is constant to force a module directories (used to manage some exceptions) // If this is constant to force a module directories (used to manage some exceptions)
// Should not be used by modules // Should not be used by modules
if (preg_match('/^MAIN_MODULE_([A-Z_]+)_DIR_/i',$key,$reg) && $value) elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_DIR_/i',$key,$reg))
{ {
$module=strtolower($reg[1]); $module=strtolower($reg[1]);
// If with submodule name // If with submodule name
@ -147,7 +149,7 @@ class Conf
$this->$module->$submodule->$dir_name = $value; // We put only dir name. We will add DOL_DATA_ROOT later $this->$module->$submodule->$dir_name = $value; // We put only dir name. We will add DOL_DATA_ROOT later
//print '->'.$module.'->'.$submodule.'->'.$dir_name.' = '.$this->$module->$submodule->$dir_name.'<br>'; //print '->'.$module.'->'.$submodule.'->'.$dir_name.' = '.$this->$module->$submodule->$dir_name.'<br>';
} }
else if (preg_match('/_DIR_([A-Z]+)$/i',$key,$reg)) elseif (preg_match('/_DIR_([A-Z]+)$/i',$key,$reg))
{ {
$dir_name = "dir_".strtolower($reg[1]); $dir_name = "dir_".strtolower($reg[1]);
$this->$module->$dir_name = $value; // We put only dir name. We will add DOL_DATA_ROOT later $this->$module->$dir_name = $value; // We put only dir name. We will add DOL_DATA_ROOT later
@ -155,14 +157,14 @@ class Conf
} }
} }
// If this is constant for a smarty need by a module // If this is constant for a smarty need by a module
if (preg_match('/^MAIN_MODULE_([A-Z_]+)_NEEDSMARTY$/i',$key) && $value) elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_NEEDSMARTY$/i',$key))
{ {
$module=strtolower($reg[1]); $module=strtolower($reg[1]);
// Add this module in list of modules that need smarty // Add this module in list of modules that need smarty
$this->need_smarty[]=$module; $this->need_smarty[]=$module;
} }
// If this is a module constant // If this is a module constant
if (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg) && $value) elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)$/i',$key,$reg))
{ {
$module=strtolower($reg[1]); $module=strtolower($reg[1]);
//print "Module ".$module." is enabled<br>\n"; //print "Module ".$module." is enabled<br>\n";
@ -171,10 +173,12 @@ class Conf
$this->modules[]=$module; $this->modules[]=$module;
} }
} }
}
$i++; $i++;
} }
} }
$db->free($result); $db->free($result);
//var_dump($this->modules);
// Clean some variables // Clean some variables
// conf->menu_top et conf->menu_left are defined in main.inc.php (according to user choice) // conf->menu_top et conf->menu_left are defined in main.inc.php (according to user choice)