芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/www/resupres/modules/database/classes/kohana/config/database.php
_database_instance = $config['instance']; } if (isset($config['table'])) { $this->_database_table = $config['table']; } parent::__construct(); } /** * Query the configuration table for all values for this group and * unserialize each of the values. * * @param string group name * @param array configuration array * @return $this clone of the current object */ public function load($group, array $config = NULL) { if ($config === NULL AND $group !== 'database') { // Load all of the configuration values for this group $query = DB::select('config_key', 'config_value') ->from($this->_database_table) ->where('group_name', '=', $group) ->execute($this->_database_instance); if (count($query) > 0) { // Unserialize the configuration values $config = array_map('unserialize', $query->as_array('config_key', 'config_value')); } } return parent::load($group, $config); } /** * Overload setting offsets to insert or update the database values as * changes occur. * * @param string array key * @param mixed new value * @return mixed */ public function offsetSet($key, $value) { if ( ! $this->offsetExists($key)) { // Insert a new value DB::insert($this->_database_table, array('group_name', 'config_key', 'config_value')) ->values(array($this->_configuration_group, $key, serialize($value))) ->execute($this->_database_instance); } elseif ($this->offsetGet($key) !== $value) { // Update the value DB::update($this->_database_table) ->value('config_value', serialize($value)) ->where('group_name', '=', $this->_configuration_group) ->where('config_key', '=', $key) ->execute($this->_database_instance); } return parent::offsetSet($key, $value); } } // End Kohana_Config_Database