mostly filebased Content Presentation System

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Controller;
  3. class Admin {
  4. function __construct() {
  5. }
  6. function menu() {
  7. return '<a class="action" href="#">clear cache</a>';
  8. }
  9. function index() {
  10. // return $this->menu();
  11. return $this->clear_cache();
  12. }
  13. function clear_cache() {
  14. $CI = new \Modules\CachedImage("rsc/img/default.png");
  15. $cache_dir = $CI->cache_dir;
  16. $ls = scandir($cache_dir);
  17. $count = 0;
  18. foreach($ls as $file) {
  19. if(!strncmp(".",$file,1)) continue;
  20. unlink($cache_dir."".$file);
  21. $count++;
  22. }
  23. return "erased $count files<br>";
  24. }
  25. }