Skip to content

Commit 2ba11cb

Browse files
authored
Make updates more robust
During update I ran into an issue ``` <b>Warning</b>: [mysql error 1062] Duplicate entry 'MugShot' for key 'PRIMARY' INSERT INTO piwigo_config (param,value,comment) VALUES ("MugShot","","MugShot configuration values"); in <b>/var/www/virtual/x/html/include/dblayer/functions_mysqli.inc.php</b> on line <b>847</b><br /> ``` I was able to solve it with this patch. As the following query also works if the table already exists, this seems to be more robust.
1 parent d2c8674 commit 2ba11cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/helpers.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function create_tag_drop_trigger() {
7979
* Creates the MugShot face tag table with all data columns required for resizing.
8080
*/
8181
function create_facetag_table() {
82-
$configQuery = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("MugShot","","MugShot configuration values");';
82+
$configQuery = 'REPLACE INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("MugShot","","MugShot configuration values");';
8383

8484
pwg_query($configQuery);
8585

@@ -119,4 +119,4 @@ function fetch_sql($sql, $col, $ser) {
119119
return ($ser) ? json_encode($data) : $data;
120120
}
121121

122-
?>
122+
?>

0 commit comments

Comments
 (0)