예제 #1
0
 /**
  * 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);
 }
예제 #2
0
파일: file.php 프로젝트: azuya/Wi3
 /**
  * Load and merge all of the configuration files in this group.
  *
  *     $config->load($name);
  *
  * @param   string  configuration group name
  * @param   array   configuration array
  * @return  $this   clone of the current object
  * @uses    Kohana::load
  */
 public function load($group, array $config = NULL)
 {
     if ($files = Kohana::find_file($this->_directory, $group, NULL, TRUE)) {
         // Initialize the config array
         $config = array();
         foreach ($files as $file) {
             // Merge each file to the configuration array
             $config = Arr::merge($config, Kohana::load($file));
         }
     }
     return parent::load($group, $config);
 }