before and after retrieve Logic Hook debugging

Those hooks messages are a bit misleading. They get printed when hooks are just being considered (“can I find a hook for this module?”), but not actually executed.

If you want, make a backup of the file

include/utils/LogicHook.php

and then replace this function (around line 196 in my version of SuiteCRM) with my debugging version:


    public function call_custom_logic($module_dir, $event, $arguments = null)
      {
        $random = rand(1, 1000);
        // declare the hook array variable, it will be defined in the included file.
        $hook_array = null;
        if (isset($GLOBALS['log'])) {
            $GLOBALS['log']->debug("($random) Hooks check for: $module_dir::$event");
        }
        if (!empty($module_dir)) {
            // This will load an array of the hooks to process
            $hooks = $this->getHooks($module_dir);
            if (!empty($hooks)) {
                $GLOBALS['log']->debug("Hook called: $module_dir::$event, hooks not empty");
                $this->process_hooks($hooks, $event, $arguments);
            }
        }
        $hooks = $this->getHooks('');
        if (!empty($hooks)) {
            $GLOBALS['log']->debug("Hook called: $module_dir::$event, hooks not empty 2");
            $this->process_hooks($hooks, $event, $arguments);
        }
        if (isset($GLOBALS['log'])) {
            $GLOBALS['log']->debug("($random) Hooks checked for: $module_dir::$event");
        }
    }

Now you should get a better output where you can see when each hook execution starts and ends.

Meanwhile, please run the first query in this post:

https://pgorod.github.io/Database-tables-size/

… and post the results here. I’d like to check if you have overgrown tables that are causing delays.