aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2025-06-25 13:46:44 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2025-06-25 14:10:04 +0200
commit2a0cb8d37dbf2d95201f6beda668da8e2c69000a (patch)
tree3884db763653657e72eb47f58a481a77520b965b
parent3fa81d0dc1cffe88e5e2d8042984e0b6ee77346a (diff)
downloadnextcloud-server-chore/noid/use-same-app-id.tar.gz
nextcloud-server-chore/noid/use-same-app-id.zip
refactor(federation): omit app argument for error messageschore/noid/use-same-app-id
As federation is an app, the LoggerInterface instance is ScopedPsrLogger and will set it. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
-rw-r--r--apps/federation/lib/BackgroundJob/GetSharedSecret.php7
-rw-r--r--apps/federation/lib/BackgroundJob/RequestSharedSecret.php8
-rw-r--r--apps/federation/lib/Controller/OCSAuthAPIController.php10
-rw-r--r--apps/federation/lib/SyncJob.php1
-rw-r--r--apps/federation/lib/TrustedServers.php1
5 files changed, 11 insertions, 16 deletions
diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php
index fe3b360dd18..96b0c12c4cd 100644
--- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php
+++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php
@@ -115,9 +115,9 @@ class GetSharedSecret extends Job {
} catch (ClientException $e) {
$status = $e->getCode();
if ($status === Http::STATUS_FORBIDDEN) {
- $this->logger->info($target . ' refused to exchange a shared secret with you.', ['app' => 'federation']);
+ $this->logger->info($target . ' refused to exchange a shared secret with you.');
} else {
- $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']);
+ $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage());
}
} catch (RequestException $e) {
$status = -1; // There is no status code if we could not connect
@@ -149,8 +149,7 @@ class GetSharedSecret extends Job {
);
} else {
$this->logger->error(
- 'remote server "' . $target . '"" does not return a valid shared secret. Received data: ' . $body,
- ['app' => 'federation']
+ 'remote server "' . $target . '"" does not return a valid shared secret. Received data: ' . $body
);
$this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE);
}
diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
index cc50ee75ca0..4d57d1f6aef 100644
--- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
+++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
@@ -126,16 +126,16 @@ class RequestSharedSecret extends Job {
} catch (ClientException $e) {
$status = $e->getCode();
if ($status === Http::STATUS_FORBIDDEN) {
- $this->logger->info($target . ' refused to ask for a shared secret.', ['app' => 'federation']);
+ $this->logger->info($target . ' refused to ask for a shared secret.');
} else {
- $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']);
+ $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage());
}
} catch (RequestException $e) {
$status = -1; // There is no status code if we could not connect
- $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
+ $this->logger->info('Could not connect to ' . $target);
} catch (\Throwable $e) {
$status = Http::STATUS_INTERNAL_SERVER_ERROR;
- $this->logger->error($e->getMessage(), ['app' => 'federation', 'exception' => $e]);
+ $this->logger->error($e->getMessage(), ['exception' => $e]);
}
// if we received a unexpected response we try again later
diff --git a/apps/federation/lib/Controller/OCSAuthAPIController.php b/apps/federation/lib/Controller/OCSAuthAPIController.php
index 44725fa0dba..16b401be251 100644
--- a/apps/federation/lib/Controller/OCSAuthAPIController.php
+++ b/apps/federation/lib/Controller/OCSAuthAPIController.php
@@ -98,7 +98,7 @@ class OCSAuthAPIController extends OCSController {
public function requestSharedSecret(string $url, string $token): DataResponse {
if ($this->trustedServers->isTrustedServer($url) === false) {
$this->throttler->registerAttempt('federationSharedSecret', $this->request->getRemoteAddress());
- $this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']);
+ $this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret');
throw new OCSForbiddenException();
}
@@ -107,8 +107,7 @@ class OCSAuthAPIController extends OCSController {
$localToken = $this->dbHandler->getToken($url);
if (strcmp($localToken, $token) > 0) {
$this->logger->info(
- 'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.',
- ['app' => 'federation']
+ 'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.'
);
throw new OCSForbiddenException();
}
@@ -141,7 +140,7 @@ class OCSAuthAPIController extends OCSController {
public function getSharedSecret(string $url, string $token): DataResponse {
if ($this->trustedServers->isTrustedServer($url) === false) {
$this->throttler->registerAttempt('federationSharedSecret', $this->request->getRemoteAddress());
- $this->logger->error('remote server not trusted (' . $url . ') while getting shared secret', ['app' => 'federation']);
+ $this->logger->error('remote server not trusted (' . $url . ') while getting shared secret');
throw new OCSForbiddenException();
}
@@ -149,8 +148,7 @@ class OCSAuthAPIController extends OCSController {
$this->throttler->registerAttempt('federationSharedSecret', $this->request->getRemoteAddress());
$expectedToken = $this->dbHandler->getToken($url);
$this->logger->error(
- 'remote server (' . $url . ') didn\'t send a valid token (got "' . $token . '" but expected "' . $expectedToken . '") while getting shared secret',
- ['app' => 'federation']
+ 'remote server (' . $url . ') didn\'t send a valid token (got "' . $token . '" but expected "' . $expectedToken . '") while getting shared secret'
);
throw new OCSForbiddenException();
}
diff --git a/apps/federation/lib/SyncJob.php b/apps/federation/lib/SyncJob.php
index 21f8318f6f9..b802dfa9308 100644
--- a/apps/federation/lib/SyncJob.php
+++ b/apps/federation/lib/SyncJob.php
@@ -27,7 +27,6 @@ class SyncJob extends TimedJob {
$this->syncService->syncThemAll(function ($url, $ex): void {
if ($ex instanceof \Exception) {
$this->logger->error("Error while syncing $url.", [
- 'app' => 'fed-sync',
'exception' => $ex,
]);
}
diff --git a/apps/federation/lib/TrustedServers.php b/apps/federation/lib/TrustedServers.php
index a62ddfa1275..3b849c80f17 100644
--- a/apps/federation/lib/TrustedServers.php
+++ b/apps/federation/lib/TrustedServers.php
@@ -169,7 +169,6 @@ class TrustedServers {
}
} catch (\Exception $e) {
$this->logger->error('No Nextcloud server.', [
- 'app' => 'federation',
'exception' => $e,
]);
return false;