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/ReadabilityController.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/ReadabilityController.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Controller/ReadabilityController.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php index b61aa99c..d00e22c2 100644 --- a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php +++ b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php | |||
@@ -18,15 +18,21 @@ class ReadabilityController extends Controller | |||
18 | $form->handleRequest($request); | 18 | $form->handleRequest($request); |
19 | 19 | ||
20 | $readability = $this->get('wallabag_import.readability.import'); | 20 | $readability = $this->get('wallabag_import.readability.import'); |
21 | $readability->setUser($this->getUser()); | ||
22 | |||
23 | if ($this->get('craue_config')->get('import_with_rabbitmq')) { | ||
24 | $readability->setProducer($this->get('old_sound_rabbit_mq.import_readability_producer')); | ||
25 | } elseif ($this->get('craue_config')->get('import_with_redis')) { | ||
26 | $readability->setProducer($this->get('wallabag_import.producer.redis.readability')); | ||
27 | } | ||
21 | 28 | ||
22 | if ($form->isValid()) { | 29 | if ($form->isValid()) { |
23 | $file = $form->get('file')->getData(); | 30 | $file = $form->get('file')->getData(); |
24 | $markAsRead = $form->get('mark_as_read')->getData(); | 31 | $markAsRead = $form->get('mark_as_read')->getData(); |
25 | $name = 'readability_'.$this->getUser()->getId().'.json'; | 32 | $name = 'readability_'.$this->getUser()->getId().'.json'; |
26 | 33 | ||
27 | if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { | 34 | if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { |
28 | $res = $readability | 35 | $res = $readability |
29 | ->setUser($this->getUser()) | ||
30 | ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) | 36 | ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) |
31 | ->setMarkAsRead($markAsRead) | 37 | ->setMarkAsRead($markAsRead) |
32 | ->import(); | 38 | ->import(); |
@@ -40,6 +46,12 @@ class ReadabilityController extends Controller | |||
40 | '%skipped%' => $summary['skipped'], | 46 | '%skipped%' => $summary['skipped'], |
41 | ]); | 47 | ]); |
42 | 48 | ||
49 | if (0 < $summary['queued']) { | ||
50 | $message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [ | ||
51 | '%queued%' => $summary['queued'], | ||
52 | ]); | ||
53 | } | ||
54 | |||
43 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); | 55 | unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); |
44 | } | 56 | } |
45 | 57 | ||