aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-09-05 10:41:12 +0000
committermistic100 <mistic@piwigo.org>2013-09-05 10:41:12 +0000
commitd05cff9ccc1ef1ff7f07b06ee3c89c4225eead51 (patch)
tree6ce6cf14c8026e90a992ea8ed1a0473b0186e0bf
parent12707a70f2777a9fe570f1b766de89b60ccec070 (diff)
add function conf_delete_param
git-svn-id: http://piwigo.org/svn/trunk@24350 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php35
1 files changed, 35 insertions, 0 deletions
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 = '
@@ -1119,6 +1124,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.
*
* @param array