Delete caches and optimize tables on upgrade

git-svn-id: http://piwigo.org/svn/trunk@2890 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub
2008-11-19 20:03:49 +00:00
parent 3c2c976441
commit e41325376b
3 changed files with 25 additions and 7 deletions

View File

@@ -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');
}