reduced LDAP connects
This commit is contained in:
parent
70700205a9
commit
7048f58c1d
|
@ -57,6 +57,8 @@ class Ldap{
|
||||||
/** Server handle */
|
/** Server handle */
|
||||||
private $server;
|
private $server;
|
||||||
|
|
||||||
|
private $is_connected = false;
|
||||||
|
|
||||||
/** LDAP username used for bind */
|
/** LDAP username used for bind */
|
||||||
private $username;
|
private $username;
|
||||||
/** LDAP password used for bind */
|
/** LDAP password used for bind */
|
||||||
|
@ -293,6 +295,11 @@ class Ldap{
|
||||||
* @return object connection handle
|
* @return object connection handle
|
||||||
*/
|
*/
|
||||||
function server() {
|
function server() {
|
||||||
|
if (!$this->is_connected) {
|
||||||
|
$data = $this->decrypt_login();
|
||||||
|
$this->connect($data[0], $data[1]);
|
||||||
|
$this->is_connected = true;
|
||||||
|
}
|
||||||
return $this->server;
|
return $this->server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,8 +313,7 @@ class Ldap{
|
||||||
|
|
||||||
/** Reconnects to LDAP server when deserialized */
|
/** Reconnects to LDAP server when deserialized */
|
||||||
function __wakeup() {
|
function __wakeup() {
|
||||||
$data = $this->decrypt_login();
|
$this->is_connected = false;
|
||||||
$this->connect($data[0], $data[1]);
|
|
||||||
// change random number
|
// change random number
|
||||||
mt_srand($this->rand + (microtime() * 1000000));
|
mt_srand($this->rand + (microtime() * 1000000));
|
||||||
$this->rand = mt_rand();
|
$this->rand = mt_rand();
|
||||||
|
|
Loading…
Reference in New Issue