]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not do ETag caching when the version is updated
authorRoeland Jago Douma <roeland@famdouma.nl>
Tue, 2 May 2017 06:44:20 +0000 (08:44 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Tue, 2 May 2017 06:44:20 +0000 (08:44 +0200)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/private/App/AppStore/Fetcher/Fetcher.php

index ab0e299f0a27afb0c57c302b3d8f483fa9134b54..bde925b745f163d6108fd29a7d3497128113fb1b 100644 (file)
@@ -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) {