PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.14.1
Yatra – Travel Booking & Tour Operator Software v3.0.14.1
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / app / Hooks / CronHooks.php

CronHooks.php in Yatra – Travel Booking & Tour Operator Software 3.0.14.1, at app/Hooks/CronHooks.php

52 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Yatra\Hooks;
6
7 use Yatra\Services\TripLifecycleCronService;
8 use Yatra\Services\DepartureCronService;
9 use Yatra\Services\BookingCronService;
10
11 /**
12 * CronHooks
13 * Registers and runs scheduled tasks (trip lifecycle, etc.).
14 */
15 class CronHooks
16 {
17 /**
18 * Initialize cron-related hooks.
19 */
20 public static function init(): void
21 {
22 // Ensure lifecycle cron is scheduled (in case activation missed)
23 add_action('init', [TripLifecycleCronService::class, 'registerCronHook']);
24
25 // Daily handler
26 add_action(TripLifecycleCronService::CRON_HOOK, function () {
27 (new TripLifecycleCronService())->runDaily();
28 });
29
30 // Departure status cron: marks departures 'past' once their date passes.
31 // This was written but never wired here, so departures kept their old
32 // status forever — vanishing from the upcoming list (excluded by date)
33 // while never appearing under Past (which looked for status = 'past').
34 // The Past query is now date-based too (see DepartureRepository), so
35 // display no longer depends on this cron; keeping the badge/status column
36 // current is what this maintains.
37 add_action('init', [DepartureCronService::class, 'registerCronHook']);
38 add_action('yatra_daily_departure_status_update', function () {
39 (new DepartureCronService())->dailyStatusUpdate();
40 });
41
42 // Booking completion cron: marks confirmed bookings 'completed' once
43 // their tour date has passed, which is what fires the booking.completed
44 // email / Email Automation sequence. BookingCronService::register() (its
45 // reminder/expiry events) is not wired anywhere, so nothing here activates
46 // those — only the completion sweep, which self-guards against emailing
47 // historical bookings via an activation floor.
48 add_action('init', [BookingCronService::class, 'registerCompletionCron']);
49 add_action('yatra_booking_completion', [BookingCronService::class, 'completeFinishedBookings']);
50 }
51 }
52