From 155bbb8df6332bc6a9b629f62d1725840f8d89ea Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 07 Oct 2008 14:32:56 -0400
Subject: [PATCH] - added bin/killcache.php script (#1485434) - added copyrights disclaimers

---
 CHANGELOG          |    1 
 bin/quotaimg.php   |    6 +-
 bin/killcache.php  |   56 ++++++++++++++++++++++++++++
 bin/dumpschema.php |   21 ++++++++++
 bin/html2text.php  |   19 +++++++++
 bin/modcss.php     |    6 +-
 6 files changed, 102 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index a1e9cb1..25ce5b4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@
 - Write username instead of id in sendmail log (#1485477)
 - Fix htmlspecialchars() use for PHP version < 5.2.3 (#1485475)
 - Fix js keywords escaping in json_serialize() for IE/Opera (#1485472)
+- Added bin/killcache.php script (#1485434)
 
 2008/10/03 (alec)
 ----------
diff --git a/bin/dumpschema.php b/bin/dumpschema.php
index 53c688c..9c9c7b8 100644
--- a/bin/dumpschema.php
+++ b/bin/dumpschema.php
@@ -1,4 +1,23 @@
 <?php
+/*
+
+ +-----------------------------------------------------------------------+
+ | bin/dumpschema.php                                                    |
+ |                                                                       |
+ | This file is part of the RoundCube Webmail client                     |
+ | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 |
+ | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ | PURPOSE:                                                              |
+ |   Dumps database schema in XML format using MDB2_Schema               |
+ |                                                                       |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com>                        |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
 
 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
 require INSTALL_PATH.'program/include/iniset.php';
@@ -44,7 +63,7 @@
 		// 'output_mode' => 'file',
 		'output' => 'print_schema',
 	);
-
+	
 	$definition = $schema->getDefinitionFromDatabase();
 	if (PEAR::isError($definition)) {
 		$error = $definition->getMessage() . ' ' . $definition->getUserInfo();
diff --git a/bin/html2text.php b/bin/html2text.php
index 478ccce..6500d28 100644
--- a/bin/html2text.php
+++ b/bin/html2text.php
@@ -1,4 +1,23 @@
 <?php
+/*
+
+ +-----------------------------------------------------------------------+
+ | bin/html2text.php                                                     |
+ |                                                                       |
+ | This file is part of the RoundCube Webmail client                     |
+ | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 |
+ | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ | PURPOSE:                                                              |
+ |   Convert HTML message to plain text                                  |
+ |                                                                       |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com>                        |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
 
 define('INSTALL_PATH', realpath('./../') . '/');
 require INSTALL_PATH.'program/include/iniset.php';
diff --git a/bin/killcache.php b/bin/killcache.php
new file mode 100644
index 0000000..d933f4f
--- /dev/null
+++ b/bin/killcache.php
@@ -0,0 +1,56 @@
+<?php
+/*
+
+ +-----------------------------------------------------------------------+
+ | bin/killcache.php                                                     |
+ |                                                                       |
+ | This file is part of the RoundCube Webmail client                     |
+ | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 |
+ | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ | PURPOSE:                                                              |
+ |   Delete rows from cache and messages tables                          |
+ |                                                                       |
+ +-----------------------------------------------------------------------+
+ | Author: Dennis P. Nikolaenko <dennis@nikolaenko.ru>                   |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+define('INSTALL_PATH', realpath(dirname(__FILE__).'/..') . '/');
+require INSTALL_PATH.'program/include/iniset.php';
+
+$config = new rcube_config();
+
+// don't allow public access if not in devel_mode
+if (!$config->get('devel_mode') && $_SERVER['REMOTE_ADDR']) {
+	header("HTTP/1.0 401 Access denied");
+	die("Access denied!");
+}
+
+
+$dbh =& MDB2::factory($config->get('db_dsnw'), $options);
+if (PEAR::isError($dbh)) {
+        exit($mdb2->getMessage());
+}
+
+//TODO: transaction here (if supported by DB) would be a good thing
+$res =& $dbh->exec("DELETE FROM cache");
+if (PEAR::isError($res)) {
+  $dbh->disconnect();
+  exit($res->getMessage());
+};
+
+$res =& $dbh->exec("DELETE FROM messages");
+if (PEAR::isError($res)) {
+  $dbh->disconnect();
+  exit($res->getMessage());
+};
+
+echo "Cache cleared\n";
+
+$dbh->disconnect();
+
+?>
diff --git a/bin/modcss.php b/bin/modcss.php
index e97b8ec..fc6305c 100644
--- a/bin/modcss.php
+++ b/bin/modcss.php
@@ -2,10 +2,10 @@
 
 /*
  +-----------------------------------------------------------------------+
- | program/bin/modcss.php                                                |
+ | bin/modcss.php                                                        |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2007, RoundCube Dev. - Switzerland                      |
+ | Copyright (C) 2007-2008, RoundCube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -15,7 +15,7 @@
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
 
- $Id:  $
+ $Id$
 
 */
 
diff --git a/bin/quotaimg.php b/bin/quotaimg.php
index 97c8b86..ddd9b72 100644
--- a/bin/quotaimg.php
+++ b/bin/quotaimg.php
@@ -1,10 +1,10 @@
 <?php
 /*
  +-----------------------------------------------------------------------+
- | program/bin/quotaimg.php                                              |
+ | bin/quotaimg.php                                                      |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
+ | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -14,7 +14,7 @@
  | Author: Brett Patterson <brett2@umbc.edu>                             |
  +-----------------------------------------------------------------------+
 
- $Id: $
+ $Id$
 
 */
 

--
Gitblit v1.9.1