|
|
@@ -0,0 +1,24 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace internship\batch;
|
|
|
+
|
|
|
+use n2n\context\Lookupable;
|
|
|
+use n2n\batch\attribute\BatchInterval;
|
|
|
+
|
|
|
+class UpdateDateTimeInFile implements Lookupable {
|
|
|
+
|
|
|
+ public function _onTrigger() {
|
|
|
+ // gets called every time the batch job is triggered
|
|
|
+ }
|
|
|
+
|
|
|
+ public function _onNewHour() {
|
|
|
+ echo 'one hour passed';
|
|
|
+ }
|
|
|
+
|
|
|
+ #[BatchInterval(new \DateInterval('PT15M'))]
|
|
|
+ public function every15Min(): void {
|
|
|
+ // gets called every 15 minutes
|
|
|
+ file_put_contents('currentTimeSetByBatch.txt', date('d-m-Y-H-i-s'));
|
|
|
+ echo '15 minutes passed';
|
|
|
+ }
|
|
|
+}
|