diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php
index 28aea7628e9..2df2c8db4b9 100644
--- a/htdocs/install/upgrade.php
+++ b/htdocs/install/upgrade.php
@@ -115,6 +115,10 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
+ // Create the global $hookmanager object
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($db);
+
if ($db->connected == 1)
{
print '
| ';
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 47218300ad5..c40a8dfb4b8 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -107,6 +107,10 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
+ // Create the global $hookmanager object
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($db);
+
if ($db->connected != 1)
{
print ' |
| '.$langs->trans("ErrorFailedToConnectToDatabase",$conf->db->name).' | '.$langs->trans('Error').' |
';