From 0a6f235db835ad3eda8d355b2b2db65b758c7377 Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 11 Apr 2024 12:18:21 +0200 Subject: [PATCH] fixes #2110 avoid insert errors in the lounge table If you upload several times the same photo, Piwigo detects the photo already exists and re-use its existing id. If the lounge is active, Piwigo tries to insert the same image_id/category_id. Let's simply acknowledge it may happen and tell MySQL to act accordingly (ignore). --- admin/include/functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin/include/functions.php b/admin/include/functions.php index b2e51c5a3..1e19e09b3 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1914,7 +1914,8 @@ function fill_lounge($images, $categories) mass_inserts( LOUNGE_TABLE, array_keys($inserts[0]), - $inserts + $inserts, + array('ignore'=>true) ); } } @@ -1941,7 +1942,7 @@ function empty_lounge($invalidate_user_cache=true) } $exec_id = generate_key(4); - $logger->debug(__FUNCTION__.', exec='.$exec_id.', begins'); + $logger->debug(__FUNCTION__.(isset($_REQUEST['method']) ? ' (API:'.$_REQUEST['method'].')' : '').', exec='.$exec_id.', begins'); // if lounge is already being emptied, skip $query = '