diff --git a/core/metamodel.class.php b/core/metamodel.class.php index e43cf81d0..beea2e118 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -4922,7 +4922,15 @@ abstract class MetaModel if (!file_exists($sFile)) { $sConfigFile = self::$m_oConfig->GetLoadedFile(); - throw new CoreException('Wrong filename in configuration file', array('file' => $sConfigFile, 'module' => $sModuleType, 'filename' => $sFile)); + if (strlen($sConfigFile) > 0) + { + throw new CoreException('Include: wrong file name in configuration file', array('config file' => $sConfigFile, 'section' => $sModuleType, 'filename' => $sFile)); + } + else + { + // The configuration is in memory only + throw new CoreException('Include: wrong file name in configuration file (in memory)', array('section' => $sModuleType, 'filename' => $sFile)); + } } // Note: We do not expect the modules to output characters while loading them. diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 0e3989bee..63f0b377a 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -116,14 +116,27 @@ class MFCompiler } // Determine the target module (exactly one!) for USER RIGHTS - // + // This used to be based solely on the module which created the user_rights node first + // Unfortunately, our sample extension was delivered with the xml structure, resulting in the new module to be the recipient of the compilation + // Then model.itop-profiles-itil would not exist... resulting in an error after the compilation (and the actual product of the compiler would never be included + // The bullet proof implementation would be to compile in a separate directory as it has been done with the dictionaries... that's another story + $aModules = $this->oFactory->GetLoadedModules(); $sUserRightsModule = ''; - $oUserRightsNode = $this->oFactory->GetNodes('user_rights')->item(0); - if ($oUserRightsNode) + foreach($aModules as $foo => $oModule) { - $sUserRightsModule = $oUserRightsNode->getAttribute('_created_in'); - $this->Log("User Rights module found: $sUserRightsModule"); + if ($oModule->GetName() == 'itop-profiles-itil') + { + $sUserRightsModule = 'itop-profiles-itil'; + break; + } } + $oUserRightsNode = $this->oFactory->GetNodes('user_rights')->item(0); + if ($oUserRightsNode && ($sUserRightsModule == '')) + { + // Legacy algorithm (itop <= 2.0.3) + $sUserRightsModule = $oUserRightsNode->getAttribute('_created_in'); + } + $this->Log("User Rights module found: '$sUserRightsModule'"); // List root classes //