X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FController%2FWallabagV1Controller.php;h=154a0769b0ac4688008e4f012b08499f28d28dda;hb=e68568cd5bc70298f1ea712b5b203635bd9d15b5;hp=e50a6c35a8f3bd6b25896a1a05efe1d0e44500d8;hpb=39643c6b76d92d509b1af0228b6379d7fdce8a1c;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php index e50a6c35..154a0769 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php @@ -14,22 +14,25 @@ class WallabagV1Controller extends Controller */ public function indexAction(Request $request) { - $form = $this->createForm(new UploadImportType()); + $form = $this->createForm(UploadImportType::class); $form->handleRequest($request); $wallabag = $this->get('wallabag_import.wallabag_v1.import'); if ($form->isValid()) { $file = $form->get('file')->getData(); + $markAsRead = $form->get('mark_as_read')->getData(); $name = $this->getUser()->getId().'.json'; if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { $res = $wallabag ->setUser($this->getUser()) ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) + ->setMarkAsRead($markAsRead) ->import(); $message = 'Import failed, please try again.'; + if (true === $res) { $summary = $wallabag->getSummary(); $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.';