This commit is contained in:
Laurent Destailleur
2024-07-28 20:05:10 +02:00
parent 5572b33157
commit feee2e13e7
2 changed files with 11 additions and 14 deletions

View File

@@ -851,19 +851,15 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$versiontrans .= $objMod->getVersion(1);
}
if ($objMod->isCoreOrExternalModule() == 'external'
&& (
$action == 'checklastversion'
// This is a bad practice to activate a check on an external access during the building of the admin page. 1 external module can hang the application.
// Adding a cron job could be a good idea: see DolibarrModules::checkForUpdate()
|| getDolGlobalString('CHECKLASTVERSION_EXTERNALMODULE')
)
) {
if ($objMod->isCoreOrExternalModule() == 'external' && ($action == 'checklastversion' || getDolGlobalString('CHECKLASTVERSION_EXTERNALMODULE'))) {
// Setting CHECKLASTVERSION_EXTERNALMODULE to on is a bad practice to activate a check on an external access during the building of the admin page.
// 1 external module can hang the application.
// Adding a cron job could be a good idea: see DolibarrModules::checkForUpdate()
$checkRes = $objMod->checkForUpdate();
if ($checkRes > 0) {
setEventMessage($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion);
setEventMessages($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion, null, 'warnings');
} elseif ($checkRes < 0) {
setEventMessage($objMod->getName().' '.$langs->trans('CheckVersionFail'), 'warnings');
setEventMessages($objMod->getName().' '.$langs->trans('CheckVersionFail'), null, 'errors');
}
}
@@ -1092,7 +1088,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if ($action == 'checklastversion') {
if ($foundoneexternalmodulewithupdate) {
setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'mesgs');
setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'warnings');
} else {
setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs');
}