Aleksander Machniak
2016-05-22 77b5d7ee304a688a2eb115ce04b460b43c0dd700
commit | author | age
b7e7c8 1 #!/usr/bin/env php
AM 2 <?php
3 /*
4  +-----------------------------------------------------------------------+
5  | bin/updatedb.sh                                                       |
6  |                                                                       |
7  | This file is part of the Roundcube Webmail client                     |
8  | Copyright (C) 2010-2012, The Roundcube Dev Team                       |
9  | Copyright (C) 2010-2012, Kolab Systems AG                             |
10  |                                                                       |
11  | Licensed under the GNU General Public License version 3 or            |
12  | any later version with exceptions for skins & plugins.                |
13  | See the README file for a full license statement.                     |
14  |                                                                       |
15  | PURPOSE:                                                              |
16  |   Update database schema                                              |
17  +-----------------------------------------------------------------------+
18  | Author: Aleksander Machniak <alec@alec.pl>                            |
19  +-----------------------------------------------------------------------+
20 */
21
0ea079 22 define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
b7e7c8 23
AM 24 require_once INSTALL_PATH . 'program/include/clisetup.php';
25
26 // get arguments
27 $opts = rcube_utils::get_opt(array(
28     'v' => 'version',
29     'd' => 'dir',
9e329c 30     'p' => 'package',
b7e7c8 31 ));
AM 32
33 if (empty($opts['dir'])) {
f23ef1 34     rcube::raise_error("Database schema directory not specified (--dir).", false, true);
b7e7c8 35 }
9e329c 36 if (empty($opts['package'])) {
f23ef1 37     rcube::raise_error("Database schema package name not specified (--package).", false, true);
b7e7c8 38 }
AM 39
e76208 40 rcmail_utils::db_update($opts['dir'], $opts['package'], $opts['version'], array('errors' => true));
15e4c8 41
b7e7c8 42 ?>