From 487ba19c94efce6baee8ac1670e197f369f2abf1 Mon Sep 17 00:00:00 2001 From: rub Date: Wed, 19 Nov 2008 20:06:20 +0000 Subject: Delete caches and optimize tables on upgrade merge -c2890 from trunk to branch 2.0 The exact copy of commit log in 2890. git-svn-id: http://piwigo.org/svn/branches/2.0@2891 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'admin/include/functions.php') 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'); } -- cgit v1.2.3