diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-09-19 07:15:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-19 07:15:40 +0200 |
commit | da18a4682f124b02278860d23ac1d59dee995277 (patch) | |
tree | eabbe9da7203eea41e0cb0ec3c26b9b6599cf58f /src/Wallabag/ImportBundle/Controller/WallabagController.php | |
parent | 0ed8ce55b5caf2c88e8330afa83abef6c4aac9a4 (diff) | |
parent | 59b97fae996d8307b9d957d210d46200f6d206bf (diff) | |
download | wallabag-da18a4682f124b02278860d23ac1d59dee995277.tar.gz wallabag-da18a4682f124b02278860d23ac1d59dee995277.tar.zst wallabag-da18a4682f124b02278860d23ac1d59dee995277.zip |
Merge pull request #1941 from wallabag/v2-asynchronous-jobs
Use asynchronous jobs for imports
Diffstat (limited to 'src/Wallabag/ImportBundle/Controller/WallabagController.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Controller/WallabagController.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagController.php b/src/Wallabag/ImportBundle/Controller/WallabagController.php index 76ced0d2..9c0cde80 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagController.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagController.php | |||
@@ -38,15 +38,15 @@ abstract class WallabagController extends Controller | |||
38 | $form->handleRequest($request); | 38 | $form->handleRequest($request); |
39 | 39 | ||
40 | $wallabag = $this->getImportService(); | 40 | $wallabag = $this->getImportService(); |
41 | $wallabag->setUser($this->getUser()); | ||
41 | 42 | ||
42 | if ($form->isValid()) { | 43 | if ($form->isValid()) { |
43 | $file = $form->get('file')->getData(); | 44 | $file = $form->get('file')->getData(); |
44 | $markAsRead = $form->get('mark_as_read')->getData(); | 45 | $markAsRead = $form->get('mark_as_read')->getData(); |
45 | $name = $this->getUser()->getId().'.json'; | 46 | $name = $this->getUser()->getId().'.json'; |
46 | 47 | ||
47 | if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { | 48 | if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { |
48 | $res = $wallabag | 49 | $res = $wallabag |
49 | ->setUser($this->getUser()) | ||
50 | ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) | 50 | ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) |
51 | ->setMarkAsRead($markAsRead) | 51 | ->setMarkAsRead($markAsRead) |
52 | ->import(); | 52 | ->import(); |
@@ -60,6 +60,12 @@ abstract class WallabagController extends Controller | |||
60 | '%skipped%' => $summary['skipped'], | 60 | '%skipped%' => $summary['skipped'], |
61 | ]); | 61 | ]); |
62 | 62 | ||
63 | if (0 < $summary['queued']) { | ||
64 | $message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [ | ||
65 | '%queued%' => $summary['queued'], | ||
66 | ]); | ||
67 | } | ||
68 | |||
63 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); | 69 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); |
64 | } | 70 | } |
65 | 71 | ||