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

        if (filemtime($dir . DIRECTORY_SEPARATOR . $filename) < time()) {
            @unlink($dir . DIRECTORY_SEPARATOR . $filename);
        }
    }
}

header('Location: administration.php');
die();