Jump to content

Hook is not respected in task


Go to solution Solved by Stuart Silvester,

Recommended Posts

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? 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...