UpdateDateTimeInFile.php 530 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace internship\batch;
  3. use n2n\context\Lookupable;
  4. use n2n\batch\attribute\BatchInterval;
  5. class UpdateDateTimeInFile implements Lookupable {
  6. public function _onTrigger() {
  7. // gets called every time the batch job is triggered
  8. }
  9. public function _onNewHour() {
  10. echo 'one hour passed';
  11. }
  12. #[BatchInterval(new \DateInterval('PT15M'))]
  13. public function every15Min(): void {
  14. // gets called every 15 minutes
  15. file_put_contents('currentTimeSetByBatch.txt', date('d-m-Y-H-i-s'));
  16. echo '15 minutes passed';
  17. }
  18. }