6006b78
From 132a807dff7fc2d173e2e3bebb18ee181c7b27d9 Mon Sep 17 00:00:00 2001
a77e990
From: Remi Collet <fedora@famillecollet.com>
a77e990
Date: Mon, 28 Dec 2015 08:47:37 +0100
6006b78
Subject: [PATCH 1/2] add .log suffix to all log file names
a77e990
a77e990
---
a77e990
 program/lib/Roundcube/rcube.php | 2 +-
a77e990
 1 file changed, 1 insertion(+), 1 deletion(-)
a77e990
a77e990
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
6006b78
index 3694c5c4b..ef5dcb94e 100644
a77e990
--- a/program/lib/Roundcube/rcube.php
a77e990
+++ b/program/lib/Roundcube/rcube.php
6006b78
@@ -1246,7 +1246,7 @@ public static function write_log($name, $line)
f88523e
             $log_dir = RCUBE_INSTALL_PATH . 'logs';
a77e990
         }
a77e990
 
f88523e
-        return file_put_contents("$log_dir/$name", $line, FILE_APPEND) !== false;
f88523e
+        return file_put_contents("$log_dir/$name.log", $line, FILE_APPEND) !== false;
f88523e
     }
a77e990
 
f88523e
     /**
6006b78
6006b78
From 6ca4eab399adad22ed93b26c5870896425631dfa Mon Sep 17 00:00:00 2001
6006b78
From: Remi Collet <remi@remirepo.net>
6006b78
Date: Tue, 27 Jun 2017 13:35:01 +0200
6006b78
Subject: [PATCH 2/2] add 'log_file_ext' configuration option
6006b78
6006b78
---
6006b78
 config/defaults.inc.php         | 3 +++
6006b78
 program/lib/Roundcube/rcube.php | 8 +++++++-
6006b78
 2 files changed, 10 insertions(+), 1 deletion(-)
6006b78
6006b78
diff --git a/config/defaults.inc.php b/config/defaults.inc.php
6006b78
index e2db2b726..050803231 100644
6006b78
--- a/config/defaults.inc.php
6006b78
+++ b/config/defaults.inc.php
6006b78
@@ -77,6 +77,9 @@
6006b78
 // set to 0 to avoid session IDs being logged.
6006b78
 $config['log_session_id'] = 8;
6006b78
 
6006b78
+// Default extension used for log file name
6006b78
+$config['log_file_ext'] = '.log';
6006b78
+
6006b78
 // Syslog ident string to use, if using the 'syslog' log driver.
6006b78
 $config['syslog_id'] = 'roundcube';
6006b78
 
6006b78
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
6006b78
index ef5dcb94e..401cd3f86 100644
6006b78
--- a/program/lib/Roundcube/rcube.php
6006b78
+++ b/program/lib/Roundcube/rcube.php
6006b78
@@ -1242,11 +1242,17 @@ public static function write_log($name, $line)
6006b78
             }
6006b78
         }
6006b78
 
6006b78
+        if (self::$instance) {
6006b78
+            $log_suf = self::$instance->config->get('log_file_ext', '.log');
6006b78
+        } else {
6006b78
+            $log_suf = '.log';
6006b78
+        }
6006b78
+
6006b78
         if (empty($log_dir)) {
6006b78
             $log_dir = RCUBE_INSTALL_PATH . 'logs';
6006b78
         }
6006b78
 
6006b78
-        return file_put_contents("$log_dir/$name.log", $line, FILE_APPEND) !== false;
6006b78
+        return file_put_contents("$log_dir/$name$log_suf", $line, FILE_APPEND) !== false;
6006b78
     }
6006b78
 
6006b78
     /**