From 29433f1db489462a86eb4c694674fb057c0ea5b2 Mon Sep 17 00:00:00 2001 From: rvelices Date: Mon, 16 Dec 2013 20:18:56 +0000 Subject: invalidate_user_cache fix in web service method + do not invalidate user cache on every page hit on album list, photo etc ... git-svn-id: http://piwigo.org/svn/trunk@25975 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin.php | 10 +++------- admin/cat_list.php | 10 ++++++---- admin/group_list.php | 1 + admin/group_perm.php | 1 + admin/picture_modify.php | 12 +++++++----- include/ws_functions/pwg.groups.php | 5 +++++ 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/admin.php b/admin.php index 675948cad..9b5327b2a 100644 --- a/admin.php +++ b/admin.php @@ -263,20 +263,16 @@ if ( array( 'site_manager', // delete site 'site_update', // ?only POST - 'cat_list', // delete cat - 'cat_move', // ?only POST - 'cat_options', // ?only POST; public/private; lock/unlock - 'user_perm', - 'group_perm', - 'group_list', // delete group ) ) or ( !empty($_POST) and in_array($page['page'], array( - 'photo', 'album', // public/private; lock/unlock, permissions + 'cat_move', + 'cat_options', // public/private; lock/unlock 'batch_manager', // associate/dissociate; delete; set level 'user_list', // group assoc; user level + 'user_perm', ) ) ) diff --git a/admin/cat_list.php b/admin/cat_list.php index e7fc7805c..f728e8f73 100644 --- a/admin/cat_list.php +++ b/admin/cat_list.php @@ -115,22 +115,24 @@ if (isset($_GET['delete']) and is_numeric($_GET['delete'])) delete_categories(array($_GET['delete'])); $_SESSION['page_infos'] = array(l10n('Virtual album deleted')); update_global_rank(); + invalidate_user_cache(); $redirect_url = get_root_url().'admin.php?page=cat_list'; if (isset($_GET['parent_id'])) { $redirect_url.= '&parent_id='.$_GET['parent_id']; - } + } redirect($redirect_url); } // request to add a virtual category -else if (isset($_POST['submitAdd'])) +elseif (isset($_POST['submitAdd'])) { $output_create = create_virtual_category( $_POST['virtual_name'], @$_GET['parent_id'] ); + invalidate_user_cache(); if (isset($output_create['error'])) { $page['errors'][] = $output_create['error']; @@ -141,14 +143,14 @@ else if (isset($_POST['submitAdd'])) } } // save manual category ordering -else if (isset($_POST['submitManualOrder'])) +elseif (isset($_POST['submitManualOrder'])) { asort($_POST['catOrd'], SORT_NUMERIC); save_categories_order(array_keys($_POST['catOrd'])); $page['infos'][] = l10n('Album manual order was saved'); } -else if (isset($_POST['submitAutoOrder'])) +elseif (isset($_POST['submitAutoOrder'])) { $query = ' SELECT id diff --git a/admin/group_list.php b/admin/group_list.php index 10e9cd7f8..ebdda4ab3 100644 --- a/admin/group_list.php +++ b/admin/group_list.php @@ -359,6 +359,7 @@ SELECT COUNT(*) $page['infos'][] = l10n('group "%s" updated', $groupname); } } + invalidate_user_cache(); } // +-----------------------------------------------------------------------+ // | template init | diff --git a/admin/group_perm.php b/admin/group_perm.php index 42c3309b2..f7487d81b 100644 --- a/admin/group_perm.php +++ b/admin/group_perm.php @@ -112,6 +112,7 @@ SELECT cat_id } mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $inserts); + invalidate_user_cache(); } // +-----------------------------------------------------------------------+ diff --git a/admin/picture_modify.php b/admin/picture_modify.php index 9c1af0dd4..49cbb705f 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -82,7 +82,7 @@ SELECT category_id array_from_query($query, 'category_id'), explode(',', calculate_permissions($user['id'], $user['status'])) ); - + foreach ($authorizeds as $category_id) { redirect( @@ -175,12 +175,14 @@ if (isset($_POST['submit']) and count($page['errors']) == 0) } move_images_to_categories(array($_GET['image_id']), $_POST['associate']); + invalidate_user_cache(); + // thumbnail for albums if (!isset($_POST['represent'])) { $_POST['represent'] = array(); } - + $no_longer_thumbnail_for = array_diff($represent_options_selected, $_POST['represent']); if (count($no_longer_thumbnail_for) > 0) { @@ -199,7 +201,7 @@ UPDATE '.CATEGORIES_TABLE.' } $represent_options_selected = $_POST['represent']; - + $page['infos'][] = l10n('Photo informations updated'); } @@ -320,12 +322,12 @@ SELECT WHERE element_id = '.$_GET['image_id'].' ;'; list($row['nb_rates']) = pwg_db_fetch_row(pwg_query($query)); - + $intro_vars['stats'].= ', '.sprintf(l10n('Rated %d times, score : %.2f'), $row['nb_rates'], $row['rating_score']); } $template->assign('INTRO', $intro_vars); - + if (in_array(get_extension($row['path']),$conf['picture_ext'])) { diff --git a/include/ws_functions/pwg.groups.php b/include/ws_functions/pwg.groups.php index 3ae200bec..57b4766b8 100644 --- a/include/ws_functions/pwg.groups.php +++ b/include/ws_functions/pwg.groups.php @@ -149,6 +149,9 @@ DELETE ;'; pwg_query($query); + include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); + invalidate_user_cache(); + return new PwgNamedArray($groupnames, 'group_deleted'); } @@ -246,6 +249,7 @@ SELECT COUNT(*) array('ignore'=>true) ); + include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); invalidate_user_cache(); return $service->invoke('pwg.groups.getList', array('group_id' => $params['group_id'])); @@ -280,6 +284,7 @@ DELETE FROM '. USER_GROUP_TABLE .' ;'; pwg_query($query); + include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); invalidate_user_cache(); return $service->invoke('pwg.groups.getList', array('group_id' => $params['group_id'])); -- cgit v1.2.3