[Owncloud] [Proposal] New hooks system

Robin Appelman icewind at owncloud.com
Mon May 6 16:26:51 UTC 2013


The current hooks system (provided by OC_Hooks) gives serious issues with 
testablity of the core classes, it's hard to controll the side effects of test 
cases caused by hooks emmited by the tested classes.

To solve this I propose to create an updated hooks system that scopes the 
emited events and listeners to an instance of the class emitting the event.
That way any events emited by an instance of a class created for testing 
purposes won't cause any side effects outside the test case.

A quick writeup of the proposal can be found here 
https://gist.github.com/icewind1991/1e315e6e75c106406405

This is not meant to completely replace the current hook system as it does not 
provide a 1-on-1 mapping of functionality, instead it's mind as a system to be 
used by any future event-emitting class (a proposal for one of those will come 
later :) )

The system provides an easy way to provide backwards compatiblity if a new 
implementation is created for a class that has existing hooks

 - Robin Appelman



More information about the Owncloud mailing list