6.0.0-git
2021-01-18

[#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 2008-10-07 (4486 days ago)
Due
Updated 2008-10-09 (4484 days ago)
Assigned 2008-10-07 (4486 days ago)
Resolved 2008-10-09 (4484 days ago)
Milestone 3.3.1
Patch Yes

History
2008-10-09 15:53:17 Chuck Hagenbuch Comment #4
Assigned to Chuck Hagenbuch
Taken from Horde DevelopersHorde Developers
State ⇒ Resolved
Reply to this comment
Committed, thanks.
2008-10-07 13:50:07 Jan Schneider Comment #2
Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
Milestone ⇒ 3.3.1
Reply to this comment
This is a historical leftover. Preference hooks have always been in 
Horde's hooks.php before version 3.3.
2008-10-07 02:58:28 vlukashov (at) parallels (dot) com Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ _callHooks($scope) always looks for hooks in 'horde' scope
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ Yes
New Attachment: callHooks.patch Download
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