← All changes
|
app/Hooks/Scheduler/AutoSchedules/HourlyScheduler.php
+9
-0
1.3.21
→
1.7.1
View file →
| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | use FluentCart\App\Helpers\Status; |
| 6 | 6 | use FluentCart\App\Models\ScheduledAction; |
| 7 | 7 | use FluentCart\App\Models\Subscription; |
| 8 | +use FluentCart\App\Services\Email\StoreDigestService; | |
| 8 | 9 | |
| 9 | 10 | class HourlyScheduler |
| 10 | 11 | { |
| 11 | 12 | private $startTimeStamp = null; |
| @@ -12,8 +13,13 @@ | ||
| 12 | 13 | |
| 13 | 14 | public function register(): void |
| 14 | 15 | { |
| 15 | 16 | add_action('fluent_cart/scheduler/hourly_tasks', [$this, 'handle'], 10); |
| 17 | + | |
| 18 | + // On-demand digest trigger (WP-CLI / debugging): do_action('fluent_cart/store_digest/send', 'daily') | |
| 19 | + add_action('fluent_cart/store_digest/send', function ($frequency) { | |
| 20 | + StoreDigestService::sendDigest((string) $frequency); | |
| 21 | + }, 10, 1); | |
| 16 | 22 | } |
| 17 | 23 | |
| 18 | 24 | public function handle() |
| 19 | 25 | { |
| @@ -22,8 +28,11 @@ | ||
| 22 | 28 | // hourly tasks, remove all completed tasks |
| 23 | 29 | $this->removeCompleteTasks(); |
| 24 | 30 | |
| 25 | 31 | $this->checkAndExpireSubscriptions(); |
| 32 | + | |
| 33 | + // Store digest (daily/weekly/monthly): evaluated each hour against the configured send time. | |
| 34 | + StoreDigestService::runDueDigests(); | |
| 26 | 35 | } |
| 27 | 36 | |
| 28 | 37 | |
| 29 | 38 | private function removeCompleteTasks() |