| 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 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 |
|---|
| 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 cache_messages"); |
|---|
| 45 | if (PEAR::isError($res)) { |
|---|
| 46 | exit($res->getMessage()); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | $res = $RCMAIL->db->query("DELETE FROM cache_index"); |
|---|
| 50 | if (PEAR::isError($res)) { |
|---|
| 51 | exit($res->getMessage()); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | $res = $RCMAIL->db->query("DELETE FROM cache_thread"); |
|---|
| 55 | if (PEAR::isError($res)) { |
|---|
| 56 | exit($res->getMessage()); |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | echo "Cache cleared\n"; |
|---|
| 60 | exit; |
|---|