Use PDO for MySQL queries (#8935)

Gut dbFacile
mres() now does nothing... could have some vulnerable queries, but most are ok

TODO
- [x] IRC client broke
- [x] Install broke

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
This commit is contained in:
Tony Murray
2018-08-17 15:29:20 -05:00
committed by Neil Lathwood
parent 86c097574b
commit a2e33efba8
29 changed files with 354 additions and 486 deletions

View File

@@ -24,34 +24,27 @@
* @author Tony Murray <murraytony@gmail.com>
*/
use LibreNMS\Exceptions\DatabaseConnectException;
if (!isset($init_modules)) {
$init_modules = array('nodb');
require __DIR__ . '/includes/init.php';
$opts = getopt('ldh:u:p:n:t:s:');
try {
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
dbConnect();
}
} catch (DatabaseConnectException $e) {
echo $e->getMessage() . PHP_EOL;
exit;
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();
}
$debug = isset($opts['d']);
set_debug(isset($opts['d']));
$skip_schema_lock = isset($opts['l']);
}