Jump to content

Featured Replies

Posted

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? 

Solved by Stuart Silvester

Go to solution

I remember they disabled hooks for the upgrader (to avoid trouble) but they should still be working for tasks.

  • Solution

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).

Recently Browsing 0

  • No registered users viewing this page.