summaryrefslogtreecommitdiffstats
path: root/public/admin/purgecache.php
blob: d47f9a71cb94f6545d3cc4378cbb5f3631e25410 (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();