From: Craig Andrews Date: Wed, 18 Nov 2009 21:46:16 +0000 (-0500) Subject: Reuse ldap connections for the default config X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6d69d89cfea15e2a626cdf9378b75a3dfae65d4a;p=quix0rs-gnu-social.git Reuse ldap connections for the default config --- diff --git a/plugins/LdapAuthentication/LdapAuthenticationPlugin.php b/plugins/LdapAuthentication/LdapAuthenticationPlugin.php index 25531a8116..9e089485c6 100644 --- a/plugins/LdapAuthentication/LdapAuthenticationPlugin.php +++ b/plugins/LdapAuthentication/LdapAuthenticationPlugin.php @@ -160,6 +160,10 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin function ldap_get_connection($config = null){ if($config == null){ + static $ldap = null; + if($ldap != null){ + return $ldap; + } $config = $this->ldap_get_config(); } diff --git a/plugins/LdapAuthorization/LdapAuthorizationPlugin.php b/plugins/LdapAuthorization/LdapAuthorizationPlugin.php index 69357f8aad..91a343f408 100644 --- a/plugins/LdapAuthorization/LdapAuthorizationPlugin.php +++ b/plugins/LdapAuthorization/LdapAuthorizationPlugin.php @@ -159,6 +159,10 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin //-----the below function were copied from LDAPAuthenticationPlugin. They will be moved to a utility class soon.----\\ function ldap_get_connection($config = null){ if($config == null){ + static $ldap = null; + if($ldap != null){ + return $ldap; + } $config = $this->ldap_get_config(); }