Allow caching of ldap schema, greatly improves performance.

This commit is contained in:
Eric Helgeson 2009-12-18 18:27:45 -06:00
parent 490238faf6
commit 4002c18065
2 changed files with 11 additions and 0 deletions

View File

@ -174,6 +174,15 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
return false; return false;
} }
if($config == null) $this->default_ldap=$ldap; 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; return $ldap;
} }

View File

@ -42,6 +42,8 @@ filter: Default search filter.
See http://pear.php.net/manual/en/package.networking.net-ldap2.connecting.php See http://pear.php.net/manual/en/package.networking.net-ldap2.connecting.php
scope: Default search scope. scope: Default search scope.
See http://pear.php.net/manual/en/package.networking.net-ldap2.connecting.php 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 attributes: an array that relates StatusNet user attributes to LDAP ones
username*: LDAP attribute value entered when authenticating to StatusNet username*: LDAP attribute value entered when authenticating to StatusNet