mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°4280 Handle modules with non existing model.*.php files imported (#295)
We were crashing iTop when having a module with : * in the 'datamodel' key in the module.*.php file a 'model.*.php' declared * no model.*.php file in the module sources * no model.*.php generated after compilation This behavior is improved : * if isdevenv an exception will be thrown detailing which module is concerned * else : - model.*.php won't be added in iTop datamodel autoload - a SetupLog::Error will be made
This commit is contained in:
@@ -617,7 +617,21 @@ EOF;
|
||||
// files to include (PHP datamodels)
|
||||
foreach($oModule->GetFilesToInclude('business') as $sRelFileName)
|
||||
{
|
||||
$aDataModelFiles[] = "MetaModel::IncludeModule(MODULESROOT.'/$sRelativeDir/$sRelFileName');";
|
||||
if (file_exists("{$sTempTargetDir}/{$sRelativeDir}/{$sRelFileName}")) {
|
||||
$aDataModelFiles[] = "MetaModel::IncludeModule(MODULESROOT.'/$sRelativeDir/$sRelFileName');";
|
||||
} else {
|
||||
/** @noinspection NestedPositiveIfStatementsInspection */
|
||||
if (utils::IsDevelopmentEnvironment()) {
|
||||
$sMissingBusinessFileMessage = 'A module embeds a non existing file : check the module.php "datamodel" key !';
|
||||
$aContext = [
|
||||
'moduleId' => $oModule->GetId(),
|
||||
'moduleLocation' => $oModule->GetRootDir(),
|
||||
'includedFile' => $sRelFileName,
|
||||
];
|
||||
SetupLog::Error($sMissingBusinessFileMessage, null, $aContext);
|
||||
throw new CoreException($sMissingBusinessFileMessage, $aContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
// files to include (PHP webservices providers)
|
||||
foreach($oModule->GetFilesToInclude('webservices') as $sRelFileName)
|
||||
|
||||
Reference in New Issue
Block a user