]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/EntryController.php
Ability to reload an entry
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / EntryController.php
index 2f3fd6a9348ab6ec26c0ae1b301de95610e3778b..041fe71ca77af8166e7787d1202c157af4af340d 100644 (file)
@@ -266,6 +266,33 @@ class EntryController extends Controller
         );
     }
 
+    /**
+     * Reload an entry.
+     * Refetch content from the website and make it readable again.
+     *
+     * @param Entry $entry
+     *
+     * @Route("/reload/{id}", requirements={"id" = "\d+"}, name="reload_entry")
+     *
+     * @return \Symfony\Component\HttpFoundation\RedirectResponse
+     */
+    public function reloadAction(Entry $entry)
+    {
+        $this->checkUserAction($entry);
+
+        $message = 'Entry reloaded';
+        if (false === $this->updateEntry($entry)) {
+            $message = 'Failed to reload entry';
+        }
+
+        $this->get('session')->getFlashBag()->add(
+            'notice',
+            $message
+        );
+
+        return $this->redirect($this->generateUrl('view', array('id' => $entry->getId())));
+    }
+
     /**
      * Changes read status for an entry.
      *