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/branches/2.2@11160 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
21b369a8a5
commit
e46f34c6e4
1 changed files with 18 additions and 4 deletions
|
@ -1022,19 +1022,33 @@ SELECT param, value
|
||||||
function conf_update_param($param, $value)
|
function conf_update_param($param, $value)
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
DELETE
|
SELECT
|
||||||
|
param,
|
||||||
|
value
|
||||||
FROM '.CONFIG_TABLE.'
|
FROM '.CONFIG_TABLE.'
|
||||||
WHERE param = \''.$param.'\'
|
WHERE param = \''.$param.'\'
|
||||||
;';
|
;';
|
||||||
pwg_query($query);
|
$params = array_from_query($query, 'param');
|
||||||
|
|
||||||
$query = '
|
if (count($params) == 0)
|
||||||
|
{
|
||||||
|
$query = '
|
||||||
INSERT
|
INSERT
|
||||||
INTO '.CONFIG_TABLE.'
|
INTO '.CONFIG_TABLE.'
|
||||||
(param, value)
|
(param, value)
|
||||||
VALUES(\''.$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue