]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/utils/killcache.inc
73c6c979c8b951f03c08306024b93e89b0081fc0
[roundcube.git] / program / steps / utils / killcache.inc
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  | Licensed under the GNU GPL                                            |
10  |                                                                       |
11  | PURPOSE:                                                              |
12  |   Delete rows from cache and messages tables                          |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Dennis P. Nikolaenko <dennis@nikolaenko.ru>                   |
16  +-----------------------------------------------------------------------+
17
18  $Id: killcache.inc 4410 2011-01-12 18:25:02Z thomasb $
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 $options = array(
29     'use_transactions' => false,
30     'log_line_break' => "\n",
31     'idxname_format' => '%s',
32     'debug' => false,
33     'quote_identifier' => true,
34     'force_defaults' => false,
35     'portability' => true
36 );
37
38 // @TODO: transaction here (if supported by DB) would be a good thing
39 $res = $RCMAIL->db->query("DELETE FROM cache");
40 if (PEAR::isError($res)) {
41     exit($res->getMessage());
42 }
43
44 $res = $RCMAIL->db->query("DELETE FROM messages");
45 if (PEAR::isError($res)) {
46     exit($res->getMessage());
47 }
48
49 echo "Cache cleared\n";
50 exit;
51
52