| @@ -20,19 +20,23 @@ | ||
| 20 | 20 | DBMigrator::run($network_wide); |
| 21 | 21 | DBSeeder::run(); |
| 22 | 22 | |
| 23 | 23 | $this->registerWpCron(); |
| 24 | + | |
| 25 | + update_option('fluent_booking_db_version', FLUENT_BOOKING_DB_VERSION, 'no'); | |
| 24 | 26 | } |
| 25 | 27 | |
| 26 | 28 | public function registerWpCron() |
| 27 | 29 | { |
| 28 | 30 | $fiveMinutesHook = 'fluent_booking_five_minutes_tasks'; |
| 29 | - $hourlyHook = 'fluent_booking_hourly_tasks'; | |
| 30 | 31 | $dailyHook = 'fluent_booking/daily_tasks'; |
| 31 | 32 | |
| 32 | - if(function_exists('as_schedule_recurring_action')) { | |
| 33 | - as_schedule_recurring_action(time(), (60 * 5), $fiveMinutesHook, [], 'fluent-booking', true); | |
| 34 | - as_schedule_recurring_action(time(), (60 * 60), $hourlyHook, [], 'fluent-booking', true); | |
| 35 | - as_schedule_recurring_action(time(), (60 * 60 * 24), $dailyHook, [], 'fluent-booking', true); | |
| 33 | + if(function_exists('\as_schedule_recurring_action')) { | |
| 34 | + if (!\as_next_scheduled_action($fiveMinutesHook)) { | |
| 35 | + \as_schedule_recurring_action(time(), (60 * 5), $fiveMinutesHook, [], 'fluent-booking', true); | |
| 36 | + } | |
| 37 | + if (!\as_next_scheduled_action($dailyHook)) { | |
| 38 | + \as_schedule_recurring_action(time(), (60 * 60 * 24), $dailyHook, [], 'fluent-booking', true); | |
| 39 | + } | |
| 36 | 40 | } |
| 37 | 41 | } |
| 38 | 42 | } |