diff options
Diffstat (limited to 'lib/private/Updater/ChangesCheck.php')
-rw-r--r-- | lib/private/Updater/ChangesCheck.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php index 2dd18467cd9..8700b9609d2 100644 --- a/lib/private/Updater/ChangesCheck.php +++ b/lib/private/Updater/ChangesCheck.php @@ -70,7 +70,7 @@ class ChangesCheck { try { $version = $this->normalizeVersion($version); $changesInfo = $this->mapper->getChanges($version); - if($changesInfo->getLastCheck() + 1800 > time()) { + if ($changesInfo->getLastCheck() + 1800 > time()) { return json_decode($changesInfo->getData(), true); } } catch (DoesNotExistException $e) { @@ -79,7 +79,7 @@ class ChangesCheck { $response = $this->queryChangesServer($uri, $changesInfo); - switch($this->evaluateResponse($response)) { + switch ($this->evaluateResponse($response)) { case self::RESPONSE_NO_CONTENT: return []; case self::RESPONSE_USE_CACHE: @@ -96,11 +96,11 @@ class ChangesCheck { } protected function evaluateResponse(IResponse $response): int { - if($response->getStatusCode() === 304) { + if ($response->getStatusCode() === 304) { return self::RESPONSE_USE_CACHE; - } elseif($response->getStatusCode() === 404) { + } elseif ($response->getStatusCode() === 404) { return self::RESPONSE_NO_CONTENT; - } elseif($response->getStatusCode() === 200) { + } elseif ($response->getStatusCode() === 200) { return self::RESPONSE_HAS_CONTENT; } $this->logger->debug('Unexpected return code {code} from changelog server', [ @@ -111,7 +111,7 @@ class ChangesCheck { } protected function cacheResult(ChangesResult $entry, string $version) { - if($entry->getVersion() === $version) { + if ($entry->getVersion() === $version) { $this->mapper->update($entry); } else { $entry->setVersion($version); @@ -124,7 +124,7 @@ class ChangesCheck { */ protected function queryChangesServer(string $uri, ChangesResult $entry): IResponse { $headers = []; - if($entry->getEtag() !== '') { + if ($entry->getEtag() !== '') { $headers['If-None-Match'] = [$entry->getEtag()]; } @@ -144,7 +144,7 @@ class ChangesCheck { if ($xml !== false) { $data['changelogURL'] = (string)$xml->changelog['href']; $data['whatsNew'] = []; - foreach($xml->whatsNew as $infoSet) { + foreach ($xml->whatsNew as $infoSet) { $data['whatsNew'][(string)$infoSet['lang']] = [ 'regular' => (array)$infoSet->regular->item, 'admin' => (array)$infoSet->admin->item, @@ -164,7 +164,7 @@ class ChangesCheck { public function normalizeVersion(string $version): string { $versionNumbers = array_slice(explode('.', $version), 0, 3); $versionNumbers[0] = $versionNumbers[0] ?: '0'; // deal with empty input - while(count($versionNumbers) < 3) { + while (count($versionNumbers) < 3) { // changelog server expects x.y.z, pad 0 if it is too short $versionNumbers[] = 0; } |