N°9169 - Adapt ITSM designer connector to the new setup (WIP)

This commit is contained in:
lenaick.moreira
2026-05-27 14:58:25 +02:00
parent b3f984b0e1
commit 643ec3bc43

View File

@@ -380,6 +380,42 @@ class iTopExtensionsMap
return false;
}
/**
* Return the list of extensions found in a given directory (not recursively)
*
* @param string $sSearchDir The directory to scan
*
* @return string[]|bool
*/
public function GetExtensionsFromDir($sSearchDir): array|bool
{
if (!is_readable($sSearchDir)) {
return false;
}
$aExtensions = [];
$hDir = opendir($sSearchDir);
if ($hDir !== false) {
// Then scan the other files and subdirectories
while (($sDir = readdir($hDir)) !== false) {
if (($sDir === '.') || ($sDir === '..') || !is_dir($sSearchDir.$sDir)) {
continue;
}
// First check if there is an extension.xml file in this directory
if (is_readable($sSearchDir.$sDir.'/extension.xml')) {
$oXml = new XMLParameters($sSearchDir.$sDir.'/extension.xml');
$aExtensions[] = $oXml->Get('extension_code');
}
}
closedir($hDir);
}
return $aExtensions;
}
/**
* Check if some extension contains a module with missing dependencies...
* If so, populate the aMissingDepenencies array