2016-09-14 10:53:04 -05:00
|
|
|
#!/usr/bin/env php
|
2013-10-28 18:40:48 -07:00
|
|
|
<?php
|
2017-07-01 15:28:29 -05:00
|
|
|
/**
|
|
|
|
* build-base.php
|
|
|
|
*
|
|
|
|
* Create database structure.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* @package LibreNMS
|
|
|
|
* @link http://librenms.org
|
|
|
|
* @copyright 2017 Tony Murray
|
|
|
|
* @author Tony Murray <murraytony@gmail.com>
|
|
|
|
*/
|
2013-10-28 18:40:48 -07:00
|
|
|
|
2017-04-06 16:02:37 -05:00
|
|
|
if (!isset($init_modules)) {
|
2018-04-11 10:15:13 -05:00
|
|
|
$init_modules = array('nodb');
|
|
|
|
require __DIR__ . '/includes/init.php';
|
2017-07-01 15:28:29 -05:00
|
|
|
|
2018-04-11 10:15:13 -05:00
|
|
|
$opts = getopt('ldh:u:p:n:t:s:');
|
2017-07-01 15:28:29 -05:00
|
|
|
|
2018-08-17 15:29:20 -05:00
|
|
|
if (isset($opts['h'])) {
|
|
|
|
dbConnect(
|
|
|
|
isset($opts['h']) ? $opts['h'] : null,
|
|
|
|
isset($opts['u']) ? $opts['u'] : '',
|
|
|
|
isset($opts['p']) ? $opts['p'] : '',
|
|
|
|
isset($opts['n']) ? $opts['n'] : '',
|
|
|
|
isset($opts['t']) ? $opts['t'] : null,
|
|
|
|
isset($opts['s']) ? $opts['s'] : null
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
// use configured database credentials
|
|
|
|
\LibreNMS\DB\Eloquent::boot();
|
2017-07-01 15:28:29 -05:00
|
|
|
}
|
|
|
|
|
2018-08-17 15:29:20 -05:00
|
|
|
set_debug(isset($opts['d']));
|
2017-07-18 14:07:21 -05:00
|
|
|
$skip_schema_lock = isset($opts['l']);
|
2013-10-28 18:40:48 -07:00
|
|
|
}
|
|
|
|
|
2018-04-11 10:15:13 -05:00
|
|
|
require __DIR__ . '/includes/sql-schema/update.php';
|
2017-07-01 15:28:29 -05:00
|
|
|
|
|
|
|
exit($return);
|