@@ -24,7 +24,7 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | protected function run($argument) { |
27 | - $this->syncService->syncThemAll(function ($url, $ex): void { |
|
27 | + $this->syncService->syncThemAll(function($url, $ex): void { |
|
28 | 28 | if ($ex instanceof \Exception) { |
29 | 29 | $this->logger->error("Error while syncing $url.", [ |
30 | 30 | 'exception' => $ex, |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | protected function run($argument) { |
88 | 88 | $target = $argument['url']; |
89 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); |
|
89 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); |
|
90 | 90 | $currentTime = $this->time->getTime(); |
91 | 91 | $source = $this->urlGenerator->getAbsoluteURL('/'); |
92 | 92 | $source = rtrim($source, '/'); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $endPoint = $endPoints['shared-secret'] ?? $this->defaultEndPoint; |
106 | 106 | |
107 | 107 | // make sure that we have a well formatted url |
108 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/'); |
|
108 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/'); |
|
109 | 109 | |
110 | 110 | try { |
111 | 111 | $result = $this->httpClient->post( |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | } catch (ClientException $e) { |
127 | 127 | $status = $e->getCode(); |
128 | 128 | if ($status === Http::STATUS_FORBIDDEN) { |
129 | - $this->logger->info($target . ' refused to ask for a shared secret.'); |
|
129 | + $this->logger->info($target.' refused to ask for a shared secret.'); |
|
130 | 130 | } else { |
131 | - $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage()); |
|
131 | + $this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage()); |
|
132 | 132 | } |
133 | 133 | } catch (RequestException $e) { |
134 | 134 | $status = -1; // There is no status code if we could not connect |
135 | - $this->logger->info('Could not connect to ' . $target); |
|
135 | + $this->logger->info('Could not connect to '.$target); |
|
136 | 136 | } catch (\Throwable $e) { |
137 | 137 | $status = Http::STATUS_INTERNAL_SERVER_ERROR; |
138 | 138 | $this->logger->error($e->getMessage(), ['exception' => $e]); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function reAddJob(array $argument): void { |
154 | 154 | $url = $argument['url']; |
155 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); |
|
155 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); |
|
156 | 156 | $token = $argument['token']; |
157 | 157 | $attempt = $this->getAttempt($argument) + 1; |
158 | 158 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | protected function run($argument) { |
75 | 75 | $target = $argument['url']; |
76 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); |
|
76 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); |
|
77 | 77 | $currentTime = $this->time->getTime(); |
78 | 78 | $source = $this->urlGenerator->getAbsoluteURL('/'); |
79 | 79 | $source = rtrim($source, '/'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $endPoint = $endPoints['shared-secret'] ?? $this->defaultEndPoint; |
93 | 93 | |
94 | 94 | // make sure that we have a well formatted url |
95 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/'); |
|
95 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/'); |
|
96 | 96 | |
97 | 97 | $result = null; |
98 | 98 | try { |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } catch (ClientException $e) { |
116 | 116 | $status = $e->getCode(); |
117 | 117 | if ($status === Http::STATUS_FORBIDDEN) { |
118 | - $this->logger->info($target . ' refused to exchange a shared secret with you.'); |
|
118 | + $this->logger->info($target.' refused to exchange a shared secret with you.'); |
|
119 | 119 | } else { |
120 | - $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage()); |
|
120 | + $this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage()); |
|
121 | 121 | } |
122 | 122 | } catch (RequestException $e) { |
123 | 123 | $status = -1; // There is no status code if we could not connect |
124 | - $this->logger->info('Could not connect to ' . $target, [ |
|
124 | + $this->logger->info('Could not connect to '.$target, [ |
|
125 | 125 | 'exception' => $e, |
126 | 126 | ]); |
127 | 127 | } catch (\Throwable $e) { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | ); |
150 | 150 | } else { |
151 | 151 | $this->logger->error( |
152 | - 'remote server "' . $target . '"" does not return a valid shared secret. Received data: ' . $body |
|
152 | + 'remote server "'.$target.'"" does not return a valid shared secret. Received data: '.$body |
|
153 | 153 | ); |
154 | 154 | $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
155 | 155 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public function requestSharedSecret(string $url, string $token): DataResponse { |
99 | 99 | if ($this->trustedServers->isTrustedServer($url) === false) { |
100 | 100 | $this->throttler->registerAttempt('federationSharedSecret', $this->request->getRemoteAddress()); |
101 | - $this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret'); |
|
101 | + $this->logger->error('remote server not trusted ('.$url.') while requesting shared secret'); |
|
102 | 102 | throw new OCSForbiddenException(); |
103 | 103 | } |
104 | 104 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $localToken = $this->dbHandler->getToken($url); |
108 | 108 | if (strcmp($localToken, $token) > 0) { |
109 | 109 | $this->logger->info( |
110 | - 'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.' |
|
110 | + 'remote server ('.$url.') presented lower token. We will initiate the exchange of the shared secret.' |
|
111 | 111 | ); |
112 | 112 | throw new OCSForbiddenException(); |
113 | 113 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | public function getSharedSecret(string $url, string $token): DataResponse { |
141 | 141 | if ($this->trustedServers->isTrustedServer($url) === false) { |
142 | 142 | $this->throttler->registerAttempt('federationSharedSecret', $this->request->getRemoteAddress()); |
143 | - $this->logger->error('remote server not trusted (' . $url . ') while getting shared secret'); |
|
143 | + $this->logger->error('remote server not trusted ('.$url.') while getting shared secret'); |
|
144 | 144 | throw new OCSForbiddenException(); |
145 | 145 | } |
146 | 146 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->throttler->registerAttempt('federationSharedSecret', $this->request->getRemoteAddress()); |
149 | 149 | $expectedToken = $this->dbHandler->getToken($url); |
150 | 150 | $this->logger->error( |
151 | - 'remote server (' . $url . ') didn\'t send a valid token (got "' . $token . '" but expected "' . $expectedToken . '") while getting shared secret' |
|
151 | + 'remote server ('.$url.') didn\'t send a valid token (got "'.$token.'" but expected "'.$expectedToken.'") while getting shared secret' |
|
152 | 152 | ); |
153 | 153 | throw new OCSForbiddenException(); |
154 | 154 | } |