if (!check_perms('users_mod') || !check_perms('admin_clear_cache')) {
error(403);
}
View::show_header('Clear a cache key');
//Make sure the form was sent
if (!empty($_GET['key'])) {
if ($_GET['submit'] == 'Multi') {
$Keys = array_map('trim', preg_split('/\s+/', $_GET['key']));
} else {
$Keys = [trim($_GET['key'])];
}
}
if (isset($Keys) && $_GET['type'] == 'clear') {
foreach ($Keys as $Key) {
if (preg_match('/(.*?)(\d+)\.\.(\d+)$/', $Key, $Matches) && is_number($Matches[2]) && is_number($Matches[3])) {
for ($i = $Matches[2]; $i <= $Matches[3]; $i++) {
$Cache->delete_value($Matches[1].$i);
}
} else {
$Cache->delete_value($Key);
}
}
echo '
Key(s) ' . implode(', ', array_map('display_str', $Keys)) . ' cleared!
';
}
$MultiKeyTooltip = 'Enter cache keys delimited by any amount of whitespace.';
?>
if (isset($Keys) && $_GET['type'] == 'view') {
?>
foreach ($Keys as $Key) {
?>
=display_str($Key)?> |
var_dump($Cache->get_value($Key)); ?>
|
} ?>
}
View::show_footer();