mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix excessive hooks log
This commit is contained in:
parent
49f093daef
commit
457e6883e2
|
|
@ -58,7 +58,6 @@ if (!isset($usedbyinclude) || empty($usedbyinclude)) {
|
|||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
|
||||
//global $hookmanager;
|
||||
$hookmanager->initHooks(array('searchform'));
|
||||
|
||||
$search_boxvalue = GETPOST('q', 'restricthtml');
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ class HookManager
|
|||
}
|
||||
}
|
||||
}
|
||||
// Log the init of hook but only for hooks thare are declared to be managed
|
||||
if (count($arraytolog) > 0) {
|
||||
dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG);
|
||||
}
|
||||
|
|
@ -275,7 +276,10 @@ class HookManager
|
|||
$actionclassinstance->error = 0;
|
||||
$actionclassinstance->errors = array();
|
||||
|
||||
dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG);
|
||||
if (getDolGlobalInt('MAIN_DEBUG_SHOW_EACH_QUALIFIED_HOOK_CALL') >= 2) {
|
||||
// This his too much verbose, enabled in develop only
|
||||
dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG);
|
||||
}
|
||||
|
||||
// Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
|
||||
// Note: The hook can use the $currentcontext in its code to avoid to be ran twice or be ran for one given context only
|
||||
|
|
|
|||
|
|
@ -2870,14 +2870,9 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
|
|||
|
||||
if (empty($conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
|
||||
// Instantiate hooks for external modules
|
||||
$hookmanager->initHooks(array('searchform', 'leftblock'));
|
||||
$hookmanager->initHooks(array('leftblock'));
|
||||
|
||||
print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
|
||||
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
||||
if (!is_object($form)) {
|
||||
|
|
@ -2885,9 +2880,14 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
|
|||
}
|
||||
$selected = -1;
|
||||
if (empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
|
||||
// Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1;
|
||||
}
|
||||
|
||||
$usedbyinclude = 1;
|
||||
$arrayresult = null;
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This make initHooks('searchform') then set $arrayresult
|
||||
|
||||
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
|
||||
$searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, '', 1, 0, (empty($conf->global->MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY) ? 1 : 0), 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user