alecpl
2011-06-27 68070e448c6c8cd09faa75fd70ff11bfea764cc1
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                       |
155bbb 9  | Licensed under the GNU GPL                                            |
A 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$
19
20 */
21
22 // don't allow public access if not in devel_mode
677e1f 23 if (!$RCMAIL->config->get('devel_mode')) {
b113c5 24     header("HTTP/1.0 401 Access denied");
T 25     die("Access denied!");
155bbb 26 }
A 27
b113c5 28 $options = array(
T 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 );
155bbb 37
677e1f 38 // @TODO: transaction here (if supported by DB) would be a good thing
A 39 $res = $RCMAIL->db->query("DELETE FROM cache");
155bbb 40 if (PEAR::isError($res)) {
b113c5 41     exit($res->getMessage());
T 42 }
155bbb 43
677e1f 44 $res = $RCMAIL->db->query("DELETE FROM messages");
155bbb 45 if (PEAR::isError($res)) {
b113c5 46     exit($res->getMessage());
T 47 }
155bbb 48
A 49 echo "Cache cleared\n";
677e1f 50 exit;
155bbb 51
b25dfd 52