Changeset 9501


Ignore:
Timestamp:
03/03/11 22:30:14 (9 years ago)
Author:
plg
Message:

optimization: only calculate upload permissions once in a user session

Location:
extensions/community
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/admin_permissions.php

    r9500 r9501  
    8989    l10n('Permission added') 
    9090    ); 
     91 
     92  conf_update_param('community_update', time()); 
    9193} 
    9294 
     
    105107;'; 
    106108  pwg_query($query); 
     109 
     110  conf_update_param('community_update', time()); 
    107111 
    108112  $_SESSION['page_infos'] = array(l10n('Permission removed')); 
  • extensions/community/include/functions_community.inc.php

    r9500 r9501  
    2626  global $conf, $user; 
    2727 
     28  if (!isset($conf['community_update'])) 
     29  { 
     30    conf_update_param('community_update', time()); 
     31  } 
     32   
     33  if (isset($_SESSION['community_user_permissions'])) 
     34  { 
     35    if ($_SESSION['community_update'] > $conf['community_update']) 
     36    { 
     37      return $_SESSION['community_user_permissions']; 
     38    } 
     39  } 
     40 
    2841  $return = array( 
    2942    'upload_whole_gallery' => false, 
     
    185198  } 
    186199 
    187   return $return; 
     200  $_SESSION['community_user_permissions'] = $return; 
     201  $_SESSION['community_update'] = time(); 
     202 
     203  return $_SESSION['community_user_permissions']; 
    188204} 
    189205 
Note: See TracChangeset for help on using the changeset viewer.