6.0.0-beta1
7/4/25

[#7445] _callHooks($scope) always looks for hooks in 'horde' scope
Summary _callHooks($scope) always looks for hooks in 'horde' scope
Queue Horde Framework Packages
Queue Version FRAMEWORK_3
Type Bug
State Resolved
Priority 2. Medium
Owners chuck (at) horde (dot) org
Requester vlukashov (at) parallels (dot) com
Created 10/07/2008 (6114 days ago)
Due
Updated 10/09/2008 (6112 days ago)
Assigned 10/07/2008 (6114 days ago)
Resolved 10/09/2008 (6112 days ago)
Github Issue Link
Github Pull Request
Milestone 3.3.1
Patch Yes

History
10/09/2008 03:53:17 PM Chuck Hagenbuch Comment #4
Assigned to Chuck Hagenbuch
Taken from Horde DevelopersHorde Developers
State ⇒ Resolved
Reply to this comment
Committed, thanks.
10/07/2008 01:50:07 PM Jan Schneider Comment #2
Assigned to Horde DevelopersHorde Developers
Milestone ⇒ 3.3.1
State ⇒ Assigned
Reply to this comment
This is a historical leftover. Preference hooks have always been in 
Horde's hooks.php before version 3.3.
10/07/2008 02:58:28 AM vlukashov (at) parallels (dot) com Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
New Attachment: callHooks.patch Download
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ _callHooks($scope) always looks for hooks in 'horde' scope
Type ⇒ Bug
Reply to this comment
I have a preference and a hook in the 'imp' scope but the hook is not 
called. A log entry in Horde::callHook() [lib/Horde.php] showed that 
the hook just is not found. Futher investigation brought me to the 
_callHooks($scope) method in the Prefs class [lib/Horde/Prefs.php]. It 
looks strange that the method always calls hooks in the 'horde' scope, 
not in the scope specified by the $scope parameter.

I've created a simple patch [see attachment] and all seems to work 
fine after it.



the definition of preference [imp/config/prefs.php]:

$_prefs['my_pref'] = array(

     'type' => 'checkbox',

     'value' => true,

     'locked' => false,

     'shared' => false,

     'type' => 'checkbox',

     'hook' => true,

     'desc' => _("Sample"));



the definition of hook [imp/config/hooks.php]:

if (!function_exists('_prefs_hook_my_pref')) {

     function _prefs_hook_my_pref() {

         Horde::logMessage('HOOK FOR MY_PREF', __FILE__, __LINE__, 
PEAR_LOG_DEBUG);

         return 0;

     }

}


Saved Queries