The Health Check wizard must be run when upgrading in order to evaluate whether your instance is suitable for upgrade. During the health check, various types of issues may be detected which can affect your ability to upgrade. This article will cover the “Bad hook file” error reported by the health check.
This error generates an output similar to the following in health check:
In this example, the logic hook identified in the health check error is referenced in the
./custom/modules/Leads/logic_hooks.php file. The line of code referencing this hook is as follows:
$hook_array['after_save'] = Array(1, 'EXAMPLE_HOOK', 'modules/EH_exampleHook/exampleHook.php','exampleHook', 'exampleHook');
Since the hook references a file that does not exist at the defined path, it is non-functional. To address this issue, Sugar will perform one of the following actions during the upgrade:
- If the bad hook is the only hook defined in the file, the file is deleted.
- If the bad hook is defined in the file with other valid hooks, the line(s) of code referencing the bad hook are deleted.