phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.accounts_ldap.inc.php, 1.101.2.13.


From: Caeies
Subject: [Phpgroupware-cvs] phpgwapi/inc class.accounts_ldap.inc.php, 1.101.2.13.2.38
Date: Fri, 30 Sep 2005 19:03:00 +0200

Update of phpgwapi/inc

Modified Files:
     Branch: Version-0_9_16-branch
            class.accounts_ldap.inc.php lines: +21 -12

Log Message:
Cache fix for id2name, name2id and search_person, and typo in person_exist

====================================================
Index: phpgwapi/inc/class.accounts_ldap.inc.php
diff -u phpgwapi/inc/class.accounts_ldap.inc.php:1.101.2.13.2.37 
phpgwapi/inc/class.accounts_ldap.inc.php:1.101.2.13.2.38
--- phpgwapi/inc/class.accounts_ldap.inc.php:1.101.2.13.2.37    Fri Sep 30 
16:14:39 2005
+++ phpgwapi/inc/class.accounts_ldap.inc.php    Fri Sep 30 17:03:42 2005
@@ -26,6 +26,8 @@
                var $ds;
                var $user_context  = '';
                var $group_context = '';
+               var $cache_name = array();
+               var $cache_id = array();

                /**
                * @internal Be Carefull to correctly set the following!
@@ -314,11 +316,9 @@
                */
                function name2id($account_lid)
                {
-                       static $name_list;
-
-                       if(@isset($name_list[$account_lid]) && 
$name_list[$account_lid])
+                       if(@isset($this->cache_name[$account_lid]) && 
$this->cache_name[$account_lid])
                        {
-                               return $name_list[$account_lid];
+                               return $this->cache_name[$account_lid];
                        }

                        $id  = $this->groupName2id($account_lid);
@@ -328,6 +328,11 @@
                        {
                                $id = $uid;
                        }
+                       $this->cache_name[$account_lid] = $id;
+                       if($id)
+                       {
+                               $this->cache_id[$id] = $account_lid;
+                       }
                        return $id;
                }

@@ -381,10 +386,9 @@
                */
                function id2name($id)
                {
-                       static $id_list;
-                       if(isset($id_list[$id]))
+                       if(isset($this->cache_id[$id]))
                        {
-                               return $id_list[$id];
+                               return $this->cache_id[$id];
                        }

                        $type = $this->get_type($id);
@@ -403,6 +407,11 @@
                        {
                                return false;
                        }
+                       $this->cache_id[$id] = $name;
+                       if($name)
+                       {
+                               $this->cache_name[$name] = $id;
+                       }
                        return $name;
                }

@@ -411,7 +420,7 @@
                        static $person_list;
                        if(isset($person_list[$person_id]))
                        {
-                               return intval($person_list[$person_id]);
+                               return $person_list[$person_id];
                        }

                        $allValues = array();
@@ -431,11 +440,11 @@

                        if (@$allValues[0]['uidnumber'][0])
                        {
-                               $id_list[$person_id] = 
intval($allValues[0]['uidnumber'][0]);
+                               $person_list[$person_id] = 
intval($allValues[0]['uidnumber'][0]);
                                return $person_list[$person_id];
                        }

-                       return $person_list[$person_id];
+                       return false;
                }

                /**
@@ -599,7 +608,7 @@
                {
                        if ($id)
                        {
-                               $result = ldap_search($this->ds, 
$this->user_context, 'phpgwcontact=' . $id);
+                               $result = ldap_search($this->ds, 
$this->user_context, 'phpgwcontactid=' . $id);
                                $allValues = ldap_get_entries($this->ds, 
$result);
                                if ($allValues[0]['dn'])
                                {






reply via email to

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