From b0146349db9499c47b151668749df18a6d9708b6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 20 Dec 2007 19:38:26 +0000 Subject: [PATCH] moved __wakeup code to reconnect to ldap server to the accounts_ldap class own __wakeup method, fixing an error with editing accounts using php4-restore together with accounts in ldap --- phpgwapi/inc/class.accounts_ldap.inc.php | 9 ++++++++ phpgwapi/inc/class.egw.inc.php | 27 ++++++++++++++++-------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index aa478f6575..db4847c8ef 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -1017,4 +1017,13 @@ class accounts_ldap } return $sign * $account_id; } + + /** + * __wakeup function gets called by php while unserializing the object to reconnect with the ldap server + */ + function __wakeup() + { + $this->ds = $this->ldap->ldapConnect($this->frontend->config['ldap_host'], + $this->frontend->config['ldap_root_dn'],$this->frontend->config['ldap_root_pw']); + } } diff --git a/phpgwapi/inc/class.egw.inc.php b/phpgwapi/inc/class.egw.inc.php index fbae0f3dbb..f9a1ec104c 100644 --- a/phpgwapi/inc/class.egw.inc.php +++ b/phpgwapi/inc/class.egw.inc.php @@ -32,20 +32,34 @@ { /** * Turn on debug mode. Will output additional data for debugging purposes. - * @var string $debug + * @var string * @access public */ var $debug = 0; // This will turn on debugging information. /** - * @var egw_db-object $db instance of the db-object + * Instance of the db-object + * + * @var egw_db */ var $db; var $config_table = 'egw_config'; + /** + * Instance of the account object + * + * @var accounts + */ + var $accounts; + /** + * Instace of the common object + * + * @var common + */ + var $common; /** - * tplsav2 savant2 templating object + * savant2 templating object * - * @var object + * @var tplsavant2 */ var $tplsav2; @@ -206,11 +220,6 @@ $this->$class->db->Link_ID =& $this->db->Link_ID; } } - if ($GLOBALS['egw_info']['server']['account_repository'] == 'ldap') - { - // reconnect the LDAP server, unfortunally this does not work via accounts::__wakeup() as the common-object is not yet available - $this->accounts->ds = $this->common->ldapConnect(); - } $this->define_egw_constants(); }