Results 1 to 8 of 8

Thread: Hook doesn't run after migration!

  1. #1
    deXX is offline Member
    Join Date
    Aug 2009
    Posts
    10

    Default Hook doesn't run after migration!

    Hi, I have added logic hooks to the Calls module - on my windows machine they run just fine, but after migrating to a Linux box, the hooks are not fired at all!

    Under windows XP (using xampp with php 5.3.0)
    Under Linux - Debian With linux kernel 2.6.26-2 , PHP/5.2.9-4 with Suhosin-Patch

    The logic hook file in custom\modules\Calls\logic_hooks.php:
    Code:
    <?php
    $hook_version = 1;
    $hook_array = Array();
    
    $hook_array['before_save '] = Array();
    $hook_array['before_save'][] = Array(1, 'custom', 'custom/modules/Calls/calls_hooks.php ','calls_hook', 'before_save');
    
    // position, file, function
    $hook_array['after_save '] = Array();
    $hook_array['after_save'][] = Array(1, 'custom', 'custom/modules/Calls/calls_hooks.php ','calls_hook', 'after_save');
    ?>
    Here is my actual hook code from custom\modules\Calls\calls_hooks.php:
    Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    require_once('custom/include/ps40/SugarPS4.php');
    
    class calls_hook {
    	
    function before_save(&$focus, $event){
    	echo('before save hook<br />');
    	exit;
    }
    
    function after_save(&$focus, $event){
           echo('after save hook<br />');
    	exit;
    }
    }
    ?>

    How can i check where sugar checks for hooks and runs them?
    Any ideas what this can be?
    Last edited by deXX; 2009-09-23 at 09:21 AM. Reason: hook path was misstyped

  2. #2
    letrium is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    614

  3. #3
    deXX is offline Member
    Join Date
    Aug 2009
    Posts
    10

    Default Re: Hook doesn't run after migration!

    Quote Originally Posted by letrium View Post
    Hi,

    I think it is impossible. I should work.
    Try to do chmod -R 777 custom\modules
    This still didn't solve the issue. The calls are saved even without going into the hook on the linux machine.Tried chmod, didn't solve it.

    I made thought first that it's because linux is case sensitive to filenames so i changed all involved files to lowercase, but still nothing.

    I agree with you, it shoud work!!!
    Any other ideas? I'm out of any right now...
    Thanks.

  4. #4
    letrium is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    614

    Default Re: Hook doesn't run after migration!

    Hey,
    You wrote that you hook body is in custom\modules\calls_hooks.php:
    Here is my actual hook code from custom\modules\calls_hooks.php:
    But it should be in the custom\modules\Calls\calls_hooks.php:

  5. #5
    deXX is offline Member
    Join Date
    Aug 2009
    Posts
    10

    Default Re: Hook doesn't run after migration!

    Quote Originally Posted by letrium View Post
    Hey,
    You wrote that you hook body is in custom\modules\calls_hooks.php:
    But it should be in the custom\modules\Calls\calls_hooks.php:
    I'm sorry, my mistake, it is there, i mistyped it in my post, sorry!

    So, it's in custom\modules\Calls\calls_hooks.php

  6. #6
    deXX is offline Member
    Join Date
    Aug 2009
    Posts
    10

    Default Re: Hook doesn't run after migration!

    What i found in sugarcrm.log :

    ....
    [DEBUG] Including module specific hook file for Calls
    [ERROR] Unable to load custom logic file: custom/modules/Calls/calls_hooks.php
    ....


    WTF?!
    Path is correct, permissions are set to 777 what else am i missing?
    Last edited by deXX; 2009-09-23 at 09:38 AM. Reason: log update

  7. #7
    letrium is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    614

    Default Re: Hook doesn't run after migration!

    Something wrong with path (file: /include/utils/LogicHook.php)
    PHP Code:
    if(!file_exists($hook_details[2])){
                        
    $GLOBALS['log']->error('Unable to load custom logic file: '.$hook_details[2]);
                        continue;
                    } 

  8. #8
    deXX is offline Member
    Join Date
    Aug 2009
    Posts
    10

    Default Re: Hook doesn't run after migration!

    Thanks Letrium, i spotted out the issue!
    Code:
    $hook_array['before_save '] = Array();
    $hook_array['before_save'][] = Array(1, 'custom', 'custom/modules/Calls/calls_hooks.php ','calls_hook', 'before_save');
    it's because a space after the name of the file, ohh GOD! In windows it worked, can you imagine?!
    Much thanks for the help!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. migration
    By marrandy in forum General Discussion
    Replies: 1
    Last Post: 2008-05-21, 02:49 PM
  2. Migration from 4.2.1a to 4.5.0f
    By cartagon in forum Installation and Upgrade Help
    Replies: 2
    Last Post: 2006-11-17, 07:46 AM
  3. Migration de 3.5.0 à 4.2.0
    By jgarnier in forum Français
    Replies: 4
    Last Post: 2006-07-28, 10:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •