comparison program/steps/utils/killcache.inc @ 0:4681f974d28b

vanilla 1.3.3 distro, I hope
author Charlie Root
date Thu, 04 Jan 2018 15:52:31 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4681f974d28b
1 <?php
2
3 /**
4 +-----------------------------------------------------------------------+
5 | program/steps/utils/killcache.inc |
6 | |
7 | This file is part of the Roundcube Webmail client |
8 | Copyright (C) 2005-2010, The Roundcube Dev Team |
9 | |
10 | Licensed under the GNU General Public License version 3 or |
11 | any later version with exceptions for skins & plugins. |
12 | See the README file for a full license statement. |
13 | |
14 | PURPOSE: |
15 | Delete rows from cache tables |
16 | |
17 +-----------------------------------------------------------------------+
18 | Author: Dennis P. Nikolaenko <dennis@nikolaenko.ru> |
19 +-----------------------------------------------------------------------+
20 */
21
22 // don't allow public access if not in devel_mode
23 if (!$RCMAIL->config->get('devel_mode')) {
24 header("HTTP/1.0 401 Access denied");
25 die("Access denied!");
26 }
27
28 // @TODO: transaction here (if supported by DB) would be a good thing
29 $res = $RCMAIL->db->query("DELETE FROM " . $RCMAIL->db->table_name('cache', true));
30 if ($err = $RCMAIL->db->is_error($res)) {
31 exit($err);
32 }
33
34 $res = $RCMAIL->db->query("DELETE FROM " . $RCMAIL->db->table_name('cache_shared', true));
35 if ($err = $RCMAIL->db->is_error($res)) {
36 exit($err);
37 }
38
39 $res = $RCMAIL->db->query("DELETE FROM " . $RCMAIL->db->table_name('cache_messages', true));
40 if ($err = $RCMAIL->db->is_error($res)) {
41 exit($err);
42 }
43
44 $res = $RCMAIL->db->query("DELETE FROM " . $RCMAIL->db->table_name('cache_index', true));
45 if ($err = $RCMAIL->db->is_error($res)) {
46 exit($err);
47 }
48
49 $res = $RCMAIL->db->query("DELETE FROM " . $RCMAIL->db->table_name('cache_thread', true));
50 if ($err = $RCMAIL->db->is_error($res)) {
51 exit($err);
52 }
53
54 echo "Cache cleared\n";
55 exit;