alecpl
2012-04-20 a2f896bdeb2bebd09e85742c2918c79020830212
bin/cleandb.sh
@@ -5,9 +5,12 @@
 +-----------------------------------------------------------------------+
 | bin/cleandb.sh                                                        |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2010, RoundCube Dev. - Switzerland                      |
 | Licensed under the GNU GPL                                            |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2010, The Roundcube Dev Team                            |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
 | See the README file for a full license statement.                     |
 |                                                                       |
 | PURPOSE:                                                              |
 |   Finally remove all db records marked as deleted some time ago       |
@@ -20,12 +23,9 @@
*/
if (php_sapi_name() != 'cli') {
    die('Not on the "shell" (php-cli).');
}
define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
require INSTALL_PATH.'program/include/iniset.php';
require INSTALL_PATH.'program/include/clisetup.php';
// mapping for table name => primary key
$primary_keys = array(
@@ -36,9 +36,10 @@
// connect to DB
$RCMAIL = rcmail::get_instance();
$db = $RCMAIL->get_dbh();
$db->db_connect('w');
if (!$db->is_connected() || $db->is_error)
    die("No DB connection");
if (!$db->is_connected() || $db->is_error())
    die("No DB connection\n");
if (!empty($_SERVER['argv'][1]))
    $days = intval($_SERVER['argv'][1]);