diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-05-02 08:44:20 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-05-02 08:44:20 +0200 |
commit | 095463d5685daf1f00a20f0c5caccfa7ebbc62e7 (patch) | |
tree | 601899c7b49561a09de4ab7803749f38518a4e25 /lib | |
parent | f27d382c4775d1a47ca8d81a987fd82b79cf05c9 (diff) | |
download | nextcloud-server-095463d5685daf1f00a20f0c5caccfa7ebbc62e7.tar.gz nextcloud-server-095463d5685daf1f00a20f0c5caccfa7ebbc62e7.zip |
Do not do ETag caching when the version is updated
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/AppStore/Fetcher/Fetcher.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index ab0e299f0a2..bde925b745f 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -125,19 +125,19 @@ abstract class Fetcher { $file = $rootFolder->getFile($this->fileName); $jsonBlob = json_decode($file->getContent(), true); if (is_array($jsonBlob)) { - /* - * If the timestamp is older than 300 seconds request the files new - * If the version changed (update!) also refresh - */ - if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS) && - isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->config->getSystemValue('version', '0.0.0') - ) { - return $jsonBlob['data']; - } - if (isset($jsonBlob['ETag'])) { - $ETag = $jsonBlob['ETag']; - $content = json_encode($jsonBlob['data']); + // No caching when the version has been updated + if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->config->getSystemValue('version', '0.0.0')) { + + // If the timestamp is older than 300 seconds request the files new + if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS)) { + return $jsonBlob['data']; + } + + if (isset($jsonBlob['ETag'])) { + $ETag = $jsonBlob['ETag']; + $content = json_encode($jsonBlob['data']); + } } } } catch (NotFoundException $e) { |