Implements: Kohana_Config_Source | Kohana_Config_Reader
Transparent extension of the Kohana_Config_Database_Reader class
Class declared in MODPATH/database/classes/Config/Database/Reader.php on line 12.
$_db_instancelink to thisNULL
$_table_namelink to thisstring(6) "config"
Constructs the database reader object
array
$config
= NULL - Configuration for the reader
public
function
__construct(
array
$config
= null)
{
if
(isset(
$config
[
'instance'
])) {
$this
->_db_instance =
$config
[
'instance'
];
}
elseif
(
$this
->_db_instance === null) {
$this
->_db_instance = Database::
$default
;
}
if
(isset(
$config
[
'table_name'
])) {
$this
->_table_name =
$config
[
'table_name'
];
}
}
Tries to load the specificed configuration group
Returns false if group does not exist or an array if it does
string
$group
required - Configuration group boolean|array
public
function
load(
$group
)
{
/**
* Prevents the catch-22 scenario where the database config reader attempts to load the
* database connections details from the database.
*
*/
if
(
$group
===
'database'
)
return
false;
$query
= DB::select(
'config_key'
,
'config_value'
)
->from(
$this
->_table_name)
->where(
'group_name'
,
'='
,
$group
)
->execute(
$this
->_db_instance);
return
count
(
$query
) ?
array_map
(
'unserialize'
,
$query
->as_array(
'config_key'
,
'config_value'
)) : false;
}