]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add back appstoreenabled config switch
authorSteffen Lindner <mail@steffen-lindner.de>
Thu, 26 Jan 2017 18:02:45 +0000 (19:02 +0100)
committerJoas Schilling <coding@schilljs.com>
Fri, 24 Feb 2017 07:31:56 +0000 (08:31 +0100)
Signed-off-by: Steffen Lindner <mail@steffen-lindner.de>
lib/private/App/AppStore/Fetcher/Fetcher.php

index dab79e11821dd5bb43cd7118f67d0bf20142c1d0..7f38e72be2ddb6bea18ec3a97f057694aa3e43e9 100644 (file)
@@ -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'];
                                }