Revize c2e44ab0
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
system/libraries/Database.php | ||
---|---|---|
*/
|
||
public function __construct($config = array())
|
||
{
|
||
// Parse the DSN, creating an array to hold the connection parameters
|
||
$db = array
|
||
(
|
||
'type' => 'mysql',
|
||
'user' => FALSE,
|
||
'pass' => FALSE,
|
||
'host' => FALSE,
|
||
'port' => FALSE,
|
||
'socket' => FALSE,
|
||
'database' => FALSE
|
||
);
|
||
|
||
// Reset the connection array to the database config
|
||
$this->config['connection'] = $db;
|
||
|
||
if (Config::get('db_type') != '')
|
||
$this->config['connection']['type'] = Config::get('db_type');
|
||
|
||
$this->config['connection']['user'] = Config::get('db_user');
|
||
$this->config['connection']['pass'] = Config::get('db_password');
|
||
$this->config['connection']['host'] = Config::get('db_host');
|
||
$this->config['connection']['database'] = Config::get('db_name');
|
||
|
||
$this->config['table_prefix'] = Config::get('db_table_prefix');
|
||
if (!is_array($config) && count($config))
|
||
{
|
||
// Parse the DSN, creating an array to hold the connection parameters
|
||
$db = array
|
||
(
|
||
'type' => 'mysql',
|
||
'user' => FALSE,
|
||
'pass' => FALSE,
|
||
'host' => FALSE,
|
||
'port' => FALSE,
|
||
'socket' => FALSE,
|
||
'database' => FALSE
|
||
);
|
||
|
||
// Reset the connection array to the database config
|
||
$this->config['connection'] = $db;
|
||
|
||
if (Config::get('db_type') != '')
|
||
$this->config['connection']['type'] = Config::get('db_type');
|
||
|
||
$this->config['connection']['user'] = Config::get('db_user');
|
||
$this->config['connection']['pass'] = Config::get('db_password');
|
||
$this->config['connection']['host'] = Config::get('db_host');
|
||
$this->config['connection']['database'] = Config::get('db_name');
|
||
|
||
$this->config['table_prefix'] = Config::get('db_table_prefix');
|
||
}
|
||
else
|
||
{
|
||
$this->config['connection'] = $config;
|
||
}
|
||
|
||
// Set driver name
|
||
$driver = 'Database_'.ucfirst($this->config['connection']['type']).'_Driver';
|
Také k dispozici: Unified diff
Release 1.0.12