summaryrefslogtreecommitdiff
path: root/lib/Kolab/FreeBusy/DirectoryLDAP.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Kolab/FreeBusy/DirectoryLDAP.php')
-rw-r--r--lib/Kolab/FreeBusy/DirectoryLDAP.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/Kolab/FreeBusy/DirectoryLDAP.php b/lib/Kolab/FreeBusy/DirectoryLDAP.php
index f7dfb95..ae80bfc 100644
--- a/lib/Kolab/FreeBusy/DirectoryLDAP.php
+++ b/lib/Kolab/FreeBusy/DirectoryLDAP.php
@@ -1,6 +1,6 @@
<?php
-namespace Kolab;
+namespace Kolab\FreeBusy;
// PEAR modules operate in global namespace
use \Net_LDAP3;
@@ -8,9 +8,10 @@ use \Net_LDAP3;
/**
*
*/
-class FBDirectoryLDAP extends FBDirectory
+class DirectoryLDAP extends Directory
{
private $ldap;
+ private $logger;
/**
* Default constructor loading directory configuration
@@ -21,13 +22,24 @@ class FBDirectoryLDAP extends FBDirectory
);
+ $this->logger = Logger::get('ldap');
$this->ldap = new Net_LDAP3($ldap_config);
- # $this->ldap->config_set_log_hook();
+ $this->ldap->config_set('log_hook', array($this, 'log'));
$this->ldap->connect();
}
/**
- * @see FBDirectory::resolve()
+ * Callback for Net_LDAP3 logging
+ */
+ public function log($log)
+ {
+ // TODO: map $log[0] levels
+ $msg = is_array($log[1]) ? join('; ', $log[1]) : strval($log[1]);
+ $this->logger->addRecord($log[0], $msg);
+ }
+
+ /**
+ * @see Directory::resolve()
*/
public function resolve($user)
{