From 5a508b473e674fb8d7c785e91c833d3eb8670c7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Apr 2026 01:05:01 +0200 Subject: [PATCH] Fix upgrade must not run upgrade for not enabled modules. --- htdocs/install/upgrade.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index e16eb5acb18..a662ee14333 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -162,6 +162,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port); + // Create the global $hookmanager object include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); @@ -397,18 +398,26 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ } if (count($modulesfile)) { + $conf->setValues($db); // Load conf so we knowmodules that are enabled + print '
'; foreach ($modulesfile as $modulefilelong => $modulefileshort) { if (in_array($modulefilelong, $listoffileprocessed)) { continue; } + $dirofmodule = preg_replace('/\//', '', preg_replace('/\/sql\/[a-z0-8_]+\.sql$/', '', $modulefileshort)); - print ''.$langs->trans("ChoosedMigrateScript").' (external modules)'.$modulefileshort.''."\n"; + if (isModEnabled($dirofmodule)) { + print ''.$langs->trans("ChoosedMigrateScript").' (external modules '.$dirofmodule.')'.$modulefileshort.''."\n"; - // Run sql script - $okmodule = run_sql($modulefilelong, 0, 0, 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not. - $listoffileprocessed[$modulefilelong] = $modulefilelong; + // Run sql script + $okmodule = run_sql($modulefilelong, 0, 0, 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not. + $listoffileprocessed[$modulefilelong] = $modulefilelong; + } else { + print ''.$langs->trans("ChoosedMigrateScript").' (external modules '.$dirofmodule.')'.$modulefileshort.''."\n"; + print ''.$langs->trans("ProcessMigrateScript").'Ignored (module not enabled)'."\n"; + } } } }