From 560829cacfa77413eba9447925fdb211eddcfd03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Oct 2024 20:46:10 +0200 Subject: [PATCH] Fix test on malware --- htdocs/admin/modules.php | 26 +++++++++++++++++++++++++- htdocs/langs/en_US/admin.lang | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 89771ccd029..dbe855da248 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -281,6 +281,30 @@ if ($action == 'install' && $allowonlineinstall) { } } + /* + if (!$error) { + if (GETPOST('checkforcompliance')) { + $dir = $dirins; + $file = $modulenameval; + // $installedmodule + try { + $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. + $modName = substr($file, 0, dol_strlen($file) - 10); + if ($modName) { + if (class_exists($modName)) { + $objMod = new $modName($db); + '@phan-var-force DolibarrModules $objMod'; + + //var_dump($objMod); + } + } + } catch(Exception $e) { + // Nothing done + } + } + } + */ + if (!$error) { $searchParams = array( 'search_keyword' => $modulenameval, @@ -887,7 +911,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { } } - if ($objMod->isCoreOrExternalModule() == 'external' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { + if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law if (!is_numeric($checkRes) && $checkRes != '') { $langs->load("errors"); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4e36afbdf32..da87a6b9cf4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2574,4 +2574,4 @@ SALES_ORDER_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (F MaxNbOfRecordOnListIsOk=You have a max size for lists is set to %s lines. This is a good value. YouHaveALargeAmountOfRecordOnLists=You have a default max size for lists set to %s lines. This is a large value that need scrolling to see all answers. It is better to have a value lower than %s and use pagination to see record over this number. Change this in menu Home - Setup - Display. RoundBorders=Round borders -CheckIfModuleIsNotBlackListed=Some modules may be provided by some companies that do not respect the project's rules of goodwill (non-compliance with GDPR, violation of the rules tof use the Dolibarr brand name, etc.). By checking this box, a check will be made with the project to inform you if a report was made about this module and will protect you by blocking the deployment. +CheckIfModuleIsNotBlackListed=Some modules may be provided by some companies that do not respect the project's rules of goodwill (non-compliance with GDPR, violation of the rules tof use the Dolibarr brand name, etc.). By checking this box, a request will be made to the project server to see if a report was received about this module, and will protect you by blocking the deployment if module is flagged as this.