mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7847 - Extensions via interface not recognized
N°7803 - MTP from itophub/designer failing in itop 3.2.0
This commit is contained in:
@@ -161,7 +161,7 @@ class DataModelDependantCache
|
||||
/**
|
||||
* for test purpose
|
||||
*
|
||||
* @param string $sStorageRootDir
|
||||
* @param string|null $sStorageRootDir if null the current cache path is used
|
||||
*/
|
||||
public function SetStorageRootDir(?string $sStorageRootDir): void
|
||||
{
|
||||
|
||||
@@ -10,6 +10,13 @@ use MetaModel;
|
||||
use ReflectionClass;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* Enumerate classes implementing given interfaces
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class InterfaceDiscovery
|
||||
{
|
||||
private static InterfaceDiscovery $oInstance;
|
||||
@@ -17,8 +24,8 @@ class InterfaceDiscovery
|
||||
private ?array $aForcedClassMap = null; // For testing purposes
|
||||
|
||||
const CACHE_NONE = 'CACHE_NONE';
|
||||
const CACHE_DYNAMIC = 'CACHE_DYNAMIC';
|
||||
const CACHE_STATIC = 'CACHE_STATIC';
|
||||
const CACHE_DYNAMIC = 'CACHE_DYNAMIC'; // rebuild cache when files changes
|
||||
const CACHE_STATIC = 'CACHE_STATIC'; // Built once at setup
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
@@ -38,20 +45,20 @@ class InterfaceDiscovery
|
||||
* Find the ITOP classes implementing a given interface. The returned classes have the following properties:
|
||||
* - They can be instantiated
|
||||
* - They are not aliases
|
||||
* - Their path relative to iTop does not contain /lib/, /node_modules/, /test/ or /tests/
|
||||
*
|
||||
* @param string $sInterface Fully qualified interface name
|
||||
* @param array|null $aAdditionalExcludedPaths Optional list of paths to exclude from the search (partial names allowed, case sensitive, use / as separator)
|
||||
*
|
||||
* @return array of fully qualified class names
|
||||
* @throws \ReflectionException when $sInterface is not an interface
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function FindItopClasses(string $sInterface, ?array $aAdditionalExcludedPaths = null): array
|
||||
public function FindItopClasses(string $sInterface): array
|
||||
{
|
||||
if (is_null($aAdditionalExcludedPaths)) {
|
||||
return $this->FindClasses($sInterface, ['/lib/', '/node_modules/', '/test/', '/tests/']);
|
||||
}
|
||||
|
||||
$aExcludedPaths = array_merge(['/lib/', '/node_modules/', '/test/', '/tests/'], $aAdditionalExcludedPaths);
|
||||
$aExcludedPaths = ['/lib/', '/node_modules/', '/test/', '/tests/'];
|
||||
|
||||
return $this->FindClasses($sInterface, $aExcludedPaths);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user