Files
librenms-librenms/build-base.php
T

41 lines
817 B
PHP
Raw Normal View History

2013-10-28 18:40:48 -07:00
<?php
2014-01-13 17:43:58 +00:00
// MYSQL Check - FIXME
// 1 UNKNOWN
2013-10-28 18:40:48 -07:00
include( "config.php" );
if (!isset($sql_file)) {
$sql_file = 'build.sql';
}
$sql_fh = fopen( $sql_file, 'r' );
if ($sql_fh === FALSE) {
echo( "ERROR: Cannot open SQL build script " . $sql_file . "\n" );
exit(1);
}
2013-10-28 18:40:48 -07:00
$connection = mysql_connect( $config['db_host'], $config['db_user'], $config['db_pass'] );
if ($connection === FALSE) {
echo( "ERROR: Cannot connect to database: " . mysql_error() . "\n" );
exit(1);
}
2013-10-28 18:40:48 -07:00
mysql_select_db( $config['db_name'] );
while( !feof( $sql_fh ) ) {
$line = fgetss( $sql_fh );
if(!empty($line))
{
$creation = mysql_query( $line );
if( !$creation ) {
echo( "WARNING: Cannot execute query (" . $line . "): " . mysql_error() . "\n" );
}
2013-10-28 18:40:48 -07:00
}
}
fclose($sql_fh);
include("includes/sql-schema/update.php");
2013-10-28 18:40:48 -07:00
?>