]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Allow caching of ldap schema, greatly improves performance.
authorEric Helgeson <erichelgeson@gmail.com>
Sat, 19 Dec 2009 00:27:45 +0000 (18:27 -0600)
committerEric Helgeson <erichelgeson@gmail.com>
Sat, 19 Dec 2009 00:27:45 +0000 (18:27 -0600)
plugins/LdapAuthentication/LdapAuthenticationPlugin.php
plugins/LdapAuthentication/README

index f688a3f7e014ad4fa67165e324d486c9401c6bd9..0ce08bd782a1d7951c34c0e772e473a972012d00 100644 (file)
@@ -174,6 +174,15 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
             return false;
         }
         if($config == null) $this->default_ldap=$ldap;
+
+        if (isset($this->schema_cachefile)) {
+            $cacheConfig = array(
+                    'path'    => $this->schema_cachefile,
+                    'max_age' => (isset($this->schema_maxage) ? $this->schema_maxage : 1200 )
+                );
+            $cacheObj = new Net_LDAP2_SimpleFileSchemaCache($cacheConfig);
+            $ldap->registerSchemaCache($cacheObj);
+        }
         return $ldap;
     }
     
index 2226159c2e8a52802e091f786be22f503ffd693f..0460fb6396254f698b3b9bbfb26b54c1fd9f2f15 100644 (file)
@@ -42,6 +42,8 @@ filter: Default search filter.
     See http://pear.php.net/manual/en/package.networking.net-ldap2.connecting.php
 scope: Default search scope.
     See http://pear.php.net/manual/en/package.networking.net-ldap2.connecting.php
+schema_cachefile: File location to store ldap schema.
+schema_maxage: TTL for cache file.
 
 attributes: an array that relates StatusNet user attributes to LDAP ones
     username*: LDAP attribute value entered when authenticating to StatusNet