[Owncloud] [Proposal] New hooks system
Robin Appelman
icewind at owncloud.com
Tue May 7 23:36:03 UTC 2013
On Tuesday 07 May 2013 21:23:47 Bart Visscher wrote:
> The problem that i see with the proposed system is:
> - We are directly connecting to a class/instance, this means that that
> class needs to be loaded, even when that is not used.
I don't think that will provide a significant overhead, the main classes that
use hooks (user and filesystem) are needed almost every request anyway.
> - It is not possible to send a event from an other location (when
> upgrading, refactoring)
True, but events aren't supposed to be submitted from another location, there
might be a few legitimate reasons to do that but I think that's not an
important use case.
> I think that using an event dispatcher would work better, this is what
> OC_Hooks already is. But make this an object that can be injected in the
> instance we want to use or test.
Scoping of events to instances has more uses than just seperation of test case
hooks, the dispatcher model only works if there is only one instance of the
class that can emit hooks, which is not/will not always be the case.
- Robin Appelman
More information about the Owncloud
mailing list