From 2965a981b7ec22866fbdf2d567d87e2d068d3617 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 31 Jul 2015 16:04:08 -0400
Subject: [PATCH] Allow to search and import missing PGP pubkeys from keyservers using Publickey.js

---
 plugins/debug_logger/debug_logger.php |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/plugins/debug_logger/debug_logger.php b/plugins/debug_logger/debug_logger.php
index 8cd3351..07190e5 100644
--- a/plugins/debug_logger/debug_logger.php
+++ b/plugins/debug_logger/debug_logger.php
@@ -12,22 +12,22 @@
  * which can redirect messages to files.  The resulting log files
  * provide timing and tag quantity results.
  *
- * Enable the plugin in config/main.inc.php and add your desired
+ * Enable the plugin in config.inc.php and add your desired
  * log types and files.
  *
- * @version 1.0
+ * @version @package_version@
  * @author Ziba Scott
  * @website http://roundcube.net
  * 
  * Example:
  *
- * config/main.inc.php:
+ * config.inc.php:
  *
- *   // $rcmail_config['debug_logger'][type of logging] = name of file in log_dir
+ *   // $config['debug_logger'][type of logging] = name of file in log_dir
  *   // The 'master' log includes timing information
- *   $rcmail_config['debug_logger']['master'] = 'master';
+ *   $config['debug_logger']['master'] = 'master';
  *   // If you want sql messages to also go into a separate file 
- *   $rcmail_config['debug_logger']['sql'] = 'sql';
+ *   $config['debug_logger']['sql'] = 'sql';
  *
  * index.php (just after $RCMAIL->plugins->init()):
  *
@@ -66,8 +66,8 @@
 {
     function init()
     {
-        require_once(dirname(__FILE__).'/runlog/runlog.php');
-        $this->runlog = new runlog(); 
+        require_once(__DIR__ . '/runlog/runlog.php');
+        $this->runlog = new runlog();
 
         if(!rcmail::get_instance()->config->get('log_dir')){
             rcmail::get_instance()->config->set('log_dir',INSTALL_PATH.'logs');
@@ -83,10 +83,10 @@
         $action = rcmail::get_instance()->action;
         $task = rcmail::get_instance()->task;
         if($action){
-               $start_string .= "Action: ".$action.". "; 
+               $start_string .= "Action: ".$action.". ";
         }
         if($task){
-               $start_string .= "Task: ".$task.". "; 
+               $start_string .= "Task: ".$task.". ";
         }
         $this->runlog->start($start_string);
 
@@ -106,12 +106,15 @@
 
         if(!isset($args[1])){
             // This could be extended to detect types based on the 
-            // file which called console.  For now only rcube_imap.inc is supported
-            $bt = debug_backtrace(true);
+            // file which called console. For now only rcube_imap/rcube_storage is supported
+            $bt = debug_backtrace();
             $file  = $bt[3]['file'];
             switch(basename($file)){
                 case 'rcube_imap.php':
                     $type = 'imap';
+                    break;
+                case 'rcube_storage.php':
+                    $type = 'storage';
                     break;
                 default:
                     $type = FALSE; 
@@ -139,8 +142,9 @@
         return $args;
     }
 
-    function __destruct(){
-                $this->runlog->end();
+    function __destruct()
+    {
+        if ($this->runlog)
+            $this->runlog->end();
     }
 }
-?>

--
Gitblit v1.9.1