Sentora Support Forums
How can I Overwrite Default Hook? - Printable Version

+- Sentora Support Forums (https://senforums.mach-hosting.com)
+-- Forum: General Forums - (Non-Sentora Support) (https://senforums.mach-hosting.com/forumdisplay.php?fid=1)
+--- Forum: Sentora Development (https://senforums.mach-hosting.com/forumdisplay.php?fid=54)
+--- Thread: How can I Overwrite Default Hook? (/showthread.php?tid=1558)



How can I Overwrite Default Hook? - apinto - 05-09-2015

Greetings,
Developing a Sentora Module is there any way to overwrite a default hook?
For example I would like to change the way the OnEndDaemonRun hook works, is this possible via a module?


RE: How can I Overwrite Default Hook? - Me.B - 05-09-2015

Nope currently. I don't see any way.

Unless you change the main module it self.


RE: How can I Overwrite Default Hook? - apinto - 05-09-2015

Thank you.
I think thats might be the only option Smile


RE: How can I Overwrite Default Hook? - Me.B - 05-09-2015

The issue will be when the panel get an update your modifications will be overwritten.

We had a discussion about this and we still don't have a clean solutions for mods to the core files.

M B


RE: How can I Overwrite Default Hook? - apinto - 05-09-2015

Why not use something like the WordPRess filters?
http://dev.themeblvd.com/tutorial/filters/

I do honestly believe this is a clean solution.


RE: How can I Overwrite Default Hook? - Me.B - 05-09-2015

Hmm but hooks are different way from this functions you call in themes...

Don't forget you may need to add a mod in any line.... and even if you call an external override for the function. the original function may change in upgrades...


RE: How can I Overwrite Default Hook? - apinto - 05-09-2015

I understand that and I agree that it would be ideal to add a mod on any line, however that is simply not needed and having something working in a simple way is better than not having it at all.

Although I understand themes are different, the concept the same (also filters are not necessarily used in themes but also in plugins.

Regarding future updates breaking the code... Well that's a issue I can live with and I'm sure everyone who codes addons/plugins/modules will agree with me that it is simply not possible to have the code 100% upgrade safe when you are changing how core things wok.

The main use case for this would be to allow for very specific use cases where the user might need to tweak things for his/her particular use case.

Also, as long as the Sentora changelog provides information about what filters/hooks were changed it shall be rather simple to keep things flowing.

Just my opinion and its all theory I admit that in practice it might not be this easy, but we need to start from some place.


RE: How can I Overwrite Default Hook? - Me.B - 05-10-2015

May be later once apache_admin module get the revamp it deserves.