/** * Updates the setting in the registry and the database */ function update($name, $value) { $db = DB::get(); if ($this->get($name) == $value) { return true; } $Setting = $this->setting(); $Setting->name = $name; $Setting->value = $db->clean($value); unset($Setting->autoload); $data = $db->prepare($Setting); // Prepare the data for db entry $dataset = DatabaseObject::dataset($data); // Format the data in SQL if ($db->query("UPDATE {$this->_table} SET {$dataset} WHERE name='{$Setting->name}'")) { $this->registry[$name] = $this->restore($value); } else { return false; } return true; }