Jump to content

Tasks - How to create them in 4.x?


emilhem

Recommended Posts

Posted

We need to create a task like we had in 3.4.x. How do you do it in 4.x?

I made a file in /applications/core/tasks/ but how do I make it run regularly? Or did I place the file in the wrong place?

Posted

Is there a place to get more documentation with regards to "home made" tasks in a separate plugin? I can't seem to find anything that is detailed enough.

I've found the following resource already.

 

Posted
On ‎17‎/‎01‎/‎2016 at 1:18 PM, emilhem said:

We need to create a task like we had in 3.4.x. How do you do it in 4.x?

I made a file in /applications/core/tasks/ but how do I make it run regularly? Or did I place the file in the wrong place?

Are you referring to CRON job ?

If so then you can run a cron with 4.1 tasks which you can set up from System>Settings>Advanced Configuration

Posted
23 hours ago, steve00 said:

Are you referring to CRON job ?

If so then you can run a cron with 4.1 tasks which you can set up from System>Settings>Advanced Configuration

No more like actual documentation with regards to creating the PHP task file and what is supposed to be in it.

I've created a task in a separate plugin but the file that it creates doesn't contain much documentation.

So what I need is like the very detailed API documentation that existed for 3.x.

Posted

It's noted in the task file

Quote

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.

Quote

/**
 * 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
 */

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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