4 +-----------------------------------------------------------------------+
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Delete rows from cache and messages tables |
14 +-----------------------------------------------------------------------+
15 | Author: Dennis P. Nikolaenko <dennis@nikolaenko.ru> |
16 +-----------------------------------------------------------------------+
18 $Id: killcache.php 2238 2009-01-17 03:27:41Z till $
22 define('INSTALL_PATH', realpath(dirname(__FILE__).'/..') . '/');
23 require INSTALL_PATH . 'program/include/iniset.php';
25 $config = new rcube_config();
27 // don't allow public access if not in devel_mode
28 if (!$config->get('devel_mode') && $_SERVER['REMOTE_ADDR']) {
29 header("HTTP/1.0 401 Access denied");
30 die("Access denied!");
34 'use_transactions' => false,
35 'log_line_break' => "\n",
36 'idxname_format' => '%s',
38 'quote_identifier' => true,
39 'force_defaults' => false,
43 $dbh = MDB2::factory($config->get('db_dsnw'), $options);
44 if (PEAR::isError($dbh)) {
45 exit($mdb2->getMessage());
48 //TODO: transaction here (if supported by DB) would be a good thing
49 $res =& $dbh->exec("DELETE FROM cache");
50 if (PEAR::isError($res)) {
52 exit($res->getMessage());
55 $res =& $dbh->exec("DELETE FROM messages");
56 if (PEAR::isError($res)) {
58 exit($res->getMessage());
61 echo "Cache cleared\n";