Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: Scheduled Tasks  (Read 4782 times)

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Scheduled Tasks
« on: October 05, 2016, 07:10:49 AM »
Is there a way to set Cache Clear in Scheduled Tasks?  I'd like to do this a couple times a day.  I've looked over the documentation and am totally lost on how to implement this.

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Scheduled Tasks
« Reply #1 on: October 05, 2016, 10:12:25 AM »
1. You have file public_html/task.php. It can be run by cron with some interval.
2. Every time it looks into database for scheduled tasks (task with status 'ready'), takes all it steps details (from database) and loop one-by-one.
3. Every step have controller for call. It must be task-type (see admin/controller/task folder for examples)

Also you can set low expiration time for cache (see $this->expire = ( $expiration ) ? $expiration : 86400; inside core/cache/driver.php)
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline eCommerce Core

  • Administrator
  • Hero Member
  • *****
  • Posts: 1602
  • Karma: +93/-1
    • View Profile
Re: Scheduled Tasks
« Reply #2 on: October 05, 2016, 11:20:32 AM »
Is there a way to set Cache Clear in Scheduled Tasks?  I'd like to do this a couple times a day.  I've looked over the documentation and am totally lost on how to implement this.

Digitalt, any ideas what we can improve in the manual? I know it is not as good as it can be.

Thank you
“If you’re in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent.”
― Warren Buffett

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Scheduled Tasks
« Reply #3 on: October 05, 2016, 06:17:32 PM »
For a basic manual it's okay, but maybe add tips like above to different sections if appropriate.  Not everyone's a programmer, but a lot of folks can at least find files and make changes to fit their needs if they know where to go.  The cache expiration time is a great example.

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Scheduled Tasks
« Reply #4 on: October 06, 2016, 07:13:07 AM »
1. You have file public_html/task.php. It can be run by cron with some interval.
2. Every time it looks into database for scheduled tasks (task with status 'ready'), takes all it steps details (from database) and loop one-by-one.
3. Every step have controller for call. It must be task-type (see admin/controller/task folder for examples)

Also you can set low expiration time for cache (see $this->expire = ( $expiration ) ? $expiration : 86400; inside core/cache/driver.php)

Theoretically I could add a scheduler for cache clear using the same methods as backup?   I took a quick look and it seems possible.  I need to have the task written to the DB first though. I have a test site I can work with.

It would be nice in a future release to expand on the scheduler/cron capabilities. I have seen this function in numerous types of scripts and it was a great feature.

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4359
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Scheduled Tasks
« Reply #5 on: October 06, 2016, 10:14:39 AM »
1. You have file public_html/task.php. It can be run by cron with some interval.
2. Every time it looks into database for scheduled tasks (task with status 'ready'), takes all it steps details (from database) and loop one-by-one.
3. Every step have controller for call. It must be task-type (see admin/controller/task folder for examples)

Also you can set low expiration time for cache (see $this->expire = ( $expiration ) ? $expiration : 86400; inside core/cache/driver.php)

Theoretically I could add a scheduler for cache clear using the same methods as backup?   I took a quick look and it seems possible.  I need to have the task written to the DB first though. I have a test site I can work with.

It would be nice in a future release to expand on the scheduler/cron capabilities. I have seen this function in numerous types of scripts and it was a great feature.

Let us know how it goes and we can improve scheduler/cron capabilities. Possibly we can create pre-build commandline tasks to backup and clear cache. 
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Scheduled Tasks
« Reply #6 on: October 06, 2016, 12:16:39 PM »
That's what I was thinking. Built in cron capabilities is the easiest for non techie folks and can accomplish a lot.

 

Powered by SMFPacks Social Login Mod