]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Updater.php
namespacing: \Shaarli\Bookmark\LinkDB
[github/shaarli/Shaarli.git] / application / Updater.php
index 480bff8267956ad82e12d3a4169e7b09f60ee135..043ecf682d5a5dadd3cdf0566bb2e7cb59e297c7 100644 (file)
@@ -1,7 +1,10 @@
 <?php
+
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigJson;
 use Shaarli\Config\ConfigPhp;
 use Shaarli\Config\ConfigManager;
+use Shaarli\Exceptions\IOException;
 use Shaarli\Thumbnailer;
 
 /**
@@ -183,7 +186,7 @@ class Updater
             }
         }
 
-        try{
+        try {
             $this->conf->write($this->isLoggedIn);
             return true;
         } catch (IOException $e) {
@@ -517,6 +520,26 @@ class Updater
 
         return true;
     }
+
+    /**
+     * Set sticky = false on all links
+     *
+     * @return bool true if the update is successful, false otherwise.
+     */
+    public function updateMethodSetSticky()
+    {
+        foreach ($this->linkDB as $key => $link) {
+            if (isset($link['sticky'])) {
+                return true;
+            }
+            $link['sticky'] = false;
+            $this->linkDB[$key] = $link;
+        }
+
+        $this->linkDB->save($this->conf->get('resource.page_cache'));
+
+        return true;
+    }
 }
 
 /**