Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted January 17, 20169 yr 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?
January 24, 20169 yr Author 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.
January 25, 20169 yr 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
January 26, 20169 yr Author 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.
January 26, 20169 yr What information do you need? It's much easier then in IPB3. All you need to do is to add your code inside the execute method.
January 27, 20169 yr Author How do you log things? Do you just echo and IPS takes that data as a log or what?
January 27, 20169 yr 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.