From d05cff9ccc1ef1ff7f07b06ee3c89c4225eead51 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Thu, 5 Sep 2013 10:41:12 +0000 Subject: add function conf_delete_param git-svn-id: http://piwigo.org/svn/trunk@24350 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions.inc.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'include/functions.inc.php') diff --git a/include/functions.inc.php b/include/functions.inc.php index 9703a51aa..ac20b73bb 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1086,6 +1086,11 @@ SELECT param, value trigger_action('load_conf', $condition); } +/** + * Add or update a config parameter + * @param string $param + * @param string $value + */ function conf_update_param($param, $value) { $query = ' @@ -1118,6 +1123,36 @@ UPDATE '.CONFIG_TABLE.' } } +/** + * Delete on or more config parameters + * @since 2.6 + * @param string|string[] $params + */ +function conf_delete_param($params) +{ + global $conf; + + if (!is_array($params)) + { + $params = array($params); + } + if (empty($params)) + { + return; + } + + $query = ' +DELETE FROM '.CONFIG_TABLE.' + WHERE param IN(\''. implode('\',\'', $params) .'\') +;'; + pwg_query($query); + + foreach ($params as $param) + { + unset($conf[$param]); + } +} + /** * Prepends and appends a string at each value of the given array. * -- cgit v1.2.3