aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-05-31 22:23:06 +0000
committerplegall <plg@piwigo.org>2011-05-31 22:23:06 +0000
commitd50562fde12cd922b3e76680f14549f3a5b1e272 (patch)
treefde19abb1949ee9cafd84a9827874bb0e8ea3ac8 /include
parent70841e0f5076b04bc596f2a37c3714ed6cb9ac92 (diff)
merge r11160 from branch 2.2 to trunk
bug 2310 fixed: conf_update_param() does not erase config.comment column anymore, we only insert a new row if the param does not exist yet in the table. git-svn-id: http://piwigo.org/svn/trunk@11162 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 015eb8849..7012db248 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -1022,19 +1022,33 @@ SELECT param, value
function conf_update_param($param, $value)
{
$query = '
-DELETE
+SELECT
+ param,
+ value
FROM '.CONFIG_TABLE.'
WHERE param = \''.$param.'\'
;';
- pwg_query($query);
+ $params = array_from_query($query, 'param');
- $query = '
+ if (count($params) == 0)
+ {
+ $query = '
INSERT
INTO '.CONFIG_TABLE.'
(param, value)
VALUES(\''.$param.'\', \''.$value.'\')
;';
- pwg_query($query);
+ pwg_query($query);
+ }
+ else
+ {
+ $query = '
+UPDATE '.CONFIG_TABLE.'
+ SET value = \''.$value.'\'
+ WHERE param = \''.$param.'\'
+;';
+ pwg_query($query);
+ }
}
/**