phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php


From: Sigurd Nes
Subject: [Phpgroupware-cvs] phpgwapi/inc class.acl.inc.php
Date: Wed, 21 Mar 2007 22:24:59 +0000

CVSROOT:        /sources/phpgwapi
Module name:    phpgwapi
Changes by:     Sigurd Nes <sigurdne>   07/03/21 22:24:59

Modified files:
        inc            : class.acl.inc.php 

Log message:
        Tuning (ten times faster)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.acl.inc.php?cvsroot=phpgwapi&r1=1.107&r2=1.108

Patches:
Index: class.acl.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.acl.inc.php,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- class.acl.inc.php   24 Feb 2007 20:34:07 -0000      1.107
+++ class.acl.inc.php   21 Mar 2007 22:24:59 -0000      1.108
@@ -6,7 +6,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.acl.inc.php,v 1.107 2007/02/24 20:34:07 sigurdne 
Exp $
+       * @version $Id: class.acl.inc.php,v 1.108 2007/03/21 22:24:59 sigurdne 
Exp $
        */
 
        /**
@@ -89,11 +89,19 @@
                        {
                                $GLOBALS['phpgw']->shm = 
createObject('phpgwapi.shm');
                        }
+               }
 
-                       if ( 
isset($GLOBALS['phpgw_info']['server']['shm_lang']) && 
$GLOBALS['phpgw_info']['server']['shm_lang']
+               /**
+               * Checks whether the system is set to utilise shared memory
+               * @return bool ACL data loaded from shared memory
+               */
+               function load_from_shm()
+               {
+                       if 
((isset($GLOBALS['phpgw_info']['server']['shm_lang']) 
+                               && $GLOBALS['phpgw_info']['server']['shm_lang'])
                                && function_exists('sem_get'))
                        {
-                               $this->load_from_shm = true;
+                               return true;
                        }
                }
 
@@ -163,7 +171,9 @@
                        {
                                $this->acl();
                        }
-
+                       if ( !$this->load_from_shm()
+                               || !($this->data[$this->account_id] = 
$GLOBALS['phpgw']->shm->get_value($GLOBALS['phpgw_info']['user']['domain'] . 
'acl_data_' . $account_type . '_' . $this->account_id)))
+                       {
                        if ( 
$GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap' )
                        {
                                return 
$this->_read_repository_ldap($account_type);
@@ -173,6 +183,7 @@
                                return 
$this->_read_repository_sql($account_type);
                        }
                }
+               }
 
                /**
                * Get acl records
@@ -450,11 +461,23 @@
 
                        $this->db->transaction_commit();
 
-                       if($this->load_from_shm)
+                       if($this->load_from_shm())
                        {
                                
$GLOBALS['phpgw']->shm->delete_key($GLOBALS['phpgw_info']['user']['domain'] . 
'acl_data_groups_' . $this->account_id);
                                
$GLOBALS['phpgw']->shm->delete_key($GLOBALS['phpgw_info']['user']['domain'] . 
'acl_data_accounts_' . $this->account_id);
                                
$GLOBALS['phpgw']->shm->delete_key($GLOBALS['phpgw_info']['user']['domain'] . 
'acl_data_both_' . $this->account_id);
+
+                               $members = 
$this->get_ids_for_location($this->account_id, 1, 'phpgw_group');
+
+                               if (is_array($members) && count($members) > 0)
+                               {
+                                       foreach ( $members as $account_id )
+                                       {
+                                               
$GLOBALS['phpgw']->shm->delete_key($GLOBALS['phpgw_info']['user']['domain'] . 
'acl_data_groups_' . $account_id);
+                                               
$GLOBALS['phpgw']->shm->delete_key($GLOBALS['phpgw_info']['user']['domain'] . 
'acl_data_accounts_' . $ccount_id);
+                                               
$GLOBALS['phpgw']->shm->delete_key($GLOBALS['phpgw_info']['user']['domain'] . 
'acl_data_both_' . $account_id);
+                                       }
+                               }
                        }
 
 //                     return $unique_data;
@@ -487,7 +510,7 @@
 
                        if (!isset($this->data[$this->account_id]) || 
count($this->data[$this->account_id]) == 0)
                        {
-                               if($this->load_from_shm)
+                               if($this->load_from_shm())
                                {
                                        $this->data[$this->account_id] = 
$GLOBALS['phpgw']->shm->get_value($GLOBALS['phpgw_info']['user']['domain'] . 
'acl_data_' . $account_type . '_' . $this->account_id);
                                        
if((is_array($this->data[$this->account_id]) && 
count($this->data[$this->account_id])==0) || $this->data[$this->account_id] == 
'empty')




reply via email to

[Prev in Thread] Current Thread [Next in Thread]