CodeIgniter Forums
is it possible to make command to delete debugbar json files? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: is it possible to make command to delete debugbar json files? (/thread-75733.html)



is it possible to make command to delete debugbar json files? - cijagani - 03-10-2020

In Codeigntier 4, Debugbar is automatically creating so many json files when CI_ENVIRONMENT = development.
is there any way to delete it periodically?

can we create one spark command to delete these json files? 

is there any good solution?


RE: is it possible to make command to delete debugbar json files? - John_Betong - 03-10-2020

I am not familiar with Spark so use this index.php script: 

Code:
# CLEANER -  only shows last error logs and debugbar JSON files
  define('LOGFILE',  '../writable/logs/log-' .date('Y-m-d') .'.php');
  $ok = @unlink(LOGFILE);
  $ok = @array_map('unlink', glob("../writable/debugbar/*.json"));



RE: is it possible to make command to delete debugbar json files? - cijagani - 03-10-2020

(03-10-2020, 09:08 PM)John_Betong Wrote: I am not familiar with Spark so use this index.php script: 

Code:
# CLEANER -  only shows last error logs and debugbar JSON files
  define('LOGFILE',  '../writable/logs/log-' .date('Y-m-d') .'.php');
  $ok = @unlink(LOGFILE);
  $ok = @array_map('unlink', glob("../writable/debugbar/*.json"));

i got it. thank you.


RE: is it possible to make command to delete debugbar json files? - InsiteFX - 03-11-2020

In CI 4 the log files extension is .log not .php 

This is what worked for me:

PHP Code:
<?php
    
# CLEANER -  only shows last error logs and debugbar JSON files
    
$ok = @array_map('unlink'glob("../writable/logs/*.log"));
    
$ok = @array_map('unlink'glob("../writable/debugbar/*.json"));