Sonya* Posted November 10, 2021 Posted November 10, 2021 I have a hook for \IPS\Member\Club::nodes(). This hook works as desired in all parts. Except of clubrebuild task: /** * clubrebuild Task */ class _clubrebuild extends \IPS\Task { /** * Execute * * If ran successfully, should return anything worth logging. Only log something * worth mentioning (don't log "task ran successfully"). Return NULL (actual NULL, not '' or 0) to not log (which will be most cases). * If an error occurs which means the task could not finish running, throw an \IPS\Task\Exception - do not log an error as a normal log. * Tasks should execute within the time of a normal HTTP request. * * @return mixed Message to log or NULL * @throws \IPS\Task\Exception */ public function execute() { ... foreach ( $club->nodes() as $node ) { ... } } $club->nodes in task seems to bypass my hook and thus fails. Question: does it work as desired, or should tasks respect the hooks as well?
teraßyte Posted November 10, 2021 Posted November 10, 2021 I remember they disabled hooks for the upgrader (to avoid trouble) but they should still be working for tasks.
Solution Stuart Silvester Posted November 15, 2021 Solution Posted November 15, 2021 Hooks should work perfectly fine in tasks, if it's not working properly you may need to trace the code back and see what's going on. I cannot reproduce any issues with this (we use this functionality for some of our customisations). Sonya* 1
Recommended Posts