Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117872980
D296.1775331727.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D296.1775331727.diff
View Options
diff --git a/config/dav.inc.php.sample b/config/dav.inc.php.sample
--- a/config/dav.inc.php.sample
+++ b/config/dav.inc.php.sample
@@ -42,9 +42,6 @@
// by http requests. This will write log to /var/log/iRony/console
$config['kolabdav_console'] = false;
-// enable per-user debugging if /var/log/iRony/<username>/ folder exists
-$config['kolabdav_user_debug'] = false;
-
// enable logging of full HTTP payload
// (bitmask of these values: 2 = HTTP Requests, 4 = HTTP Responses)
$config['kolabdav_http_log'] = 0;
diff --git a/lib/Kolab/Utils/DAVLogger.php b/lib/Kolab/Utils/DAVLogger.php
--- a/lib/Kolab/Utils/DAVLogger.php
+++ b/lib/Kolab/Utils/DAVLogger.php
@@ -33,8 +33,8 @@
*/
class DAVLogger extends DAV\ServerPlugin
{
- const CONSOLE = 1;
- const HTTP_REQUEST = 2;
+ const CONSOLE = 1;
+ const HTTP_REQUEST = 2;
const HTTP_RESPONSE = 4;
private $rcube;
@@ -48,7 +48,7 @@
*/
public function __construct($level = 1)
{
- $this->rcube = rcube::get_instance();
+ $this->rcube = rcube::get_instance();
$this->loglevel = $level;
}
@@ -78,8 +78,9 @@
$this->method = $request->getMethod();
// turn on per-user http logging if the destination file exists
- if ($this->loglevel < 2 && $this->rcube->config->get('kolabdav_user_debug', false)
- && ($log_dir = $this->user_log_dir()) && file_exists($log_dir . '/httpraw')) {
+ if ($this->loglevel < 2 && $this->rcube->config->get('per_user_logging', false)
+ && ($log_dir = $this->user_log_dir()) && file_exists($log_dir . '/httpraw')
+ ) {
$this->loglevel |= (self::HTTP_REQUEST | self::HTTP_RESPONSE);
}
@@ -107,13 +108,13 @@
$http_headers[$hdr] = "$hdr: $value";
}
- $this->write_log('httpraw', $request->getMethod() . ' ' . $request->getUrl() . ' ' . $_SERVER['SERVER_PROTOCOL'] . "\n" .
+ rcube::write_log('httpraw', $request->getMethod() . ' ' . $request->getUrl() . ' ' . $_SERVER['SERVER_PROTOCOL'] . "\n" .
join("\n", $http_headers) . "\n\n" . $http_body);
}
// log to console
if ($this->loglevel & self::CONSOLE) {
- $this->write_log('console', $this->method . ' ' . $request->getUrl());
+ rcube::write_log('console', $this->method . ' ' . $request->getUrl());
}
}
@@ -161,16 +162,16 @@
$time = microtime(true) - KOLAB_DAV_START;
if (function_exists('memory_get_usage'))
- $mem = round(memory_get_usage() / 1024 / 1024, 1) . 'MB';
+ $mem = round(memory_get_usage() / 1024 / 1024, 1) . 'MB';
if (function_exists('memory_get_peak_usage'))
- $mem .= '/' . round(memory_get_peak_usage() / 1024 / 1024, 1) . 'MB';
+ $mem .= '/' . round(memory_get_peak_usage() / 1024 / 1024, 1) . 'MB';
- $this->write_log('console', sprintf("/%s: %0.4f sec; %s", $this->method, $time, $mem));
+ rcube::write_log('console', sprintf("/%s: %0.4f sec; %s", $this->method, $time, $mem));
}
// log full HTTP reponse
if ($this->loglevel & self::HTTP_RESPONSE) {
- $this->write_log('httpraw', "RESPONSE: " . $this->server->httpResponse->dump());
+ rcube::write_log('httpraw', "RESPONSE: " . $this->server->httpResponse->dump());
}
}
@@ -185,29 +186,11 @@
$msg[] = !is_string($arg) ? var_export($arg, true) : $arg;
}
- $this->write_log('console', join(";\n", $msg));
+ rcube::write_log('console', join(";\n", $msg));
}
}
/**
- * Wrapper for rcube::write_log() that can write per-user logs
- */
- public function write_log($filename, $msg)
- {
- // dump data per user
- if ($this->rcube->config->get('kolabdav_user_debug', false)) {
- if ($this->user_log_dir()) {
- $filename = HTTPBasic::$current_user . '/' . $filename;
- }
- else {
- return; // don't log
- }
- }
-
- rcube::write_log($filename, $msg);
- }
-
- /**
* Get the per-user log directory
*/
private function user_log_dir()
@@ -217,4 +200,4 @@
return HTTPBasic::$current_user && is_writable($user_log_dir) ? $user_log_dir : false;
}
-}
\ No newline at end of file
+}
diff --git a/public_html/index.php b/public_html/index.php
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -69,7 +69,7 @@
$rcube->plugins->load_plugins($plugins, $required);
// enable logger
-if ($rcube->config->get('kolabdav_console') || $rcube->config->get('kolabdav_user_debug')) {
+if ($rcube->config->get('kolabdav_console') || $rcube->config->get('per_user_logging')) {
$logger = new \Kolab\Utils\DAVLogger((\Kolab\Utils\DAVLogger::CONSOLE | $rcube->config->get('kolabdav_http_log', 0)));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 7:42 PM (1 h, 22 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18794172
Default Alt Text
D296.1775331727.diff (4 KB)
Attached To
Mode
D296: T1982: Remove kolabdav_user_debug in favor of Roundcube's per_user_logging
Attached
Detach File
Event Timeline