Gazelle/sections/tools/misc/clear_cache.php
2013-05-02 08:00:23 +00:00

48 lines
1.5 KiB
PHP

<?
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']) && $_GET['type'] == 'clear') {
if (preg_match('/(.*?)(\d+)\.\.(\d+)$/', $_GET['key'], $Matches) && is_number($Matches[2]) && is_number($Matches[3])) {
for ($i = $Matches[2]; $i <= $Matches[3]; $i++) {
$Cache->delete_value($Matches[1].$i);
}
echo '<div class="save_message">Keys '.display_str($_GET['key']).' cleared!</div>';
} else {
$Cache->delete_value($_GET['key']);
echo '<div class="save_message">Key '.display_str($_GET['key']).' cleared!</div>';
}
}
?>
<div class="header">
<h2>Clear a cache key</h2>
</div>
<form class="manage_form" name="cache" method="get" action="">
<input type="hidden" name="action" value="clear_cache" />
<table class="layout" cellpadding="2" cellspacing="1" border="0" align="center">
<tr valign="top">
<td align="right">Key</td>
<td align="left">
<input type="text" name="key" id="key" class="inputtext" value="<?=$_GET['key']?>" />
<select name="type">
<option value="view">View</option>
<option value="clear">Clear</option>
</select>
<input type="submit" value="key" class="submit" />
</td>
</tr>
<? if (!empty($_GET['key']) && $_GET['type'] == 'view') { ?>
<tr>
<td colspan="2">
<pre><? var_dump($Cache->get_value($_GET['key'])); ?></pre>
</td>
</tr>
<? } ?>
</table>
</form>
<? View::show_footer(); ?>