Memcache caching, #18
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@120 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
14
model/Db.php
14
model/Db.php
@ -32,18 +32,14 @@ class Db
|
||||
*
|
||||
* @return DbDriver
|
||||
*/
|
||||
static public function connect($name = null, $config = null)
|
||||
static public function connect($name = 'default', $config = null)
|
||||
{
|
||||
if ($name === null) {
|
||||
$name = 'default';
|
||||
}
|
||||
|
||||
if (! isset(self::$connections[$name])) {
|
||||
if (!isset(self::$connections[$name])) {
|
||||
if (!$config) {
|
||||
$config = Config::get('databases')->$name;
|
||||
$config = Config::get(__CLASS__)->$name;
|
||||
}
|
||||
|
||||
if (! is_array($config)) {
|
||||
if (!is_array($config)) {
|
||||
throw new Exception('Connection parameters must be an array');
|
||||
}
|
||||
|
||||
@ -55,7 +51,7 @@ class Db
|
||||
|
||||
$connection = new $driver($config);
|
||||
|
||||
if (! $connection instanceof DbDriver) {
|
||||
if (!$connection instanceof DbDriver) {
|
||||
throw new Exception('Database driver must extends DbDriver');
|
||||
}
|
||||
self::$connections[$name] = $connection;
|
||||
|
Reference in New Issue
Block a user