diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index afb670dc267b76a706b0ee6141cc85067a51d4f0..8faea875ab55833d602c78a4d3a506c3902cd9ee 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -59,15 +59,14 @@ class HookManager /** * Init array $this->hooks with instantiated action controlers. - * First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS - * with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file. + * First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file. * This makes $conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...)) * When initHooks function is called, with initHooks(list_of_contexts), an array $this->hooks is defined with instance of controler * class found into file /mymodule/class/actions_mymodule.class.php (if module has declared the context as a managed context). * Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed. * * @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ... - * @return int Always 1 + * @return int Always 1 */ function initHooks($arraycontext) { diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 36bbeb966d448685e1e56771c15b736e92afd905..6beeb7ca7b2f3fa044c0fc60169ba14bb3aba0cf 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -136,6 +136,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 // Create the global $hookmanager object include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($db); + $hookmanager->initHooks(array('upgrade')); if (!$db->connected) { @@ -491,9 +492,13 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 } else { - print '<tr><td colspan="4">'; - print '<b>'.$langs->trans('UpgradeExternalModule').'</b>: '.$langs->trans("None"); - print '</td></tr>'; + //if (! empty($conf->modules)) + if (! empty($conf->modules_parts['hooks'])) // If there is at least one module with one hook, we show message to say nothing was done + { + print '<tr><td colspan="4">'; + print '<b>'.$langs->trans('UpgradeExternalModule').'</b>: '.$langs->trans("None"); + print '</td></tr>'; + } } }