SugarCRM unable to include hooks
Question
I tried to create a logic hook for the Cases module in SugarCRM. I put my logic_hooks.php file into the custom/modules/Cases directory but it's never included.
I put some debug in the include/utils/LogicHook.php file and the problem is in the call_custom_logic function:
...
// declare the hook array variable, it will be defined in the included file.
$hook_array = null;
if(!empty($module_dir)){
// This will load an array of the hooks to process
if(file_exists("custom/modules/$module_dir/logic_hooks.php")){
$GLOBALS['log']->debug('Including module specific hook file for '.$module_dir); include("custom/modules/$module_dir/logic_hooks.php");
...
The empty folder test succeeds but the file_exists always returns false (and if I comment this line, the include function throws an error too).
I wonder how this could work as if I read good the file_exists function takes only absolute path but it seems to work for every other SugarCRM user so I guess I have a problem in my configuration somewhere.
Any help is apreciated cause I really don't know where is the problem!
Solution
No, file_exists() can take both absolute and relative path. Verify that you have the file named exactly logic_hooks.php
and it is readable to the user that is running your webserver.
OTHER TIPS
If your sugar is working, he sets path automaticly, that's why you can call files like that.
Anyway as above stated check if file is named good and permissions are right