Add support for renaming config settings
This commit is contained in:
@@ -29,6 +29,15 @@ interface SihnonFramework_Config_IUpdateable {
|
||||
*/
|
||||
public function remove($key);
|
||||
|
||||
/**
|
||||
*
|
||||
* Rename a setting
|
||||
* @param string $key
|
||||
* @param string $new_key
|
||||
* @return bool
|
||||
*/
|
||||
public function rename($key, $new_key);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -49,6 +49,13 @@ class SihnonFramework_Config_Plugin_Database extends Sihnon_PluginBase implement
|
||||
));
|
||||
}
|
||||
|
||||
public function rename($key, $new_key) {
|
||||
return $this->database->update("UPDATE `{$this->table}` SET `name`=:new_name WHERE `name`=:name LIMIT 1", array(
|
||||
array('name' => 'new_name', 'value' => $new_key, 'type' => PDO::PARAM_STR),
|
||||
array('name' => 'name', 'value' => $key, 'type' => PDO::PARAM_STR),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user