2 commits - lib/functions.php lib/kolab_client_api.php lib/kolab_client_task.php

Aleksander Machniak machniak at kolabsys.com
Fri May 11 10:05:30 CEST 2012


 lib/functions.php         |   11 +++++++----
 lib/kolab_client_api.php  |   22 ++++++++++++++++++++++
 lib/kolab_client_task.php |    5 +----
 3 files changed, 30 insertions(+), 8 deletions(-)

New commits:
commit 92aeb73fb6e7788a0c9219e9a3aa28e0c294163c
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Fri May 11 10:05:06 2012 +0200

    Small improvement in errors logging

diff --git a/lib/functions.php b/lib/functions.php
index 441752f..4183454 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -108,16 +108,19 @@ function write_log($name, $line)
     $logfile = $log_dir . '/' . $name;
     $date    = date('d-M-Y H:i:s O');
     $sess_id = session_id();
-    $line    = sprintf("[%s]%s: %s\n", $date, $sess_id ? "($sess_id)" : '', $line);
+    $logline = sprintf("[%s]%s: %s\n", $date, $sess_id ? "($sess_id)" : '', $line);
 
     if ($fp = @fopen($logfile, 'a')) {
-        fwrite($fp, $line);
+        fwrite($fp, $logline);
         fflush($fp);
         fclose($fp);
-        return true;
+        return;
     }
 
-    return false;
+    if ($name == 'errors') {
+        // send error to PHPs error handler if write to file didn't succeed
+        trigger_error($line, E_USER_ERROR);
+    }
 }
 
 function timer($time = null, $label = '')
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 380e590..4bcc56b 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -328,10 +328,7 @@ class kolab_client_task
             $msg . (isset($args['file']) ? sprintf(' in %s on line %d', $args['file'], $args['line']) : ''),
             $_SERVER['REQUEST_METHOD']);
 
-        if (!write_log('errors', $log_line)) {
-            // send error to PHPs error handler if write_log() didn't succeed
-            trigger_error($msg, E_USER_ERROR);
-        }
+        write_log('errors', $log_line);
 
         if (!$output) {
             return;


commit 6beb449f9b160725f3b7c2b36c54c331bc73bb3f
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Fri May 11 09:58:47 2012 +0200

    Support SSL connection configuration of HTTP_Request2 via kolab.conf (#751)

diff --git a/lib/kolab_client_api.php b/lib/kolab_client_api.php
index b8d101a..4159a84 100644
--- a/lib/kolab_client_api.php
+++ b/lib/kolab_client_api.php
@@ -60,6 +60,28 @@ class kolab_client_api
     public function init()
     {
         $this->request = new HTTP_Request2();
+
+        // Configure connection options
+        $config  = Conf::get_instance();
+        $options = array(
+            'ssl_verify_peer',
+            'ssl_verify_host',
+            'ssl_cafile',
+            'ssl_capath',
+            'ssl_local_cert',
+            'ssl_passphrase',
+        );
+
+        foreach ($options as $optname) {
+            if (($optvalue = $config->get('kolab_wap', $optname)) !== null) {
+                try {
+                    $this->request->setConfig($optname, $optvalue);
+                }
+                catch (Exception $e) {
+                    write_log('errors', $e->getMessage());
+                }
+            }
+        }
     }
 
     /**





More information about the commits mailing list