Skip to content
Snippets Groups Projects
Unverified Commit cfb6223d authored by Steffen Lindner's avatar Steffen Lindner Committed by Joas Schilling
Browse files

Add back appstoreenabled config switch

parent 97b6c149
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,14 @@ abstract class Fetcher {
* @return array
*/
protected function fetch($ETag, $content) {
$systemConfig = \OC::$server->getSystemConfig();
$appstoreenabled = $systemConfig->getValue('appstoreenabled', true);
if (!$appstoreenabled) {
return [];
}
$options = [];
if ($ETag !== '') {
......@@ -102,7 +110,14 @@ abstract class Fetcher {
*
* @return array
*/
public function get() {
public function get() {
$systemConfig = \OC::$server->getSystemConfig();
$appstoreenabled = $systemConfig->getValue('appstoreenabled', true);
if (!$appstoreenabled) {
return [];
}
$rootFolder = $this->appData->getFolder('/');
$ETag = '';
......@@ -112,13 +127,14 @@ abstract class Fetcher {
// File does already exists
$file = $rootFolder->getFile($this->fileName);
$jsonBlob = json_decode($file->getContent(), true);
if(is_array($jsonBlob)) {
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')) {
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'];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment