-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existsresolvedA resolved issueA resolved issue
Description
Hello,
I helped a coworker to install your plugin.
And we have detected an issue for DB connection.
For information after plugin installation all pages showed:
SQLSTATE[HY000] [2002]
In fact in our company we have dedicated DB servers and we use different ports depending on the project.
In your project the lib/database.php file does not take in consideration the $database_port of Cacti configuration.
Below you will find a correction:
<?php
/**
* @return null|PDO
*/
function weathermap_get_pdo()
{
// This is the Cacti standard settings
global $database_type, $database_default, $database_hostname, $database_port, $database_username, $database_password;
global $config;
$cacti_version = $config["cacti_version"];
$host = $database_hostname;
$dbname = $database_default;
$user = $database_username;
$pass = $database_password;
$port = $database_port;
$pdo = null;
try {
# MySQL with PDO_MYSQL
$pdo = new \PDO("mysql:host=$host;port=$port;dbname=$dbname", $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $e->getMessage();
}
return $pdo;
}We have just added:
- Line 9: $database_port
- Line 18: $port = $database_port;
- Line 24 (old 23): ;port=$port
Regards,
Ficoba
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existsresolvedA resolved issueA resolved issue