Merge branch 'support/3.2' into develop

# Conflicts:
#	core/attributedef.class.inc.php
#	datamodels/2.x/version.xml
#	tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php
#	tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php
This commit is contained in:
XGUI
2025-02-04 10:14:41 +01:00
7 changed files with 74 additions and 16 deletions

View File

@@ -22,6 +22,7 @@ class InterfaceDiscovery
private static InterfaceDiscovery $oInstance;
private DataModelDependantCache $oCacheService;
private ?array $aForcedClassMap = null; // For testing purposes
private bool $bCheckInterfaceImplementation = true; // false only for testing purposes
const CACHE_NONE = 'CACHE_NONE';
const CACHE_DYNAMIC = 'CACHE_DYNAMIC'; // rebuild cache when files changes
@@ -86,9 +87,15 @@ class InterfaceDiscovery
continue;
}
if ($this->IsInterfaceImplementation($sPHPClass, $sInterface)) {
$aMatchingClasses[] = $sPHPClass;
if ($this->bCheckInterfaceImplementation && ! $this->IsInterfaceImplementation($sPHPClass, $sInterface)) {
continue;
}
if (! class_exists($sPHPClass)){
continue;
}
$aMatchingClasses[] = $sPHPClass;
}
if ($this->GetCacheMode() !== self::CACHE_NONE) {
@@ -241,7 +248,17 @@ class InterfaceDiscovery
public function ReadClassesFromCache(string $sKey): array
{
return $this->oCacheService->Fetch('InterfaceDiscovery', $sKey);
$aClasses = $this->oCacheService->Fetch('InterfaceDiscovery', $sKey);
$aRealClasses = [];
foreach ($aClasses as $sPHPClass){
if (! class_exists($sPHPClass)){
continue;
}
$aRealClasses[]=$sPHPClass;
}
return $aRealClasses;
}
protected function SaveClassesToCache(string $sKey, array $aMatchingClasses, array $aMoreInfo): void