diff options
Diffstat (limited to 'phpBB/includes/config/db.php')
-rw-r--r-- | phpBB/includes/config/db.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/includes/config/db.php b/phpBB/includes/config/db.php index 74fb0504ce..f0c9a5d591 100644 --- a/phpBB/includes/config/db.php +++ b/phpBB/includes/config/db.php @@ -91,6 +91,38 @@ class phpbb_config_db extends phpbb_config } /** + * Removes a configuration option + * + * @param String $key The configuration option's name + * @param bool $cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached + * @return bool True if the configuration entry was deleted successfully, + * otherwise false + */ + public function delete($key, $cache = true) + { + if (!isset($this->config[$key])) + { + return false; + } + + $sql = 'DELETE FROM ' . $this->table . " + WHERE config_name = '" . $this->db->sql_escape($key) . "'"; + $this->db->sql_query($sql); + if (!$this->db->sql_affectedrows()) + { + return false; + } + + unset($this->config[$key]); + + if ($cache) + { + $this->cache->destroy('config'); + } + } + + /** * Sets a configuration option's value * * @param string $key The configuration option's name |