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-11-06 08:00:50 +00:00
|
|
|
if (!empty($_GET['key'])) {
|
|
|
|
if ($_GET['submit'] == 'Multi') {
|
|
|
|
$Keys = array_map('trim', preg_split('/\s+/', $_GET['key']));
|
2011-03-28 14:21:28 +00:00
|
|
|
} else {
|
2013-11-06 08:00:50 +00:00
|
|
|
$Keys = [trim($_GET['key'])];
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
}
|
2013-11-06 08:00:50 +00:00
|
|
|
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 '<div class="save_message">Key(s) ' . implode(', ', array_map('display_str', $Keys)) . ' cleared!</div>';
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
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">
|
2013-11-06 08:00:50 +00:00
|
|
|
<tr>
|
|
|
|
<td>Key</td>
|
|
|
|
<td>
|
2011-03-28 14:21:28 +00:00
|
|
|
<select name="type">
|
|
|
|
<option value="view">View</option>
|
|
|
|
<option value="clear">Clear</option>
|
|
|
|
</select>
|
2013-11-06 08:00:50 +00:00
|
|
|
<input type="text" name="key" id="key" class="inputtext" value="<?=(isset($_GET['key']) && $_GET['submit'] != 'Multi' ? display_str($_GET['key']) : '')?>" />
|
|
|
|
<input type="submit" name="submit" value="Single" class="submit" />
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2013-11-06 08:00:50 +00:00
|
|
|
<td>Multi-key</td>
|
|
|
|
<td>
|
|
|
|
<select name="type">
|
|
|
|
<option value="view">View</option>
|
|
|
|
<option value="clear">Clear</option>
|
|
|
|
</select>
|
|
|
|
<textarea type="text" name="key" id="key" class="inputtext"><?=(isset($_GET['key']) && $_GET['submit'] == 'Multi' ? display_str($_GET['key']) : '')?></textarea>
|
|
|
|
<input type="submit" name="submit" value="Multi" class="submit" />
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2013-11-06 08:00:50 +00:00
|
|
|
<?
|
|
|
|
if (isset($Keys) && $_GET['type'] == 'view') {
|
|
|
|
foreach ($Keys as $Key) {
|
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td><?=display_str($Key)?></td>
|
|
|
|
<td>
|
|
|
|
<pre><? var_dump($Cache->get_value($Key)); ?></pre>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</table>
|
|
|
|
</form>
|
2013-11-06 08:00:50 +00:00
|
|
|
<?
|
|
|
|
View::show_footer();
|