N°9134 Validate extension codes before installation and refine progress message styling (#909)

* N°9134 Validate extension codes before installation and refine progress message styling

* Add test for compile failure when extension code is missing
This commit is contained in:
Lenaick
2026-05-18 10:11:37 +02:00
committed by GitHub
parent b29a3b5df8
commit fb7a38c83f
4 changed files with 110 additions and 8 deletions

View File

@@ -1467,6 +1467,14 @@ class RunTimeEnvironment
// Removed modules are stored as static for FindModules()
$oExtensionsMap->DeclareExtensionAsRemoved($aRemovedExtensionCodes);
// Check that all the extensions have a code
foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) {
if (empty($oExtension->sCode)) {
$sExtensionLabel = !empty($oExtension->sLabel) ? $oExtension->sLabel : $oExtension->sSourceDir;
throw new Exception(sprintf('Extension "%s" cannot be installed: Missing extension code', $sExtensionLabel));
}
}
$oFactory = new ModelFactory($aDirsToScan);
$oDictModule = new MFDictModule('dictionaries', 'iTop Dictionaries', APPROOT.'dictionaries');
@@ -1566,7 +1574,7 @@ class RunTimeEnvironment
public function ExitMaintenanceMode(): void
{
if (SetupUtils::IsInMaintenanceMode()){
if (SetupUtils::IsInMaintenanceMode()) {
SetupUtils::ExitMaintenanceMode();
}
}