mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-05-04 12:32:48 +02:00
- add #user_cache.cache_update_time - useful for plugins or the filter when it is not possible/desirable to cache/calculate data specific to the user when pwg core does it; note that this opens the possibility to implement a data cache (file/shared mem/ etc...) for every user (for very large databases)
git-svn-id: http://piwigo.org/svn/trunk@2448 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -299,6 +299,11 @@ SELECT ui.*, uc.*
|
||||
or !is_bool($userdata['need_update'])
|
||||
or $userdata['need_update'] == true)
|
||||
{
|
||||
$userdata['cache_update_time'] = time();
|
||||
|
||||
// Set need update are done
|
||||
$userdata['need_update'] = false;
|
||||
|
||||
$userdata['forbidden_categories'] =
|
||||
calculate_permissions($userdata['id'], $userdata['status']);
|
||||
|
||||
@@ -320,12 +325,6 @@ SELECT DISTINCT(id)
|
||||
|
||||
update_user_cache_categories($userdata);
|
||||
|
||||
// Set need update are done
|
||||
$userdata['need_update'] = false;
|
||||
|
||||
// Indicate update done
|
||||
$userdata['need_update_done'] = true;
|
||||
|
||||
$query = '
|
||||
SELECT COUNT(DISTINCT(image_id)) as total
|
||||
FROM '.IMAGE_CATEGORY_TABLE.'
|
||||
@@ -343,20 +342,16 @@ DELETE FROM '.USER_CACHE_TABLE.'
|
||||
|
||||
$query = '
|
||||
INSERT INTO '.USER_CACHE_TABLE.'
|
||||
(user_id, need_update, forbidden_categories, nb_total_images,
|
||||
(user_id, need_update, cache_update_time, forbidden_categories, nb_total_images,
|
||||
image_access_type, image_access_list)
|
||||
VALUES
|
||||
('.$userdata['id'].',\''.boolean_to_string($userdata['need_update']).'\',\''
|
||||
('.$userdata['id'].',\''.boolean_to_string($userdata['need_update']).'\','
|
||||
.$userdata['cache_update_time'].',\''
|
||||
.$userdata['forbidden_categories'].'\','.$userdata['nb_total_images'].',"'
|
||||
.$userdata['image_access_type'].'","'.$userdata['image_access_list'].'")
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Indicate update not done
|
||||
$userdata['need_update_done'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $userdata;
|
||||
|
||||
Reference in New Issue
Block a user