summaryrefslogtreecommitdiffstats
path: root/admin/purgecache.php
blob: b0207588cb042818f51cf89c4067058e8ee435b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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();