thomascube
2012-03-14 a621a9d7ecf334c4894ef8f5168eb6208e5ae0e4
commit | author | age
155bbb 1 <?php
A 2 /*
3
4  +-----------------------------------------------------------------------+
677e1f 5  | program/steps/utils/killcache.inc                                     |
155bbb 6  |                                                                       |
e019f2 7  | This file is part of the Roundcube Webmail client                     |
f5e7b3 8  | Copyright (C) 2005-2010, The Roundcube Dev Team                       |
7fe381 9  |                                                                       |
T 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.                     |
155bbb 13  |                                                                       |
A 14  | PURPOSE:                                                              |
680786 15  |   Delete rows from cache tables                                       |
155bbb 16  |                                                                       |
A 17  +-----------------------------------------------------------------------+
18  | Author: Dennis P. Nikolaenko <dennis@nikolaenko.ru>                   |
19  +-----------------------------------------------------------------------+
20
21  $Id$
22
23 */
24
25 // don't allow public access if not in devel_mode
677e1f 26 if (!$RCMAIL->config->get('devel_mode')) {
b113c5 27     header("HTTP/1.0 401 Access denied");
T 28     die("Access denied!");
155bbb 29 }
A 30
b113c5 31 $options = array(
T 32     'use_transactions' => false,
33     'log_line_break' => "\n",
34     'idxname_format' => '%s',
35     'debug' => false,
36     'quote_identifier' => true,
37     'force_defaults' => false,
38     'portability' => true
39 );
155bbb 40
677e1f 41 // @TODO: transaction here (if supported by DB) would be a good thing
A 42 $res = $RCMAIL->db->query("DELETE FROM cache");
155bbb 43 if (PEAR::isError($res)) {
b113c5 44     exit($res->getMessage());
T 45 }
155bbb 46
680786 47 $res = $RCMAIL->db->query("DELETE FROM cache_messages");
A 48 if (PEAR::isError($res)) {
49     exit($res->getMessage());
50 }
51
52 $res = $RCMAIL->db->query("DELETE FROM cache_index");
53 if (PEAR::isError($res)) {
54     exit($res->getMessage());
55 }
56
57 $res = $RCMAIL->db->query("DELETE FROM cache_thread");
155bbb 58 if (PEAR::isError($res)) {
b113c5 59     exit($res->getMessage());
T 60 }
155bbb 61
A 62 echo "Cache cleared\n";
677e1f 63 exit;