示例#1
0
 /**
  * Sets the config for given key/vale.
  *
  * @param string         $key
  * @param string|integer $value
  * @param integer        $autoload
  */
 public function set($key, $value, $autoload = 0)
 {
     $oldValue = $this->db->select('value')->from('config')->where(array('key' => $key))->execute()->fetchCell();
     if ($oldValue !== null) {
         if ($value !== $oldValue) {
             $this->db->update('config')->values(array('value' => $value, 'autoload' => $autoload))->where(array('key' => $key))->execute();
         }
     } else {
         $this->db->insert('config')->values(array('key' => $key, 'value' => $value, 'autoload' => $autoload))->execute();
     }
     $this->configData[$key]['value'] = $value;
     $this->configData[$key]['autoload'] = $autoload;
 }