diff options
Diffstat (limited to 'public/admin/purgecache.php')
-rw-r--r-- | public/admin/purgecache.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/public/admin/purgecache.php b/public/admin/purgecache.php new file mode 100644 index 0000000..d47f9a7 --- /dev/null +++ b/public/admin/purgecache.php @@ -0,0 +1,24 @@ +<?php + +require_once __DIR__.'/../../app/app.php'; +require_once __DIR__.'/inc/auth.inc.php'; + +if (isset($_POST['purge'])) { + $dir = __DIR__.'/../../cache/'; + + $dh = opendir($dir); + + while ($filename = readdir($dh)) { + if ($filename == '.' or $filename == '..') { + continue; + } + + $file = $dir . DIRECTORY_SEPARATOR . $filename; + if (is_file($file) && filemtime($file) < time()) { + unlink($file); + } + } +} + +header('Location: administration.php'); +die(); |