BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

clear_cache.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. #declare(strict_types=1);
  3. if (!check_perms('users_mod') || !check_perms('admin_clear_cache')) {
  4. error(403);
  5. }
  6. View::show_header('Clear a cache key');
  7. // Make sure the form was sent
  8. if (!empty($_GET['key'])) {
  9. $Keys = array_map('trim', preg_split('/\s+/', $_GET['key']));
  10. }
  11. if (isset($Keys) && $_GET['type'] === 'clear') {
  12. foreach ($Keys as $Key) {
  13. if (preg_match('/(.*?)(\d+)\.\.(\d+)$/', $Key, $Matches) && is_number($Matches[2]) && is_number($Matches[3])) {
  14. for ($i = $Matches[2]; $i <= $Matches[3]; $i++) {
  15. $Cache->delete_value($Matches[1].$i);
  16. }
  17. } else {
  18. $Cache->delete_value($Key);
  19. }
  20. }
  21. echo '<div class="save_message">Key(s) ' . implode(', ', array_map('display_str', $Keys)) . ' cleared!</div>';
  22. }
  23. $MultiKeyTooltip = 'Enter cache keys delimited by any amount of whitespace.';
  24. ?>
  25. <div class="header">
  26. <h2>Clear a cache key</h2>
  27. </div>
  28. <table class="layout" cellpadding="2" cellspacing="1" border="0" align="center">
  29. <tr class="tooltip" title="<?=$MultiKeyTooltip?>">
  30. <td>Keys</td>
  31. <td>
  32. <form class="manage_form" name="cache" method="get" action="">
  33. <input type="hidden" name="action" value="clear_cache" />
  34. <select name="type">
  35. <option value="view">View</option>
  36. <option value="clear">Clear</option>
  37. </select>
  38. <textarea type="text" name="key" id="key"
  39. class="inputtext"><?=((isset($_GET['key']) && (isset($_GET['submit']))) ? display_str($_GET['key']) : '')?></textarea>
  40. <input type="submit" name="submit" class="submit" />
  41. </form>
  42. </td>
  43. </tr>
  44. </table>
  45. <?php
  46. if (isset($Keys) && $_GET['type'] === 'view') {
  47. ?>
  48. <table class="layout" cellpadding="2" cellspacing="1" border="0" align="center" style="margin-top: 1em;">
  49. <?php
  50. foreach ($Keys as $Key) {
  51. ?>
  52. <tr>
  53. <td>
  54. <?=display_str($Key)?>
  55. </td>
  56. <td>
  57. <pre>
  58. <?php var_dump($Cache->get_value($Key)); ?>
  59. </pre>
  60. </td>
  61. </tr>
  62. <?php
  63. } ?>
  64. </table>
  65. <?php
  66. }
  67. View::show_footer();