fixes #1419 add photos in a lounge as a temporary space

* at the end of the upload of after a maximum duration, move the photos from the lounge to their actual categories.
* do not invalidate user cache when photos are added in the lounge, thus avoiding to rebuild cache on every photo uploaded
* the lounge system activates itself only beyond 50k (by default) photo
This commit is contained in:
plegall
2021-06-11 16:35:29 +02:00
parent 4aa7a7b9bf
commit ac0d1a5b47
13 changed files with 307 additions and 7 deletions
+27 -5
View File
@@ -362,12 +362,31 @@ SELECT
pwg_activity('photo', $image_id, 'add');
}
if (!isset($conf['lounge_active']))
{
conf_update_param('lounge_active', false, true);
}
if (!$conf['lounge_active'])
{
// check if we need to use the lounge from now
list($nb_photos) = pwg_db_fetch_row(pwg_query('SELECT COUNT(*) FROM '.IMAGES_TABLE.';'));
if ($nb_photos >= $conf['lounge_activate_threshold'])
{
conf_update_param('lounge_active', true, true);
}
}
if (isset($categories) and count($categories) > 0)
{
associate_images_to_categories(
array($image_id),
$categories
);
if ($conf['lounge_active'])
{
fill_lounge(array($image_id), $categories);
}
else
{
associate_images_to_categories(array($image_id), $categories);
}
}
// update metadata from the uploaded file (exif/iptc)
@@ -377,7 +396,10 @@ SELECT
}
sync_metadata(array($image_id));
invalidate_user_cache();
if (!$conf['lounge_active'])
{
invalidate_user_cache();
}
// cache a derivative
$query = '