diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-05-02 10:08:16 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-05-02 10:24:10 +0200 |
commit | e79424932a249b0e1568722ec0d709cd79a385ce (patch) | |
tree | b3a5f9ec23d1252960662c3fa1515096fdded0ba /lib/private/App/AppStore/Fetcher/Fetcher.php | |
parent | 81ee0673a51ae2fe0a0b14420dce9e7337eb1425 (diff) | |
download | nextcloud-server-e79424932a249b0e1568722ec0d709cd79a385ce.tar.gz nextcloud-server-e79424932a249b0e1568722ec0d709cd79a385ce.zip |
Make sure the AppFetcher fetches the new applist from the appstore
When in the upgrade process the version in the config is still the old
version. (Since we only upgrade it after the upgrade is complete).
However the app list fetched from the appstore must be the new list.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/App/AppStore/Fetcher/Fetcher.php')
-rw-r--r-- | lib/private/App/AppStore/Fetcher/Fetcher.php | 25 |
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; + } } |