]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Updater.php
Make max download size and timeout configurable
[github/shaarli/Shaarli.git] / application / Updater.php
index bc859536f61a846d9a5923e03f35ea33e9fae77d..dece2c020d297fdf13bf8773b76cb37895328025 100644 (file)
@@ -443,6 +443,45 @@ class Updater
     public function updateMethodReorderDatastore()
     {
         $this->linkDB->save($this->conf->get('resource.page_cache'));
+        return true;
+    }
+
+    /**
+     * Change privateonly session key to visibility.
+     */
+    public function updateMethodVisibilitySession()
+    {
+        if (isset($_SESSION['privateonly'])) {
+            unset($_SESSION['privateonly']);
+            $_SESSION['visibility'] = 'private';
+        }
+        return true;
+    }
+
+    /**
+     * Add download size and timeout to the configuration file
+     *
+     * @return bool true if the update is successful, false otherwise.
+     */
+    public function updateMethodDownloadSizeAndTimeoutConf()
+    {
+        if ($this->conf->exists('general.download_max_size')
+            && $this->conf->exists('general.download_timeout')
+        ) {
+            return true;
+        }
+
+        if (! $this->conf->exists('general.download_max_size')) {
+            $this->conf->set('general.download_max_size', 1024*1024*4);
+        }
+
+        if (! $this->conf->exists('general.download_timeout')) {
+            $this->conf->set('general.download_timeout', 30);
+        }
+
+        $this->conf->write($this->isLoggedIn);
+
+        return true;
     }
 }