|
@@ -60,7 +60,7 @@ discard block |
|
|
block discarded – undo |
|
60
|
60
|
*/ |
|
61
|
61
|
protected function fetch($ETag, $content, $allowUnstable = false) { |
|
62
|
62
|
$appstoreenabled = $this->config->getSystemValueBool('appstoreenabled', true); |
|
63
|
|
- if ((int)$this->config->getAppValue('settings', 'appstore-fetcher-lastFailure', '0') > time() - self::RETRY_AFTER_FAILURE_SECONDS) { |
|
|
63
|
+ if ((int) $this->config->getAppValue('settings', 'appstore-fetcher-lastFailure', '0') > time() - self::RETRY_AFTER_FAILURE_SECONDS) { |
|
64
|
64
|
return []; |
|
65
|
65
|
} |
|
66
|
66
|
|
|
@@ -69,7 +69,7 @@ discard block |
|
|
block discarded – undo |
|
69
|
69
|
} |
|
70
|
70
|
|
|
71
|
71
|
$options = [ |
|
72
|
|
- 'timeout' => (int)$this->config->getAppValue('settings', 'appstore-timeout', '120') |
|
|
72
|
+ 'timeout' => (int) $this->config->getAppValue('settings', 'appstore-timeout', '120') |
|
73
|
73
|
]; |
|
74
|
74
|
|
|
75
|
75
|
if ($ETag !== '') { |
|
@@ -90,8 +90,8 @@ discard block |
|
|
block discarded – undo |
|
90
|
90
|
$client = $this->clientService->newClient(); |
|
91
|
91
|
try { |
|
92
|
92
|
$response = $client->get($this->getEndpoint(), $options); |
|
93
|
|
- } catch (ConnectException|ClientException|ServerException $e) { |
|
94
|
|
- $this->config->setAppValue('settings', 'appstore-fetcher-lastFailure', (string)time()); |
|
|
93
|
+ } catch (ConnectException | ClientException | ServerException $e) { |
|
|
94
|
+ $this->config->setAppValue('settings', 'appstore-fetcher-lastFailure', (string) time()); |
|
95
|
95
|
$this->logger->error('Failed to connect to the app store', ['exception' => $e]); |
|
96
|
96
|
return []; |
|
97
|
97
|
} |
|
@@ -150,7 +150,7 @@ discard block |
|
|
block discarded – undo |
|
150
|
150
|
$invalidateAfterSeconds = self::INVALIDATE_AFTER_SECONDS_UNSTABLE; |
|
151
|
151
|
} |
|
152
|
152
|
|
|
153
|
|
- if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - $invalidateAfterSeconds)) { |
|
|
153
|
+ if ((int) $jsonBlob['timestamp'] > ($this->timeFactory->getTime() - $invalidateAfterSeconds)) { |
|
154
|
154
|
return $jsonBlob['data']; |
|
155
|
155
|
} |
|
156
|
156
|
|
|
@@ -176,7 +176,7 @@ discard block |
|
|
block discarded – undo |
|
176
|
176
|
$file->putContent(json_encode($responseJson)); |
|
177
|
177
|
return json_decode($file->getContent(), true)['data']; |
|
178
|
178
|
} catch (ConnectException $e) { |
|
179
|
|
- $this->logger->warning('Could not connect to appstore: ' . $e->getMessage(), ['app' => 'appstoreFetcher']); |
|
|
179
|
+ $this->logger->warning('Could not connect to appstore: '.$e->getMessage(), ['app' => 'appstoreFetcher']); |
|
180
|
180
|
return []; |
|
181
|
181
|
} catch (\Exception $e) { |
|
182
|
182
|
$this->logger->warning($e->getMessage(), [ |
|
@@ -226,6 +226,6 @@ discard block |
|
|
block discarded – undo |
|
226
|
226
|
} |
|
227
|
227
|
|
|
228
|
228
|
protected function getEndpoint(): string { |
|
229
|
|
- return $this->config->getSystemValueString('appstoreurl', 'https://apps.nextcloud.com/api/v1') . '/' . $this->endpointName; |
|
|
229
|
+ return $this->config->getSystemValueString('appstoreurl', 'https://apps.nextcloud.com/api/v1').'/'.$this->endpointName; |
|
230
|
230
|
} |
|
231
|
231
|
} |