diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-02-09 11:41:48 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-02-09 11:53:11 +0100 |
commit | 770fa761b8bf8452ff17a2036ca8413e74935a3d (patch) | |
tree | ecce3b7443278b0ebdac588ba40840190a3aadcd /lib/public/irequest.php | |
parent | 0e604aa875a677f76b2bf326631646ac31fbadbd (diff) | |
download | nextcloud-server-770fa761b8bf8452ff17a2036ca8413e74935a3d.tar.gz nextcloud-server-770fa761b8bf8452ff17a2036ca8413e74935a3d.zip |
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
Diffstat (limited to 'lib/public/irequest.php')
-rw-r--r-- | lib/public/irequest.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/public/irequest.php b/lib/public/irequest.php index 988b3aebd7b..b5ea1fa95da 100644 --- a/lib/public/irequest.php +++ b/lib/public/irequest.php @@ -127,4 +127,11 @@ interface IRequest { * @return bool true if CSRF check passed */ public function passesCSRFCheck(); + + /** + * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging + * If `mod_unique_id` is installed this value will be taken. + * @return string + */ + public function getId(); } |