[dev] Re: [cvs] commit: horde/config conf.xml hooks.php.dist framework/Share Share.php

Chuck Hagenbuch chuck at horde.org
Mon Oct 4 19:42:56 PDT 2004


Quoting Stuart KBingë <omicron-list at mighty.co.za>:

> One problem with callHook() though - it returns a PEAR_Error if hooks.php or
> the hook function doesn't exist.

Part of this seems to be because of the signup functions - they check a config
option, then try the hook. Would anyone have objections to having those 
just go
off of the hook, too? That'd resolve that.

> I'd like to use PEAR_Error (as opposed to a boolean or something) as a return
> value from the share hooks, so that if an operation fails a message to the
> user can be displayed through the notification system. Regardless of the type
> of the return value, I also want to have the corresponding share operation
> exit early if the hook returns an error (e.g. if _horde_hook_share_add()
> returns an error then the share won't be added to the share list).
>
> What about adding another callHook()-like function to Horde::, say
> callOptionalHook() or callHookIfAvailable(), that doesn't log nor return an
> error if hooks.php or the hook function don't exist?

With proper checking in a few places where we call the hooks now, I don't see
any reason that this shouldn't be the default behavior.

In fact, what about passing the arguments to callHook as an array by 
reference,
so that the hook modifies the passed-in values if it succeeds, and nothing
happens to the original value if it doesn't exist?

-chuck

-- 
"But she goes not abroad in search of monsters to destroy." - John 
Quincy Adams


More information about the dev mailing list