Skip to content

Commit

Permalink
refactor: Default to only using mysqli (#4915)
Browse files Browse the repository at this point in the history
* refactor: Default to only using mysqli

* Remove includes/dbFacile.mysql.php

* updated mres() function to remove $config global
  • Loading branch information
laf authored and murrant committed Nov 11, 2016
1 parent 55f0d44 commit cc01969
Show file tree
Hide file tree
Showing 9 changed files with 577 additions and 1,185 deletions.
1 change: 0 additions & 1 deletion config.php.default
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ $config['db_host'] = 'localhost';
$config['db_user'] = 'USERNAME';
$config['db_pass'] = 'PASSWORD';
$config['db_name'] = 'librenms';
$config['db']['extension'] = 'mysqli';// mysql or mysqli

// This is the user LibreNMS will run as
//Please ensure this user is created and has the correct permissions to your install
Expand Down
6 changes: 0 additions & 6 deletions doc/Support/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ $config['db_pass'] = '';
$config['db_name'] = '';
```

You can also select between the mysql and mysqli php extensions:

```php
$config['db']['extension'] = 'mysqli';
```

#### Programs

A lot of these are self explanatory so no further information may be provided. Any extensions that have dedicated
Expand Down
11 changes: 5 additions & 6 deletions html/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

require '../includes/defaults.inc.php';
$config['db']['extension']='mysqli';

// Work out the install directory
$cur_dir = explode('/', __DIR__);
$check = end($cur_dir);
Expand Down Expand Up @@ -304,11 +304,10 @@
<h5 class="text-center">Importing MySQL DB - Do not close this page or interrupt the import</h5>
<?php
// Ok now let's set the db connection up
$config['db_host']=$dbhost;
$config['db_user']=$dbuser;
$config['db_pass']=$dbpass;
$config['db_name']=$dbname;
$config['db']['extension']='mysqli';
$config['db_host'] = $dbhost;
$config['db_user'] = $dbuser;
$config['db_pass'] = $dbpass;
$config['db_name'] = $dbname;
$sql_file = '../build.sql';
$_SESSION['last'] = time();
ob_end_flush();
Expand Down
8 changes: 2 additions & 6 deletions includes/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,8 @@ function truncate($substring, $max = 50, $rep = '...')
function mres($string)
{
// short function wrapper because the real one is stupidly long and ugly. aesthetics.
global $config, $database_link;
if ($config['db']['extension'] == 'mysqli') {
return mysqli_real_escape_string($database_link, $string);
} else {
return mysql_real_escape_string($string);
}
global $database_link;
return mysqli_real_escape_string($database_link, $string);
}

function getifhost($id)
Expand Down
Loading

0 comments on commit cc01969

Please sign in to comment.