@@ -307,7 +307,7 @@ public static function discovery_multi($cmds)
307
307
308
308
309
309
public static function getNotificationsWithRetentioNTime ($ Iq , $ retentionTime ){
310
- log::add ('mobile ' , 'debug ' , '┌────◀︎ getNotificationsFromFile ────────── ' );
310
+ log::add ('mobile ' , 'debug ' , '┌──────────▶︎ fg-warning: Nettoyage des Notifications et Images :/fg: ────────── ' );
311
311
312
312
log::add ('mobile ' , 'debug ' , '| Durée de retention actuelle : ' . $ retentionTime . ' jours ' );
313
313
$ retentionSeconds = intVal ($ retentionTime ) * 24 * 60 * 60 ;
@@ -316,11 +316,10 @@ public static function getNotificationsWithRetentioNTime($Iq, $retentionTime){
316
316
$ pathImages = dirname (__FILE__ ) . '/../data/images/ ' ;
317
317
if (is_dir ($ pathImages )){
318
318
$ images = glob ($ pathImages . '*.jpg ' );
319
-
320
319
foreach ($ images as $ image ) {
321
320
$ fileCreationTime = filemtime ($ image );
322
321
if ($ fileCreationTime < ($ currentTime - $ retentionSeconds )) {
323
- unlink ($ file );
322
+ unlink ($ image );
324
323
}
325
324
}
326
325
}
@@ -335,34 +334,17 @@ public static function getNotificationsWithRetentioNTime($Iq, $retentionTime){
335
334
336
335
foreach ($ notifications as $ id => $ value ) {
337
336
$ notificationDate = strtotime ($ value ['data ' ]['date ' ]);
338
- if (isset ($ retentionSeconds )){
339
- if (($ currentTime - $ notificationDate ) > $ retentionSeconds ) {
340
- unset($ notifications [$ id ]);
341
- $ notificationsModified = true ;
342
- } else {
343
- $ dateNew = substr ($ value ['data ' ]['date ' ], 0 , 10 );
344
- $ horaire = substr ($ value ['data ' ]['date ' ], -8 );
345
- $ horaireFormat = substr ($ horaire , 0 , 5 );
346
- $ notifications [$ id ]['data ' ]['newDate ' ] = $ dateNew ;
347
- $ notifications [$ id ]['data ' ]['horaireFormat ' ] = $ horaireFormat ;
348
- }
349
- }else {
350
- $ dateNew = substr ($ value ['data ' ]['date ' ], 0 , 10 );
351
- $ horaire = substr ($ value ['data ' ]['date ' ], -8 );
352
- $ horaireFormat = substr ($ horaire , 0 , 5 );
353
- $ notifications [$ id ]['data ' ]['newDate ' ] = $ dateNew ;
354
- $ notifications [$ id ]['data ' ]['horaireFormat ' ] = $ horaireFormat ;
355
- }
337
+ if (($ currentTime - $ notificationDate ) > $ retentionSeconds ) {
338
+ unset($ notifications [$ id ]);
339
+ $ notificationsModified = true ;
340
+ }
356
341
}
357
- if ($ notificationsModified ) {
358
- file_put_contents ($ filePath , $ notifications );
359
- }
360
- $ notifications = json_encode ($ notifications );
361
- log::add ('mobile ' , 'debug ' , '| [INFO] Notifications > ' . $ notifications );
362
- log::add ('mobile ' , 'debug ' , '└─────────────────────────────────────────── ' );
342
+
363
343
}
364
344
365
345
}
346
+ log::add ('mobile ' , 'debug ' , '| Fin du nettoyage des Notifications et Images ' );
347
+ log::add ('mobile ' , 'debug ' , '└─────────────────────────────────────────── ' );
366
348
}
367
349
368
350
public static function change_cmdAndeqLogic ($ _cmds , $ _eqLogics )
0 commit comments