From 0e5a501b2a524cb0bef89a91cfb53604c982eb02 Mon Sep 17 00:00:00 2001 From: acognet Date: Wed, 27 May 2020 10:13:44 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03012=20-=20Fix=20blocking=20MTT/MTP=20wh?= =?UTF-8?q?en=20/extensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/setuputils.class.inc.php | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index 70911820c..113fb93e7 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -1606,29 +1606,16 @@ JS } $sManualInstallModulesFullPath = APPROOT.$sExtensionsDir.DIRECTORY_SEPARATOR; - $aManualInstallModules = array_filter($aModules, - static function ($v, $k) use ($sManualInstallModulesFullPath) { - if (!isset($v['root_dir'])) // avoid index undefined for the _Root_ entry - { - return false; - } - // calling realpath to avoid problems with dir separator (almost everywhere we are adding '/' instead of DIRECTORY_SEPARATOR) - $return = utils::RealPath($v['root_dir'], $sManualInstallModulesFullPath); - if ($return === false) - { - return false; - } - - return true; - }, - ARRAY_FILTER_USE_BOTH); - - if (empty($aManualInstallModules)) + //simple test in order to prevent install iTop pro with module in extension folder + $fileInfo = scandir($sManualInstallModulesFullPath); + foreach ($fileInfo as $folder) { - return ''; + if ($folder != "." && $folder != ".." && is_dir($sManualInstallModulesFullPath.$folder) === true) + { + return "Some modules are present in the '$sExtensionsDir' directory, this is not allowed when using ".ITOP_APPLICATION; + } } - - return "Some modules are present in the '$sExtensionsDir' directory, this is not allowed when using ".ITOP_APPLICATION; + return ''; } /**