| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Hooks\Handlers; |
| 4 |
|
| 5 |
use FluentCart\Api\StoreSettings; |
| 6 |
use FluentCart\Database\DBMigrator; |
| 7 |
|
| 8 |
class ActivationHandler |
| 9 |
{ |
| 10 |
public StoreSettings $storeSettings; |
| 11 |
|
| 12 |
public function handle($network_wide = false) |
| 13 |
{ |
| 14 |
DBMigrator::migrateUp($network_wide); |
| 15 |
$this->storeSettings = new StoreSettings(); |
| 16 |
$this->dispatch(); |
| 17 |
|
| 18 |
$this->registerWpCron(); |
| 19 |
} |
| 20 |
|
| 21 |
public function dispatch() |
| 22 |
{ |
| 23 |
|
| 24 |
} |
| 25 |
|
| 26 |
public function registerWpCron() |
| 27 |
{ |
| 28 |
$fiveMinutesHook = 'fluent_cart/scheduler/five_minutes_tasks'; |
| 29 |
$hourlyHook = 'fluent_cart/scheduler/hourly_tasks'; |
| 30 |
$dailyHook = 'fluent_cart/scheduler/daily_tasks'; |
| 31 |
|
| 32 |
if (function_exists('as_schedule_recurring_action')) { |
| 33 |
as_schedule_recurring_action(time(), (60 * 5), $fiveMinutesHook, [], 'fluent-cart', true); |
| 34 |
as_schedule_recurring_action(time(), (60 * 60), $hourlyHook, [], 'fluent-cart', true); |
| 35 |
as_schedule_recurring_action(time(), (60 * 60 * 24), $dailyHook, [], 'fluent-cart', true); |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
|