From 770fa761b8bf8452ff17a2036ca8413e74935a3d Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Mon, 9 Feb 2015 11:41:48 +0100 Subject: Respect `mod_unique_id` and refactor `OC_Request::getRequestId` When `mod_unique_id` is enabled the ID generated by it will be used for logging. This allows for correlation of the Apache logs and the ownCloud logs. Testplan: - [ ] When `mod_unique_id` is enabled the request ID equals the one generated by `mod_unique_id`. - [ ] When `mod_unique_id` is not available the request ID is a 20 character long random string - [ ] The generated Id is stable over the lifespan of one request Changeset looks a little bit larger since I had to adjust every unit test using the HTTP\Request class for proper DI. Fixes https://github.com/owncloud/core/issues/13366 --- lib/private/request.php | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'lib/private/request.php') diff --git a/lib/private/request.php b/lib/private/request.php index 3bf7d94d9cf..ab011c913d9 100644 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -13,7 +13,6 @@ class OC_Request { const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#'; const USER_AGENT_FREEBOX = '#^Mozilla/5\.0$#'; const REGEX_LOCALHOST = '/^(127\.0\.0\.1|localhost)$/'; - static protected $reqId; /** * Returns the remote address, if the connection came from a trusted proxy and `forwarded_for_headers` has been configured @@ -43,17 +42,6 @@ class OC_Request { return $remoteAddress; } - /** - * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging - * @return string - */ - public static function getRequestID() { - if(self::$reqId === null) { - self::$reqId = hash('md5', microtime().\OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(20)); - } - return self::$reqId; - } - /** * Check overwrite condition * @param string $type -- cgit v1.2.3