Gazelle/sections/tools/misc/clear_cache.php

48 lines
1.5 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-05-02 08:00:23 +00:00
if (!check_perms('users_mod') || !check_perms('admin_clear_cache')) {
2011-03-28 14:21:28 +00:00
error(403);
}
2012-10-11 08:00:15 +00:00
View::show_header('Clear a cache key');
2011-03-28 14:21:28 +00:00
//Make sure the form was sent
2013-05-02 08:00:23 +00:00
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++) {
2011-03-28 14:21:28 +00:00
$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>';
}
}
?>
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>Clear a cache key</h2>
</div>
2012-09-15 08:00:25 +00:00
<form class="manage_form" name="cache" method="get" action="">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="clear_cache" />
2012-09-01 08:00:24 +00:00
<table class="layout" cellpadding="2" cellspacing="1" border="0" align="center">
2011-03-28 14:21:28 +00:00
<tr valign="top">
<td align="right">Key</td>
<td align="left">
2012-02-20 08:00:22 +00:00
<input type="text" name="key" id="key" class="inputtext" value="<?=$_GET['key']?>" />
2011-03-28 14:21:28 +00:00
<select name="type">
<option value="view">View</option>
<option value="clear">Clear</option>
</select>
<input type="submit" value="key" class="submit" />
</td>
</tr>
2013-05-02 08:00:23 +00:00
<? if (!empty($_GET['key']) && $_GET['type'] == 'view') { ?>
2011-03-28 14:21:28 +00:00
<tr>
<td colspan="2">
<pre><? var_dump($Cache->get_value($_GET['key'])); ?></pre>
</td>
</tr>
<? } ?>
</table>
</form>
2013-05-02 08:00:23 +00:00
<? View::show_footer(); ?>