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).
This commit is contained in:
plegall
2024-04-11 12:18:21 +02:00
parent 49dadcecb3
commit 0a6f235db8

View File

@@ -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 = '