-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclear_cache.php
More file actions
34 lines (33 loc) · 898 Bytes
/
clear_cache.php
File metadata and controls
34 lines (33 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require('includes/config.php');
?><!doctype html>
<html lang="<?php echo HTML_LANG; ?>" dir="<?php echo HTML_DIR; ?>">
<head>
<meta charset="utf-8">
<title>Clear Cache</title>
</head>
<body>
<?php
if (CLEAR_THUMB_SECRET == '' || (isset($_GET['s']) && CLEAR_THUMB_SECRET == $_GET['s'])) {
function recursiveDelete($str) {
if (is_file($str) && basename($str) != 'index.html') {
echo '<li>File: '.$str.'</li>';
return @unlink($str);
} else if (is_dir($str)) {
$scan = glob(rtrim($str,'/').'/*');
foreach($scan as $index=>$path) {
recursiveDelete($path);
}
return @rmdir($str);
}
}
$files = glob(THUMB_DIR.'*');
echo '<p>Deleting:</p><ol>';
foreach($files as $file) {
recursiveDelete($file);
}
echo '</ol></p>...Done</p>';
}
?>
</body>
</html>