aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-07-22 10:32:25 +0000
committerrvelices <rv-github@modusoptimus.com>2008-07-22 10:32:25 +0000
commit4322abb39fe8672ba0179e9a460a73ae65fdfffc (patch)
treea88acf5edd7291cb926c60ecf796b5e7b3f8e0f4 /include/functions_user.inc.php
parentecc5ee46fa3caf6622a4cccae3870a950fb0a969 (diff)
- 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
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php21
1 files changed, 8 insertions, 13 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index d9e9332ad..f60a7fe77 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -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;