Merge pull request #20815 from hregis/fix_missing_execute_hook

FIX missing executeHooks
This commit is contained in:
Laurent Destailleur 2022-05-10 13:53:11 +02:00 committed by GitHub
commit 67566a6064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,7 +173,12 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
// Create the global $hookmanager object
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
$reshook = $hookmanager->initHooks(array('doUpgradeBefore'));
$hookmanager->initHooks(array('upgrade2'));
$parameters = array('versionfrom' => $versionfrom, 'versionto' => $versionto);
$object = new stdClass();
$action = "upgrade";
$reshook = $hookmanager->executeHooks('doUpgradeBefore', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook >= 0 && is_array($hookmanager->resArray)) {
// Example: $hookmanager->resArray = array(2, 3, 10);
$listofentities = array_unique(array_merge($listofentities, $hookmanager->resArray));