aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r--src/Wallabag/ImportBundle/Controller/PocketController.php6
-rw-r--r--src/Wallabag/ImportBundle/Controller/ReadabilityController.php6
-rw-r--r--src/Wallabag/ImportBundle/Controller/WallabagController.php6
-rw-r--r--src/Wallabag/ImportBundle/Import/AbstractImport.php15
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php11
-rw-r--r--src/Wallabag/ImportBundle/Import/ReadabilityImport.php11
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagImport.php11
7 files changed, 32 insertions, 34 deletions
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php
index 3d555717..1f92c182 100644
--- a/src/Wallabag/ImportBundle/Controller/PocketController.php
+++ b/src/Wallabag/ImportBundle/Controller/PocketController.php
@@ -102,6 +102,12 @@ class PocketController extends Controller
102 '%imported%' => $summary['imported'], 102 '%imported%' => $summary['imported'],
103 '%skipped%' => $summary['skipped'], 103 '%skipped%' => $summary['skipped'],
104 ]); 104 ]);
105
106 if (0 < $summary['queued']) {
107 $message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
108 '%queued%' => $summary['queued'],
109 ]);
110 }
105 } 111 }
106 112
107 $this->get('session')->getFlashBag()->add( 113 $this->get('session')->getFlashBag()->add(
diff --git a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
index 8775e8a3..d00e22c2 100644
--- a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
+++ b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php
@@ -46,6 +46,12 @@ class ReadabilityController extends Controller
46 '%skipped%' => $summary['skipped'], 46 '%skipped%' => $summary['skipped'],
47 ]); 47 ]);
48 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
49 unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); 55 unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name);
50 } 56 }
51 57
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagController.php b/src/Wallabag/ImportBundle/Controller/WallabagController.php
index 3c2dd6d1..9c0cde80 100644
--- a/src/Wallabag/ImportBundle/Controller/WallabagController.php
+++ b/src/Wallabag/ImportBundle/Controller/WallabagController.php
@@ -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
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php
index 4cd8e846..2af0e69b 100644
--- a/src/Wallabag/ImportBundle/Import/AbstractImport.php
+++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php
@@ -21,6 +21,7 @@ abstract class AbstractImport implements ImportInterface
21 protected $markAsRead; 21 protected $markAsRead;
22 protected $skippedEntries = 0; 22 protected $skippedEntries = 0;
23 protected $importedEntries = 0; 23 protected $importedEntries = 0;
24 protected $queuedEntries = 0;
24 25
25 public function __construct(EntityManager $em, ContentProxy $contentProxy) 26 public function __construct(EntityManager $em, ContentProxy $contentProxy)
26 { 27 {
@@ -145,13 +146,25 @@ abstract class AbstractImport implements ImportInterface
145 $importedEntry = $this->setEntryAsRead($importedEntry); 146 $importedEntry = $this->setEntryAsRead($importedEntry);
146 } 147 }
147 148
148 ++$this->importedEntries; 149 ++$this->queuedEntries;
149 150
150 $this->producer->publish(json_encode($importedEntry)); 151 $this->producer->publish(json_encode($importedEntry));
151 } 152 }
152 } 153 }
153 154
154 /** 155 /**
156 * {@inheritdoc}
157 */
158 public function getSummary()
159 {
160 return [
161 'skipped' => $this->skippedEntries,
162 'imported' => $this->importedEntries,
163 'queued' => $this->queuedEntries,
164 ];
165 }
166
167 /**
155 * Parse one entry. 168 * Parse one entry.
156 * 169 *
157 * @param array $importedEntry 170 * @param array $importedEntry
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index fe39d33f..cc6faf1f 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -173,17 +173,6 @@ class PocketImport extends AbstractImport
173 } 173 }
174 174
175 /** 175 /**
176 * {@inheritdoc}
177 */
178 public function getSummary()
179 {
180 return [
181 'skipped' => $this->skippedEntries,
182 'imported' => $this->importedEntries,
183 ];
184 }
185
186 /**
187 * Set the Guzzle client. 176 * Set the Guzzle client.
188 * 177 *
189 * @param Client $client 178 * @param Client $client
diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
index 8f080d38..b852f8f0 100644
--- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
+++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php
@@ -47,17 +47,6 @@ class ReadabilityImport extends AbstractImport
47 /** 47 /**
48 * {@inheritdoc} 48 * {@inheritdoc}
49 */ 49 */
50 public function getSummary()
51 {
52 return [
53 'skipped' => $this->skippedEntries,
54 'imported' => $this->importedEntries,
55 ];
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function import() 50 public function import()
62 { 51 {
63 if (!$this->user) { 52 if (!$this->user) {
diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php
index 8e50b135..969a6a04 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagImport.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php
@@ -73,17 +73,6 @@ abstract class WallabagImport extends AbstractImport
73 } 73 }
74 74
75 /** 75 /**
76 * {@inheritdoc}
77 */
78 public function getSummary()
79 {
80 return [
81 'skipped' => $this->skippedEntries,
82 'imported' => $this->importedEntries,
83 ];
84 }
85
86 /**
87 * Set file path to the json file. 76 * Set file path to the json file.
88 * 77 *
89 * @param string $filepath 78 * @param string $filepath