aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-12-16 13:53:24 +0000
committerplegall <plg@piwigo.org>2011-12-16 13:53:24 +0000
commitd827eacab4a44017349590683ee92026eb06bb60 (patch)
tree63229822348a7b60d30007874cb61d9a0d0f171d /include/functions_user.inc.php
parentc92140a9ff3f9c558255c0f20bd579fbaa4c90f3 (diff)
merge r12747 from branch 2.3 to trunk
bug 2534 fixed: clean (as clean as possible with MySQL+MyISAM) handle of concurrency on user cache refresh. No more error when regenerating several thumbnails at once. git-svn-id: http://piwigo.org/svn/trunk@12748 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 63925cfd8..eedd53af5 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -446,6 +446,9 @@ DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.'
WHERE user_id = '.$userdata['id'];
pwg_query($query);
+ // Due to concurrency issues, we ask MySQL to ignore errors on
+ // insert. This may happen when cache needs refresh and that Piwigo is
+ // called "very simultaneously".
mass_inserts
(
USER_CACHE_CATEGORIES_TABLE,
@@ -454,7 +457,8 @@ DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.'
'user_id', 'cat_id',
'date_last', 'max_date_last', 'nb_images', 'count_images', 'count_categories'
),
- $user_cache_cats
+ $user_cache_cats,
+ array('ignore' => true)
);
@@ -464,8 +468,10 @@ DELETE FROM '.USER_CACHE_TABLE.'
WHERE user_id = '.$userdata['id'];
pwg_query($query);
+ // for the same reason as user_cache_categories, we ignore error on
+ // this insert
$query = '
-INSERT INTO '.USER_CACHE_TABLE.'
+INSERT IGNORE INTO '.USER_CACHE_TABLE.'
(user_id, need_update, cache_update_time, forbidden_categories, nb_total_images,
image_access_type, image_access_list)
VALUES