File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Test Cron Job
4+ *
5+ * Simple test job that logs a message and succeeds.
6+ * Used by bin/test-cron.php for basic functionality testing.
7+ */
8+
9+ class TestCronJob extends \Kyte \Core \CronJobBase
10+ {
11+ public function execute ()
12+ {
13+ $ this ->log ("Test job started " );
14+ $ this ->log ("Current time: " . date ('Y-m-d H:i:s ' ));
15+
16+ // Get execution info
17+ $ execution = $ this ->getExecution ();
18+ $ this ->log ("Execution ID: " . $ execution ['id ' ]);
19+ $ this ->log ("Scheduled time: " . date ('Y-m-d H:i:s ' , $ execution ['scheduled_time ' ]));
20+
21+ // Simulate some work
22+ sleep (2 );
23+
24+ // Send a heartbeat to extend our lease
25+ $ this ->heartbeat ();
26+
27+ // More work
28+ sleep (2 );
29+
30+ $ this ->log ("Test job completed successfully " );
31+
32+ return "Test job finished at " . date ('Y-m-d H:i:s ' );
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments