summaryrefslogtreecommitdiffstats
path: root/lib/private/App/AppStore/Fetcher/Fetcher.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/App/AppStore/Fetcher/Fetcher.php')
-rw-r--r--lib/private/App/AppStore/Fetcher/Fetcher.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php
index bde925b745f..5354d334eb1 100644
--- a/lib/private/App/AppStore/Fetcher/Fetcher.php
+++ b/lib/private/App/AppStore/Fetcher/Fetcher.php
@@ -43,6 +43,8 @@ abstract class Fetcher {
protected $fileName;
/** @var string */
protected $endpointUrl;
+ /** @var string */
+ protected $version;
/**
* @param IAppData $appData
@@ -95,7 +97,7 @@ abstract class Fetcher {
}
$responseJson['timestamp'] = $this->timeFactory->getTime();
- $responseJson['ncversion'] = $this->config->getSystemValue('version');
+ $responseJson['ncversion'] = $this->getVersion();
if ($ETag !== '') {
$responseJson['ETag'] = $ETag;
}
@@ -127,7 +129,7 @@ abstract class Fetcher {
if (is_array($jsonBlob)) {
// No caching when the version has been updated
- if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->config->getSystemValue('version', '0.0.0')) {
+ if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->getVersion()) {
// If the timestamp is older than 300 seconds request the files new
if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS)) {
@@ -154,4 +156,23 @@ abstract class Fetcher {
return [];
}
}
+
+ /**
+ * Get the currently Nextcloud version
+ * @return string
+ */
+ protected function getVersion() {
+ if ($this->version === null) {
+ $this->version = $this->config->getSystemValue('version', '0.0.0');
+ }
+ return $this->version;
+ }
+
+ /**
+ * Set the current Nextcloud version
+ * @param string $version
+ */
+ public function setVersion($version) {
+ $this->version = $version;
+ }
}