diff --git a/app/models/managers/LogMaintainer.php b/app/models/managers/LogMaintainer.php new file mode 100644 index 0000000..b852d7c --- /dev/null +++ b/app/models/managers/LogMaintainer.php @@ -0,0 +1,26 @@ + $file) { + if (in_array ($file,array (".", "..", ".gitkeep", $todayFileName))) + { + continue; + } + if (!is_dir($dir . $file)) { + if (strtotime(str_replace(".log", "", $file)) < (strtotime("now") - $seconds)) { + unlink ($dir . $file); + } + } else { + $this->cleaningDir ($dir . $file . "/", $seconds); + } + } + } + + public function purge ($days) { + $seconds = $days * 86400; + $this->cleaningDir ('../logs/', $seconds); + } +}