mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Fix coding style part 2
This commit is contained in:
+24
-27
@@ -2,43 +2,40 @@
|
||||
|
||||
// MYSQL Check - FIXME
|
||||
// 1 UNKNOWN
|
||||
|
||||
include( "config.php" );
|
||||
require '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);
|
||||
$sql_file = 'build.sql';
|
||||
}
|
||||
|
||||
$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);
|
||||
$sql_fh = fopen($sql_file, 'r');
|
||||
if ($sql_fh === false) {
|
||||
echo 'ERROR: Cannot open SQL build script '.$sql_file."\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$select = mysql_select_db( $config['db_name'] );
|
||||
if ($select === FALSE) {
|
||||
echo( "ERROR: Cannot select database: " . mysql_error() . "\n" );
|
||||
exit(1);
|
||||
$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);
|
||||
}
|
||||
|
||||
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" );
|
||||
$select = mysql_select_db($config['db_name']);
|
||||
if ($select === false) {
|
||||
echo 'ERROR: Cannot select database: '.mysql_error()."\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose($sql_fh);
|
||||
|
||||
include("includes/sql-schema/update.php");
|
||||
|
||||
?>
|
||||
require 'includes/sql-schema/update.php';
|
||||
|
||||
Reference in New Issue
Block a user