mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 13:24:41 +03:00
parent
524302fb2e
commit
8a79393989
@ -5,6 +5,7 @@
|
||||
# MySQL Database parameters
|
||||
database:
|
||||
host: ""
|
||||
port: 3306
|
||||
db: ""
|
||||
login: ""
|
||||
pass: ""
|
||||
|
@ -47,6 +47,12 @@ class Database
|
||||
*/
|
||||
protected $dbHost = '';
|
||||
|
||||
/**
|
||||
* Database port
|
||||
* @var int
|
||||
*/
|
||||
protected $dbPort = 0;
|
||||
|
||||
/**
|
||||
* Database user's login
|
||||
* @var string
|
||||
@ -132,6 +138,7 @@ class Database
|
||||
* Create PDO object and store it in the Database object.
|
||||
*
|
||||
* @param string $host Database host.
|
||||
* @param int $port Database port.
|
||||
* @param string $user Database user name.
|
||||
* @param string $pass Database for user with $name password.
|
||||
* @param boolean $use_pconn Control use persistent connection to the
|
||||
@ -139,7 +146,7 @@ class Database
|
||||
* @param string $db Database name.
|
||||
* @param string $prefix Database tables prefix
|
||||
*/
|
||||
public static function initialize($host, $user, $pass, $use_pconn, $db, $prefix)
|
||||
public static function initialize($host, $port, $user, $pass, $use_pconn, $db, $prefix)
|
||||
{
|
||||
// Check PDO
|
||||
if (!extension_loaded('PDO')) {
|
||||
@ -160,6 +167,7 @@ class Database
|
||||
|
||||
// Set database and connection properties
|
||||
$instance->dbHost = $host;
|
||||
$instance->dbPort = $port;
|
||||
$instance->dbLogin = $user;
|
||||
$instance->dbPass = $pass;
|
||||
$instance->dbName = $db;
|
||||
@ -168,7 +176,7 @@ class Database
|
||||
|
||||
// Create PDO object
|
||||
$instance->dbh = new \PDO(
|
||||
"mysql:host={$instance->dbHost};dbname={$instance->dbName}",
|
||||
"mysql:host={$instance->dbHost};port={$instance->dbPort};dbname={$instance->dbName}",
|
||||
$instance->dbLogin,
|
||||
$instance->dbPass,
|
||||
array(\PDO::ATTR_PERSISTENT => $instance->usePersistentConnection)
|
||||
|
@ -706,6 +706,7 @@ class Installer
|
||||
try {
|
||||
Database::initialize(
|
||||
$this->configs['database']['host'],
|
||||
$this->configs['database']['port'],
|
||||
$this->configs['database']['login'],
|
||||
$this->configs['database']['pass'],
|
||||
$this->configs['database']['use_persistent_connection'],
|
||||
|
@ -76,6 +76,7 @@ if (!installation_in_progress()) {
|
||||
// Initialize the database
|
||||
\Mibew\Database::initialize(
|
||||
$configs['database']['host'],
|
||||
$configs['database']['port'],
|
||||
$configs['database']['login'],
|
||||
$configs['database']['pass'],
|
||||
$configs['database']['use_persistent_connection'],
|
||||
|
Loading…
Reference in New Issue
Block a user