diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 540ae3d8e7..ad6a97cbfc 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -5761,36 +5761,34 @@ abstract class MetaModel self::$m_sEnvironment = $sEnvironment; - try { - if (!defined('MODULESROOT')) { - define('MODULESROOT', APPROOT.'env-'.self::$m_sEnvironment.'/'); + if (!defined('MODULESROOT')) { + define('MODULESROOT', APPROOT.'env-'.self::$m_sEnvironment.'/'); - self::$m_bTraceSourceFiles = $bTraceSourceFiles; + self::$m_bTraceSourceFiles = $bTraceSourceFiles; - // $config can be either a filename, or a Configuration object (volatile!) - if ($config instanceof Config) { - self::LoadConfig($config, $bAllowCache); - } else { - self::LoadConfig(new Config($config), $bAllowCache); - } - - if ($bModelOnly) { - return; - } + // $config can be either a filename, or a Configuration object (volatile!) + if ($config instanceof Config) { + self::LoadConfig($config, $bAllowCache); + } else { + self::LoadConfig(new Config($config), $bAllowCache); } - CMDBSource::SelectDB(self::$m_sDBName); - - foreach (MetaModel::EnumPlugins('ModuleHandlerApiInterface') as $oPHPClass) { - $oPHPClass::OnMetaModelStarted(); + if ($bModelOnly) { + return; } - - ExpressionCache::Warmup(); - } finally { - // Event service must be initialized after the MetaModel startup, otherwise it cannot discover classes implementing the iEventServiceSetup interface - EventService::InitService(); - EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_METAMODEL_STARTED)); } + + CMDBSource::SelectDB(self::$m_sDBName); + + foreach (MetaModel::EnumPlugins('ModuleHandlerApiInterface') as $oPHPClass) { + $oPHPClass::OnMetaModelStarted(); + } + + ExpressionCache::Warmup(); + + // Event service must be initialized after the MetaModel startup, otherwise it cannot discover classes implementing the iEventServiceSetup interface + EventService::InitService(); + EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_METAMODEL_STARTED)); } /**