mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
committed by
Neil Lathwood
parent
86c097574b
commit
a2e33efba8
@@ -21,7 +21,7 @@
|
||||
namespace LibreNMS;
|
||||
|
||||
use LibreNMS\Authentication\Auth;
|
||||
use LibreNMS\Exceptions\DatabaseConnectException;
|
||||
use LibreNMS\DB\Eloquent;
|
||||
|
||||
class IRCBot
|
||||
{
|
||||
@@ -68,11 +68,8 @@ class IRCBot
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $config, $database_link;
|
||||
global $config;
|
||||
$this->log('Setting up IRC-Bot..');
|
||||
if (is_resource($database_link)) {
|
||||
$this->sql = $database_link;
|
||||
}
|
||||
|
||||
$this->config = $config;
|
||||
$this->debug = $this->config['irc_debug'];
|
||||
@@ -507,10 +504,10 @@ class IRCBot
|
||||
|
||||
private function chkdb()
|
||||
{
|
||||
if (!is_resource($this->sql)) {
|
||||
if (!Eloquent::isConnected()) {
|
||||
try {
|
||||
$this->sql = dbConnect();
|
||||
} catch (DatabaseConnectException $e) {
|
||||
Eloquent::boot();
|
||||
} catch (\PDOException $e) {
|
||||
$this->log('Cannot connect to MySQL: ' . $e->getMessage());
|
||||
return die();
|
||||
}
|
||||
|
Reference in New Issue
Block a user