diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-03-22 12:08:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 12:08:45 +0100 |
commit | 0acd4b5f8202be8b3f3b4e6d7481e3d23e496b86 (patch) | |
tree | 06897c455b69be134fcd61b0f0130609ce7a75a1 /lib/private/Server.php | |
parent | b6209d61251f7abacefb8cf3c164d39bcba29100 (diff) | |
parent | 67452b94ca0b59a063c4364f5930bb5186db2d55 (diff) | |
download | nextcloud-server-0acd4b5f8202be8b3f3b4e6d7481e3d23e496b86.tar.gz nextcloud-server-0acd4b5f8202be8b3f3b4e6d7481e3d23e496b86.zip |
Merge pull request #31235 from nextcloud/techdebt/noid/extract-request-id
Extract request id handling to dedicated class so it can be injected without DB dependency
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r-- | lib/private/Server.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php index 00afaf1d6a9..b189905cfaf 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -60,6 +60,7 @@ use OC\App\AppStore\Fetcher\AppFetcher; use OC\App\AppStore\Fetcher\CategoryFetcher; use OC\AppFramework\Bootstrap\Coordinator; use OC\AppFramework\Http\Request; +use OC\AppFramework\Http\RequestId; use OC\AppFramework\Utility\TimeFactory; use OC\Authentication\Events\LoginFailed; use OC\Authentication\Listeners\LoginFailedListener; @@ -205,6 +206,7 @@ use OCP\ILogger; use OCP\INavigationManager; use OCP\IPreview; use OCP\IRequest; +use OCP\IRequestId; use OCP\ISearch; use OCP\IServerContainer; use OCP\ISession; @@ -1033,7 +1035,7 @@ class Server extends ServerContainer implements IServerContainer { : '', 'urlParams' => $urlParams, ], - $this->get(ISecureRandom::class), + $this->get(IRequestId::class), $this->get(\OCP\IConfig::class), $this->get(CsrfTokenManager::class), $stream @@ -1042,6 +1044,13 @@ class Server extends ServerContainer implements IServerContainer { /** @deprecated 19.0.0 */ $this->registerDeprecatedAlias('Request', \OCP\IRequest::class); + $this->registerService(IRequestId::class, function (ContainerInterface $c): IRequestId { + return new RequestId( + $_SERVER['UNIQUE_ID'] ?? '', + $this->get(ISecureRandom::class) + ); + }); + $this->registerService(IMailer::class, function (Server $c) { return new Mailer( $c->get(\OCP\IConfig::class), @@ -1214,7 +1223,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); $this->registerService('CryptoWrapper', function (ContainerInterface $c) { - // FIXME: Instantiiated here due to cyclic dependency + // FIXME: Instantiated here due to cyclic dependency $request = new Request( [ 'get' => $_GET, @@ -1227,7 +1236,7 @@ class Server extends ServerContainer implements IServerContainer { ? $_SERVER['REQUEST_METHOD'] : null, ], - $c->get(ISecureRandom::class), + $c->get(IRequestId::class), $c->get(\OCP\IConfig::class) ); |