aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2008-11-19 20:03:49 +0000
committerrub <rub@piwigo.org>2008-11-19 20:03:49 +0000
commite41325376b79f10e6dbcb20a6f87de9d4c7c852d (patch)
tree3be77c0f844caf143e18feac3b6cdec1daf3f0e4 /admin/include
parent3c2c976441dce2dff24f17348add1b52a5d7b4e3 (diff)
Delete caches and optimize tables on upgrade
git-svn-id: http://piwigo.org/svn/trunk@2890 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index d7369ddf0..764f7b97c 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1762,12 +1762,24 @@ function pwg_URL()
/**
* Invalidates cahed data (permissions and category counts) for all users.
*/
-function invalidate_user_cache()
+function invalidate_user_cache($full = true)
{
- $query = '
+ if ($full)
+ {
+ $query = '
+TRUNCATE TABLE '.USER_CACHE_CATEGORIES_TABLE.';';
+ pwg_query($query);
+ $query = '
+TRUNCATE TABLE '.USER_CACHE_TABLE.';';
+ pwg_query($query);
+ }
+ else
+ {
+ $query = '
UPDATE '.USER_CACHE_TABLE.'
- SET need_update = \'true\'';
- pwg_query($query);
+ SET need_update = \'true\';';
+ pwg_query($query);
+ }
trigger_action('invalidate_user_cache');
}