aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/config/config.yml13
-rw-r--r--docs/de/user/import.rst46
-rw-r--r--docs/en/user/import.rst16
-rw-r--r--docs/fr/user/import.rst16
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml25
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml4
-rw-r--r--src/Wallabag/ImportBundle/Command/ImportCommand.php5
-rw-r--r--src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/ImportController.php2
-rw-r--r--src/Wallabag/ImportBundle/Controller/PinboardController.php77
-rw-r--r--src/Wallabag/ImportBundle/Import/PinboardImport.php143
-rw-r--r--src/Wallabag/ImportBundle/Resources/config/rabbit.yml8
-rw-r--r--src/Wallabag/ImportBundle/Resources/config/redis.yml21
-rw-r--r--src/Wallabag/ImportBundle/Resources/config/services.yml11
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/Pinboard/index.html.twig45
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php197
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/pinboard_export5
29 files changed, 672 insertions, 10 deletions
diff --git a/app/config/config.yml b/app/config/config.yml
index 0dc5809a..168634cf 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -256,6 +256,11 @@ old_sound_rabbit_mq:
256 exchange_options: 256 exchange_options:
257 name: 'wallabag.import.readability' 257 name: 'wallabag.import.readability'
258 type: topic 258 type: topic
259 import_pinboard:
260 connection: default
261 exchange_options:
262 name: 'wallabag.import.pinboard'
263 type: topic
259 import_instapaper: 264 import_instapaper:
260 connection: default 265 connection: default
261 exchange_options: 266 exchange_options:
@@ -306,6 +311,14 @@ old_sound_rabbit_mq:
306 queue_options: 311 queue_options:
307 name: 'wallabag.import.instapaper' 312 name: 'wallabag.import.instapaper'
308 callback: wallabag_import.consumer.amqp.instapaper 313 callback: wallabag_import.consumer.amqp.instapaper
314 import_pinboard:
315 connection: default
316 exchange_options:
317 name: 'wallabag.import.pinboard'
318 type: topic
319 queue_options:
320 name: 'wallabag.import.pinboard'
321 callback: wallabag_import.consumer.amqp.pinboard
309 import_wallabag_v1: 322 import_wallabag_v1:
310 connection: default 323 connection: default
311 exchange_options: 324 exchange_options:
diff --git a/docs/de/user/import.rst b/docs/de/user/import.rst
index ecd3134b..aeedb0dd 100644
--- a/docs/de/user/import.rst
+++ b/docs/de/user/import.rst
@@ -30,15 +30,51 @@ Du musst wallabag erlauben, mit deinem Pocketaccount zu interagieren.
30Deine Daten werden importiert. Datenimport kann ein sehr anspruchsvoller Prozess für deinen Server 30Deine Daten werden importiert. Datenimport kann ein sehr anspruchsvoller Prozess für deinen Server
31sein (wir müssen daran arbeiten, um diesen Import zu verbessern). 31sein (wir müssen daran arbeiten, um diesen Import zu verbessern).
32 32
33Von Instapaper 33Von Readability
34-------------- 34----------------
35 35
36*Funktion noch nicht implementiert in wallabag v2.* 36Exportiere deine Readability Daten
37~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 38
38Von Readability 39Auf der Seite Tools (`https://www.readability.com/tools/ <https://www.readability.com/tools/>`_), klicke auf "Exportiere deine Daten" in dem Abschnitt "Daten Export". Du wirst eine E-Mail empfangen, um eine JSON Datei herunterladen zu können (Datei endet aber nicht auf .json).
40
41Importiere deine Daten in wallabag 2.x
42~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43
44Klicke auf den ``Importieren`` Link im Menü, auf ``Importiere Inhalte`` in dem Readability Abschnitt und wähle dann deine JSON Datei aus und lade sie hoch.
45
46Deine Daten werden importiert. Der Datenimport can ein beanspruchender Prozess für deinen Server sein.
47
48Von Pinboard
49-------------
50
51Exportiere deine Pinboard Daten
52~~~~~~~~~~~~~~~~~~~~~~~~~
53
54Auf der Seite Backup (`https://pinboard.in/settings/backup <https://pinboard.in/settings/backup>`_), klicke auf "JSON" in dem Abschnitt "Lesezeichen". Eine JSON Datei wird heruntergeladen (z.B. ``pinboard_export``).
55
56Importiere deine Daten in wallabag 2.x
57~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
59Klicke auf den ``Importieren`` Link im Menü, auf ``Importiere Inhalte`` in dem Pinboard Abschnitt und wähle dann deine JSON Datei aus und lade sie hoch.
60
61Deine Daten werden importiert. Der Datenimport can ein beanspruchender Prozess für deinen Server sein.
62
63Von Instapaper
39--------------- 64---------------
40 65
41*Funktion noch nicht implementiert in wallabag v2.* 66Exportiere deine Instapaper Daten
67~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68
69Auf der Seite Einstellungen (`https://www.instapaper.com/user <https://www.instapaper.com/user>`_), klicke auf "Download .CSV Datei" in dem Abschnitt "Export". Eine CSV Datei wird heruntergeladen (z.B. ``instapaper-export.csv``).
70
71Importiere deine Daten in wallabag 2.x
72~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73
74Klicke auf den ``Importieren`` Link im Menü, auf ``Importiere Inhalte`` in dem Instapaper Abschnitt und wähle dann deine JSON Datei aus und lade sie hoch.
75
76Deine Daten werden importiert. Der Datenimport can ein beanspruchender Prozess für deinen Server sein.
77
42 78
43Von einer HTML oder JSON Datei 79Von einer HTML oder JSON Datei
44------------------------------ 80------------------------------
diff --git a/docs/en/user/import.rst b/docs/en/user/import.rst
index 70f0187d..cde2ecd6 100644
--- a/docs/en/user/import.rst
+++ b/docs/en/user/import.rst
@@ -45,6 +45,22 @@ and then select your json file and upload it.
45 45
46Your data will be imported. Data import can be a demanding process for your server. 46Your data will be imported. Data import can be a demanding process for your server.
47 47
48From Pinboard
49-------------
50
51Export your Pinboard data
52~~~~~~~~~~~~~~~~~~~~~~~~~
53
54On the backup (`https://pinboard.in/settings/backup <https://pinboard.in/settings/backup>`_) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like ``pinboard_export``).
55
56Import your data into wallabag 2.x
57~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
59Click on ``Import`` link in the menu, on ``Import contents`` in Pinboard section
60and then select your json file and upload it.
61
62Your data will be imported. Data import can be a demanding process for your server.
63
48From Instapaper 64From Instapaper
49--------------- 65---------------
50 66
diff --git a/docs/fr/user/import.rst b/docs/fr/user/import.rst
index 2e6caafb..d0663cf6 100644
--- a/docs/fr/user/import.rst
+++ b/docs/fr/user/import.rst
@@ -46,6 +46,22 @@ la section Readability et ensuite sélectionnez votre fichier json pour l'upload
46 46
47Vos données vont être importées. L'import de données est une action qui peut être couteuse pour votre serveur. 47Vos données vont être importées. L'import de données est une action qui peut être couteuse pour votre serveur.
48 48
49Depuis Pinboard
50---------------
51
52Exportez vos données de Pinboard
53~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54
55Sur la page « Backup » (`https://pinboard.in/settings/backup <https://pinboard.in/settings/backup>`_), cliquez sur « JSON » dans la section « Bookmarks ». Un fichier json (sans extension) sera téléchargé (``pinboard_export``).
56
57Importez vos données dans wallabag 2.x
58~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
60Cliquez sur le lien ``Importer`` dans le menu, sur ``Importer les contenus`` dans
61la section Pinboard et ensuite sélectionnez votre fichier json pour l'uploader.
62
63Vos données vont être importées. L'import de données est une action qui peut être couteuse pour votre serveur.
64
49Depuis Instapaper 65Depuis Instapaper
50----------------- 66-----------------
51 67
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index aeae6bcf..14b528f9 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -381,6 +381,10 @@ import:
381 # page_title: 'Import > Instapaper' 381 # page_title: 'Import > Instapaper'
382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").' 382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").'
383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' 383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.'
384 pinboard:
385 # page_title: "Import > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 # page_title: 'Developer' 390 # page_title: 'Developer'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 2105d02d..5eae8b86 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -381,6 +381,10 @@ import:
381 page_title: 'Aus Instapaper importieren' 381 page_title: 'Aus Instapaper importieren'
382 description: 'Dieser Import wird all deine Instapaper Artikel importieren. Auf der Einstellungsseite (https://www.instapaper.com/user) klickst du auf "Download .CSV Datei" in dem Abschnitt "Export". Eine CSV Datei wird heruntergeladen (z.B. "instapaper-export.csv").' 382 description: 'Dieser Import wird all deine Instapaper Artikel importieren. Auf der Einstellungsseite (https://www.instapaper.com/user) klickst du auf "Download .CSV Datei" in dem Abschnitt "Export". Eine CSV Datei wird heruntergeladen (z.B. "instapaper-export.csv").'
383 how_to: "Bitte wähle deine Instapaper Sicherungsdatei aus und klicke den nachfolgenden Button zum Importieren." 383 how_to: "Bitte wähle deine Instapaper Sicherungsdatei aus und klicke den nachfolgenden Button zum Importieren."
384 pinboard:
385 page_title: "Aus Pinboard importieren"
386 description: 'Dieser Import wird all deine Pinboard Artikel importieren. Auf der Seite Backup (https://pinboard.in/settings/backup) klickst du auf "JSON" in dem Abschnitt "Lesezeichen". Eine JSON Datei wird dann heruntergeladen (z.B. "pinboard_export").'
387 how_to: 'Bitte wähle deinen Pinboard Export aus und klicke den nachfolgenden Button zum Importieren.'
384 388
385developer: 389developer:
386 page_title: 'Entwickler' 390 page_title: 'Entwickler'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 2bb95728..45d7fd8c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -381,6 +381,10 @@ import:
381 page_title: 'Import > Instapaper' 381 page_title: 'Import > Instapaper'
382 description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").' 382 description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").'
383 how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' 383 how_to: 'Please select your Instapaper export and click on the below button to upload and import it.'
384 pinboard:
385 page_title: "Import > Pinboard"
386 description: 'This importer will import all your Pinboard articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 page_title: 'Developer' 390 page_title: 'Developer'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index ca3db487..8b555cc2 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -381,6 +381,10 @@ import:
381 page_title: 'Importar > Instapaper' 381 page_title: 'Importar > Instapaper'
382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").' 382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").'
383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' 383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.'
384 pinboard:
385 page_title: "Importar > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 page_title: 'Promotor' 390 page_title: 'Promotor'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 1914215a..3d7e8078 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -381,6 +381,10 @@ import:
381 page_title: 'درون‌ریزی > Instapaper' 381 page_title: 'درون‌ریزی > Instapaper'
382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").' 382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").'
383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' 383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.'
384 pinboard:
385 # page_title: "Import > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 # page_title: 'Developer' 390 # page_title: 'Developer'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 60fa9a39..833f97bb 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -381,6 +381,10 @@ import:
381 page_title: "Import > Instapaper" 381 page_title: "Import > Instapaper"
382 description: "Sur la page des paramètres (https://www.instapaper.com/user), cliquez sur « Download .CSV file » dans la section « Export ». Un fichier CSV sera téléchargé (« instapaper-export.csv »)." 382 description: "Sur la page des paramètres (https://www.instapaper.com/user), cliquez sur « Download .CSV file » dans la section « Export ». Un fichier CSV sera téléchargé (« instapaper-export.csv »)."
383 how_to: "Choisissez le fichier de votre export Instapaper et cliquez sur le bouton ci-dessous pour l’importer." 383 how_to: "Choisissez le fichier de votre export Instapaper et cliquez sur le bouton ci-dessous pour l’importer."
384 pinboard:
385 page_title: "Import > Pinboard"
386 description: "Sur la page « Backup » (https://pinboard.in/settings/backup), cliquez sur « JSON » dans la section « Bookmarks ». Un fichier json (sans extension) sera téléchargé (« pinboard_export »)."
387 how_to: "Choisissez le fichier de votre export Pinboard et cliquez sur le bouton ci-dessous pour l’importer."
384 388
385developer: 389developer:
386 page_title: "Développeur" 390 page_title: "Développeur"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 7f401684..197d5e07 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -381,6 +381,10 @@ import:
381 page_title: 'Importa da > Instapaper' 381 page_title: 'Importa da > Instapaper'
382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").' 382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").'
383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' 383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.'
384 pinboard:
385 page_title: "Importa da > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 page_title: 'Sviluppatori' 390 page_title: 'Sviluppatori'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 4485c3bc..75268e00 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -381,6 +381,10 @@ import:
381 page_title: 'Importar > Instapaper' 381 page_title: 'Importar > Instapaper'
382 description: "Aquesta aisina importarà totas vòstres articles d'Instapaper. Sus la pagina de paramètres (https://www.instapaper.com/user), clicatz sus \"Download .CSV file\" dins la seccion \"Export\". Un fichièr CSV serà telecargat (aital \"instapaper-export.csv\")." 382 description: "Aquesta aisina importarà totas vòstres articles d'Instapaper. Sus la pagina de paramètres (https://www.instapaper.com/user), clicatz sus \"Download .CSV file\" dins la seccion \"Export\". Un fichièr CSV serà telecargat (aital \"instapaper-export.csv\")."
383 how_to: "Mercés de causir vòstre fichièr Instapaper e de clicar sul boton dejós per lo telecargar e l'importar" 383 how_to: "Mercés de causir vòstre fichièr Instapaper e de clicar sul boton dejós per lo telecargar e l'importar"
384 pinboard:
385 # page_title: "Import > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 page_title: 'Desvolopaire' 390 page_title: 'Desvolopaire'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index ca9015bf..40ded0be 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -381,6 +381,10 @@ import:
381 page_title: 'Import > Instapaper' 381 page_title: 'Import > Instapaper'
382 description: 'Ten importer, zaimportuje wszystkie twoje artykuły z Instapaper. W ustawieniach (https://www.instapaper.com/user), kliknij na "Download .CSV file" w sekcji "Export". Otrzymasz plik CSV.' 382 description: 'Ten importer, zaimportuje wszystkie twoje artykuły z Instapaper. W ustawieniach (https://www.instapaper.com/user), kliknij na "Download .CSV file" w sekcji "Export". Otrzymasz plik CSV.'
383 how_to: 'Wybierz swój plik eksportu z Instapaper i kliknij poniższy przycisk, aby go załadować.' 383 how_to: 'Wybierz swój plik eksportu z Instapaper i kliknij poniższy przycisk, aby go załadować.'
384 pinboard:
385 # page_title: "Import > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 page_title: 'Deweloper' 390 page_title: 'Deweloper'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index c1c60430..ed371cbc 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -71,6 +71,7 @@ config:
71 300_word: 'Posso ler ~300 palavras por minuto' 71 300_word: 'Posso ler ~300 palavras por minuto'
72 400_word: 'Posso ler ~400 palavras por minuto' 72 400_word: 'Posso ler ~400 palavras por minuto'
73 pocket_consumer_key_label: 'Chave do consumidor do Pocket para importar conteúdo' 73 pocket_consumer_key_label: 'Chave do consumidor do Pocket para importar conteúdo'
74 # android_configuration: Configure your Android application
74 form_rss: 75 form_rss:
75 description: 'Feeds RSS providos pelo wallabag permitem que você leia seus artigos salvos em seu leitor de RSS favorito. Você precisa gerar um token primeiro.' 76 description: 'Feeds RSS providos pelo wallabag permitem que você leia seus artigos salvos em seu leitor de RSS favorito. Você precisa gerar um token primeiro.'
76 token_label: 'Token RSS' 77 token_label: 'Token RSS'
@@ -88,6 +89,18 @@ config:
88 name_label: 'Nome' 89 name_label: 'Nome'
89 email_label: 'E-mail' 90 email_label: 'E-mail'
90 twoFactorAuthentication_label: 'Autenticação de dois passos' 91 twoFactorAuthentication_label: 'Autenticação de dois passos'
92 delete:
93 # title: Delete my account (a.k.a danger zone)
94 # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
95 # confirm: Are you really sure? (THIS CAN'T BE UNDONE)
96 # button: Delete my account
97 reset:
98 # title: Reset area (a.k.a danger zone)
99 # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
100 # annotations: Remove ALL annotations
101 # tags: Remove ALL tags
102 # entries: Remove ALL entries
103 # confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
91 form_password: 104 form_password:
92 old_password_label: 'Senha atual' 105 old_password_label: 'Senha atual'
93 new_password_label: 'Nova senha' 106 new_password_label: 'Nova senha'
@@ -355,6 +368,7 @@ import:
355 how_to: 'Por favor, selecione sua exportação do Readability e clique no botão abaixo para importá-la.' 368 how_to: 'Por favor, selecione sua exportação do Readability e clique no botão abaixo para importá-la.'
356 worker: 369 worker:
357 enabled: "A importação é feita assíncronamente. Uma vez que a tarefa de importação é iniciada, um trabalho externo pode executar tarefas uma por vez. O serviço atual é:" 370 enabled: "A importação é feita assíncronamente. Uma vez que a tarefa de importação é iniciada, um trabalho externo pode executar tarefas uma por vez. O serviço atual é:"
371 # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors."
358 firefox: 372 firefox:
359 page_title: 'Importar > Firefox' 373 page_title: 'Importar > Firefox'
360 description: "Com este importador você importa todos os favoritos de seu Firefox. Somente vá até seus favoritos (Ctrl+Maj+O), e em \"Importar e Backup\" e escolha \"Backup...\". Você terá então um arquivo .json." 374 description: "Com este importador você importa todos os favoritos de seu Firefox. Somente vá até seus favoritos (Ctrl+Maj+O), e em \"Importar e Backup\" e escolha \"Backup...\". Você terá então um arquivo .json."
@@ -367,6 +381,10 @@ import:
367 page_title: 'Importar > Instapaper' 381 page_title: 'Importar > Instapaper'
368 description: 'Este importador pode importar todos os artigos do seu Instapaper. Nas página de configurações (https://www.instapaper.com/user), clique em "Download .CSV file" na seção "Export". Um arquivo CSV será baixado (algo como "instapaper-export.csv").' 382 description: 'Este importador pode importar todos os artigos do seu Instapaper. Nas página de configurações (https://www.instapaper.com/user), clique em "Download .CSV file" na seção "Export". Um arquivo CSV será baixado (algo como "instapaper-export.csv").'
369 how_to: 'Por favor, selecione sua exportação do seu Instapaper e clique no botão abaixo para importá-la.' 383 how_to: 'Por favor, selecione sua exportação do seu Instapaper e clique no botão abaixo para importá-la.'
384 pinboard:
385 # page_title: "Import > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
370 388
371developer: 389developer:
372 page_title: 'Desenvolvedor' 390 page_title: 'Desenvolvedor'
@@ -445,16 +463,23 @@ user:
445 delete_confirm: 'Tem certeza?' 463 delete_confirm: 'Tem certeza?'
446 back_to_list: 'Voltar para a lista' 464 back_to_list: 'Voltar para a lista'
447 465
466error:
467 # page_title: An error occurred
468
448flashes: 469flashes:
449 config: 470 config:
450 notice: 471 notice:
451 config_saved: 'Configiração salva. Alguns parâmetros podem ser considerados depois da desconexão.' 472 config_saved: 'Configiração salva. Alguns parâmetros podem ser considerados depois da desconexão.'
452 password_updated: 'Senha atualizada' 473 password_updated: 'Senha atualizada'
453 password_not_updated_demo: 'Em modo de demonstração, você não pode alterar a senha deste usuário.' 474 password_not_updated_demo: 'Em modo de demonstração, você não pode alterar a senha deste usuário.'
475 # user_updated: 'Information updated'
454 rss_updated: 'Informação de RSS atualizada' 476 rss_updated: 'Informação de RSS atualizada'
455 tagging_rules_updated: 'Regras de tags atualizadas' 477 tagging_rules_updated: 'Regras de tags atualizadas'
456 tagging_rules_deleted: 'Regra de tag apagada' 478 tagging_rules_deleted: 'Regra de tag apagada'
457 rss_token_updated: 'Token RSS atualizado' 479 rss_token_updated: 'Token RSS atualizado'
480 # annotations_reset: Annotations reset
481 # tags_reset: Tags reset
482 # entries_reset: Entries reset
458 entry: 483 entry:
459 notice: 484 notice:
460 entry_already_saved: 'Entrada já foi salva em %date%' 485 entry_already_saved: 'Entrada já foi salva em %date%'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 50f1b6a2..a3c0e266 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -381,6 +381,10 @@ import:
381 # page_title: 'Import > Instapaper' 381 # page_title: 'Import > Instapaper'
382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").' 382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").'
383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' 383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.'
384 pinboard:
385 # page_title: "Import > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 # page_title: 'Developer' 390 # page_title: 'Developer'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 07939ebc..a6d2e137 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -381,6 +381,10 @@ import:
381 page_title: 'İçe Aktar > Instapaper' 381 page_title: 'İçe Aktar > Instapaper'
382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").' 382 # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").'
383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' 383 # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.'
384 pinboard:
385 # page_title: "Import > Pinboard"
386 # description: 'This importer will import all your Instapaper articles. On the backup (https://pinboard.in/settings/backup) page, click on "JSON" in the "Bookmarks" section. A JSON file will be downloaded (like "pinboard_export").'
387 # how_to: 'Please select your Pinboard export and click on the below button to upload and import it.'
384 388
385developer: 389developer:
386 # page_title: 'Developer' 390 # page_title: 'Developer'
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php
index e423ffae..28d01715 100644
--- a/src/Wallabag/ImportBundle/Command/ImportCommand.php
+++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php
@@ -17,7 +17,7 @@ class ImportCommand extends ContainerAwareCommand
17 ->setDescription('Import entries from a JSON export') 17 ->setDescription('Import entries from a JSON export')
18 ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate') 18 ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate')
19 ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file') 19 ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file')
20 ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1, v2, instapaper, readability, firefox or chrome', 'v1') 20 ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1, v2, instapaper, pinboard, readability, firefox or chrome', 'v1')
21 ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false) 21 ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false)
22 ; 22 ;
23 } 23 }
@@ -56,6 +56,9 @@ class ImportCommand extends ContainerAwareCommand
56 case 'instapaper': 56 case 'instapaper':
57 $import = $this->getContainer()->get('wallabag_import.instapaper.import'); 57 $import = $this->getContainer()->get('wallabag_import.instapaper.import');
58 break; 58 break;
59 case 'pinboard':
60 $import = $this->getContainer()->get('wallabag_import.pinboard.import');
61 break;
59 default: 62 default:
60 $import = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); 63 $import = $this->getContainer()->get('wallabag_import.wallabag_v1.import');
61 } 64 }
diff --git a/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php b/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php
index c2c11f11..f793a314 100644
--- a/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php
+++ b/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php
@@ -17,7 +17,7 @@ class RedisWorkerCommand extends ContainerAwareCommand
17 $this 17 $this
18 ->setName('wallabag:import:redis-worker') 18 ->setName('wallabag:import:redis-worker')
19 ->setDescription('Launch Redis worker') 19 ->setDescription('Launch Redis worker')
20 ->addArgument('serviceName', InputArgument::REQUIRED, 'Service to use: wallabag_v1, wallabag_v2, pocket, readability, firefox, chrome or instapaper') 20 ->addArgument('serviceName', InputArgument::REQUIRED, 'Service to use: wallabag_v1, wallabag_v2, pocket, readability, pinboard, firefox, chrome or instapaper')
21 ->addOption('maxIterations', '', InputOption::VALUE_OPTIONAL, 'Number of iterations before stoping', false) 21 ->addOption('maxIterations', '', InputOption::VALUE_OPTIONAL, 'Number of iterations before stoping', false)
22 ; 22 ;
23 } 23 }
diff --git a/src/Wallabag/ImportBundle/Controller/ImportController.php b/src/Wallabag/ImportBundle/Controller/ImportController.php
index 15de75ff..237c748e 100644
--- a/src/Wallabag/ImportBundle/Controller/ImportController.php
+++ b/src/Wallabag/ImportBundle/Controller/ImportController.php
@@ -42,6 +42,7 @@ class ImportController extends Controller
42 + $this->getTotalMessageInRabbitQueue('firefox') 42 + $this->getTotalMessageInRabbitQueue('firefox')
43 + $this->getTotalMessageInRabbitQueue('chrome') 43 + $this->getTotalMessageInRabbitQueue('chrome')
44 + $this->getTotalMessageInRabbitQueue('instapaper') 44 + $this->getTotalMessageInRabbitQueue('instapaper')
45 + $this->getTotalMessageInRabbitQueue('pinboard')
45 ; 46 ;
46 } catch (\Exception $e) { 47 } catch (\Exception $e) {
47 $rabbitNotInstalled = true; 48 $rabbitNotInstalled = true;
@@ -57,6 +58,7 @@ class ImportController extends Controller
57 + $redis->llen('wallabag.import.firefox') 58 + $redis->llen('wallabag.import.firefox')
58 + $redis->llen('wallabag.import.chrome') 59 + $redis->llen('wallabag.import.chrome')
59 + $redis->llen('wallabag.import.instapaper') 60 + $redis->llen('wallabag.import.instapaper')
61 + $redis->llen('wallabag.import.pinboard')
60 ; 62 ;
61 } catch (\Exception $e) { 63 } catch (\Exception $e) {
62 $redisNotInstalled = true; 64 $redisNotInstalled = true;
diff --git a/src/Wallabag/ImportBundle/Controller/PinboardController.php b/src/Wallabag/ImportBundle/Controller/PinboardController.php
new file mode 100644
index 00000000..9c3f98d6
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Controller/PinboardController.php
@@ -0,0 +1,77 @@
1<?php
2
3namespace Wallabag\ImportBundle\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7use Symfony\Component\HttpFoundation\Request;
8use Wallabag\ImportBundle\Form\Type\UploadImportType;
9
10class PinboardController extends Controller
11{
12 /**
13 * @Route("/pinboard", name="import_pinboard")
14 */
15 public function indexAction(Request $request)
16 {
17 $form = $this->createForm(UploadImportType::class);
18 $form->handleRequest($request);
19
20 $pinboard = $this->get('wallabag_import.pinboard.import');
21 $pinboard->setUser($this->getUser());
22
23 if ($this->get('craue_config')->get('import_with_rabbitmq')) {
24 $pinboard->setProducer($this->get('old_sound_rabbit_mq.import_pinboard_producer'));
25 } elseif ($this->get('craue_config')->get('import_with_redis')) {
26 $pinboard->setProducer($this->get('wallabag_import.producer.redis.pinboard'));
27 }
28
29 if ($form->isValid()) {
30 $file = $form->get('file')->getData();
31 $markAsRead = $form->get('mark_as_read')->getData();
32 $name = 'pinboard_'.$this->getUser()->getId().'.json';
33
34 if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
35 $res = $pinboard
36 ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name)
37 ->setMarkAsRead($markAsRead)
38 ->import();
39
40 $message = 'flashes.import.notice.failed';
41
42 if (true === $res) {
43 $summary = $pinboard->getSummary();
44 $message = $this->get('translator')->trans('flashes.import.notice.summary', [
45 '%imported%' => $summary['imported'],
46 '%skipped%' => $summary['skipped'],
47 ]);
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
55 unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name);
56 }
57
58 $this->get('session')->getFlashBag()->add(
59 'notice',
60 $message
61 );
62
63 return $this->redirect($this->generateUrl('homepage'));
64 } else {
65 $this->get('session')->getFlashBag()->add(
66 'notice',
67 'flashes.import.notice.failed_on_file'
68 );
69 }
70 }
71
72 return $this->render('WallabagImportBundle:Pinboard:index.html.twig', [
73 'form' => $form->createView(),
74 'import' => $pinboard,
75 ]);
76 }
77}
diff --git a/src/Wallabag/ImportBundle/Import/PinboardImport.php b/src/Wallabag/ImportBundle/Import/PinboardImport.php
new file mode 100644
index 00000000..9bcfbc36
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Import/PinboardImport.php
@@ -0,0 +1,143 @@
1<?php
2
3namespace Wallabag\ImportBundle\Import;
4
5use Wallabag\CoreBundle\Entity\Entry;
6
7class PinboardImport extends AbstractImport
8{
9 private $filepath;
10
11 /**
12 * {@inheritdoc}
13 */
14 public function getName()
15 {
16 return 'Pinboard';
17 }
18
19 /**
20 * {@inheritdoc}
21 */
22 public function getUrl()
23 {
24 return 'import_pinboard';
25 }
26
27 /**
28 * {@inheritdoc}
29 */
30 public function getDescription()
31 {
32 return 'import.pinboard.description';
33 }
34
35 /**
36 * Set file path to the json file.
37 *
38 * @param string $filepath
39 */
40 public function setFilepath($filepath)
41 {
42 $this->filepath = $filepath;
43
44 return $this;
45 }
46
47 /**
48 * {@inheritdoc}
49 */
50 public function import()
51 {
52 if (!$this->user) {
53 $this->logger->error('PinboardImport: user is not defined');
54
55 return false;
56 }
57
58 if (!file_exists($this->filepath) || !is_readable($this->filepath)) {
59 $this->logger->error('PinboardImport: unable to read file', ['filepath' => $this->filepath]);
60
61 return false;
62 }
63
64 $data = json_decode(file_get_contents($this->filepath), true);
65
66 if (empty($data)) {
67 $this->logger->error('PinboardImport: no entries in imported file');
68
69 return false;
70 }
71
72 if ($this->producer) {
73 $this->parseEntriesForProducer($data);
74
75 return true;
76 }
77
78 $this->parseEntries($data);
79
80 return true;
81 }
82
83 /**
84 * {@inheritdoc}
85 */
86 public function parseEntry(array $importedEntry)
87 {
88 $existingEntry = $this->em
89 ->getRepository('WallabagCoreBundle:Entry')
90 ->findByUrlAndUserId($importedEntry['href'], $this->user->getId());
91
92 if (false !== $existingEntry) {
93 ++$this->skippedEntries;
94
95 return;
96 }
97
98 $data = [
99 'title' => $importedEntry['description'],
100 'url' => $importedEntry['href'],
101 'content_type' => '',
102 'language' => '',
103 'is_archived' => ('no' === $importedEntry['toread']) || $this->markAsRead,
104 'is_starred' => false,
105 'created_at' => $importedEntry['time'],
106 'tags' => explode(' ', $importedEntry['tags']),
107 ];
108
109 $entry = new Entry($this->user);
110 $entry->setUrl($data['url']);
111 $entry->setTitle($data['title']);
112
113 // update entry with content (in case fetching failed, the given entry will be return)
114 $entry = $this->fetchContent($entry, $data['url'], $data);
115
116 if (!empty($data['tags'])) {
117 $this->contentProxy->assignTagsToEntry(
118 $entry,
119 $data['tags'],
120 $this->em->getUnitOfWork()->getScheduledEntityInsertions()
121 );
122 }
123
124 $entry->setArchived($data['is_archived']);
125 $entry->setStarred($data['is_starred']);
126 $entry->setCreatedAt(new \DateTime($data['created_at']));
127
128 $this->em->persist($entry);
129 ++$this->importedEntries;
130
131 return $entry;
132 }
133
134 /**
135 * {@inheritdoc}
136 */
137 protected function setEntryAsRead(array $importedEntry)
138 {
139 $importedEntry['toread'] = 'no';
140
141 return $importedEntry;
142 }
143}
diff --git a/src/Wallabag/ImportBundle/Resources/config/rabbit.yml b/src/Wallabag/ImportBundle/Resources/config/rabbit.yml
index a5af5282..e9ecb846 100644
--- a/src/Wallabag/ImportBundle/Resources/config/rabbit.yml
+++ b/src/Wallabag/ImportBundle/Resources/config/rabbit.yml
@@ -24,6 +24,14 @@ services:
24 - "@wallabag_import.instapaper.import" 24 - "@wallabag_import.instapaper.import"
25 - "@event_dispatcher" 25 - "@event_dispatcher"
26 - "@logger" 26 - "@logger"
27 wallabag_import.consumer.amqp.pinboard:
28 class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
29 arguments:
30 - "@doctrine.orm.entity_manager"
31 - "@wallabag_user.user_repository"
32 - "@wallabag_import.pinboard.import"
33 - "@event_dispatcher"
34 - "@logger"
27 wallabag_import.consumer.amqp.wallabag_v1: 35 wallabag_import.consumer.amqp.wallabag_v1:
28 class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer 36 class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
29 arguments: 37 arguments:
diff --git a/src/Wallabag/ImportBundle/Resources/config/redis.yml b/src/Wallabag/ImportBundle/Resources/config/redis.yml
index 5ced4c83..091cdba0 100644
--- a/src/Wallabag/ImportBundle/Resources/config/redis.yml
+++ b/src/Wallabag/ImportBundle/Resources/config/redis.yml
@@ -42,6 +42,27 @@ services:
42 - "@event_dispatcher" 42 - "@event_dispatcher"
43 - "@logger" 43 - "@logger"
44 44
45 # pinboard
46 wallabag_import.queue.redis.pinboard:
47 class: Simpleue\Queue\RedisQueue
48 arguments:
49 - "@wallabag_core.redis.client"
50 - "wallabag.import.pinboard"
51
52 wallabag_import.producer.redis.pinboard:
53 class: Wallabag\ImportBundle\Redis\Producer
54 arguments:
55 - "@wallabag_import.queue.redis.pinboard"
56
57 wallabag_import.consumer.redis.pinboard:
58 class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
59 arguments:
60 - "@doctrine.orm.entity_manager"
61 - "@wallabag_user.user_repository"
62 - "@wallabag_import.pinboard.import"
63 - "@event_dispatcher"
64 - "@logger"
65
45 # pocket 66 # pocket
46 wallabag_import.queue.redis.pocket: 67 wallabag_import.queue.redis.pocket:
47 class: Simpleue\Queue\RedisQueue 68 class: Simpleue\Queue\RedisQueue
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml
index 64822963..c4fe3f92 100644
--- a/src/Wallabag/ImportBundle/Resources/config/services.yml
+++ b/src/Wallabag/ImportBundle/Resources/config/services.yml
@@ -71,6 +71,17 @@ services:
71 tags: 71 tags:
72 - { name: wallabag_import.import, alias: instapaper } 72 - { name: wallabag_import.import, alias: instapaper }
73 73
74 wallabag_import.pinboard.import:
75 class: Wallabag\ImportBundle\Import\PinboardImport
76 arguments:
77 - "@doctrine.orm.entity_manager"
78 - "@wallabag_core.content_proxy"
79 - "@event_dispatcher"
80 calls:
81 - [ setLogger, [ "@logger" ]]
82 tags:
83 - { name: wallabag_import.import, alias: pinboard }
84
74 wallabag_import.firefox.import: 85 wallabag_import.firefox.import:
75 class: Wallabag\ImportBundle\Import\FirefoxImport 86 class: Wallabag\ImportBundle\Import\FirefoxImport
76 arguments: 87 arguments:
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pinboard/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pinboard/index.html.twig
new file mode 100644
index 00000000..43f196ad
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Resources/views/Pinboard/index.html.twig
@@ -0,0 +1,45 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'import.pinboard.page_title'|trans }}{% endblock %}
4
5{% block content %}
6<div class="row">
7 <div class="col s12">
8 <div class="card-panel settings">
9 {% include 'WallabagImportBundle:Import:_information.html.twig' %}
10
11 <div class="row">
12 <blockquote>{{ import.description|trans }}</blockquote>
13 <p>{{ 'import.pinboard.how_to'|trans }}</p>
14
15 <div class="col s12">
16 {{ form_start(form, {'method': 'POST'}) }}
17 {{ form_errors(form) }}
18 <div class="row">
19 <div class="file-field input-field col s12">
20 {{ form_errors(form.file) }}
21 <div class="btn">
22 <span>{{ form.file.vars.label|trans }}</span>
23 {{ form_widget(form.file) }}
24 </div>
25 <div class="file-path-wrapper">
26 <input class="file-path validate" type="text">
27 </div>
28 </div>
29 <div class="input-field col s6 with-checkbox">
30 <h6>{{ 'import.form.mark_as_read_title'|trans }}</h6>
31 {{ form_widget(form.mark_as_read) }}
32 {{ form_label(form.mark_as_read) }}
33 </div>
34 </div>
35
36 {{ form_widget(form.save, { 'attr': {'class': 'btn waves-effect waves-light'} }) }}
37
38 {{ form_rest(form) }}
39 </form>
40 </div>
41 </div>
42 </div>
43 </div>
44</div>
45{% endblock %}
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index 8d0644d1..568576a3 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -412,7 +412,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
412 412
413 $crawler = $client->request('GET', '/config'); 413 $crawler = $client->request('GET', '/config');
414 414
415 $this->assertTrue($client->getResponse()->isSuccessful()); 415 $this->assertEquals(200, $client->getResponse()->getStatusCode());
416 416
417 $form = $crawler->filter('button[id=tagging_rule_save]')->form(); 417 $form = $crawler->filter('button[id=tagging_rule_save]')->form();
418 418
@@ -499,7 +499,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
499 499
500 $crawler = $client->request('GET', '/config'); 500 $crawler = $client->request('GET', '/config');
501 501
502 $this->assertTrue($client->getResponse()->isSuccessful()); 502 $this->assertEquals(200, $client->getResponse()->getStatusCode());
503 503
504 $form = $crawler->filter('button[id=tagging_rule_save]')->form(); 504 $form = $crawler->filter('button[id=tagging_rule_save]')->form();
505 505
diff --git a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
index 0bc40bdd..5e57dcef 100644
--- a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php
@@ -24,6 +24,6 @@ class ImportControllerTest extends WallabagCoreTestCase
24 $crawler = $client->request('GET', '/import/'); 24 $crawler = $client->request('GET', '/import/');
25 25
26 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 26 $this->assertEquals(200, $client->getResponse()->getStatusCode());
27 $this->assertEquals(7, $crawler->filter('blockquote')->count()); 27 $this->assertEquals(8, $crawler->filter('blockquote')->count());
28 } 28 }
29} 29}
diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
new file mode 100644
index 00000000..cd7f569b
--- /dev/null
+++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
@@ -0,0 +1,197 @@
1<?php
2
3namespace Tests\Wallabag\ImportBundle\Controller;
4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile;
7
8class PinboardControllerTest extends WallabagCoreTestCase
9{
10 public function testImportPinboard()
11 {
12 $this->logInAs('admin');
13 $client = $this->getClient();
14
15 $crawler = $client->request('GET', '/import/pinboard');
16
17 $this->assertEquals(200, $client->getResponse()->getStatusCode());
18 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
19 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
20 }
21
22 public function testImportPinboardWithRabbitEnabled()
23 {
24 $this->logInAs('admin');
25 $client = $this->getClient();
26
27 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
28
29 $crawler = $client->request('GET', '/import/pinboard');
30
31 $this->assertEquals(200, $client->getResponse()->getStatusCode());
32 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
33 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
34
35 $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
36 }
37
38 public function testImportPinboardBadFile()
39 {
40 $this->logInAs('admin');
41 $client = $this->getClient();
42
43 $crawler = $client->request('GET', '/import/pinboard');
44 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
45
46 $data = [
47 'upload_import_file[file]' => '',
48 ];
49
50 $client->submit($form, $data);
51
52 $this->assertEquals(200, $client->getResponse()->getStatusCode());
53 }
54
55 public function testImportPinboardWithRedisEnabled()
56 {
57 $this->checkRedis();
58 $this->logInAs('admin');
59 $client = $this->getClient();
60 $client->getContainer()->get('craue_config')->set('import_with_redis', 1);
61
62 $crawler = $client->request('GET', '/import/pinboard');
63
64 $this->assertEquals(200, $client->getResponse()->getStatusCode());
65 $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
66 $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
67
68 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
69
70 $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard.json');
71
72 $data = [
73 'upload_import_file[file]' => $file,
74 ];
75
76 $client->submit($form, $data);
77
78 $this->assertEquals(302, $client->getResponse()->getStatusCode());
79
80 $crawler = $client->followRedirect();
81
82 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
83 $this->assertContains('flashes.import.notice.summary', $body[0]);
84
85 $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.pinboard'));
86
87 $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
88 }
89
90 public function testImportPinboardWithFile()
91 {
92 $this->logInAs('admin');
93 $client = $this->getClient();
94
95 $crawler = $client->request('GET', '/import/pinboard');
96 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
97
98 $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard.json');
99
100 $data = [
101 'upload_import_file[file]' => $file,
102 ];
103
104 $client->submit($form, $data);
105
106 $this->assertEquals(302, $client->getResponse()->getStatusCode());
107
108 $crawler = $client->followRedirect();
109
110 $content = $client->getContainer()
111 ->get('doctrine.orm.entity_manager')
112 ->getRepository('WallabagCoreBundle:Entry')
113 ->findByUrlAndUserId(
114 'https://ma.ttias.be/varnish-explained/',
115 $this->getLoggedInUserId()
116 );
117
118 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
119 $this->assertContains('flashes.import.notice.summary', $body[0]);
120
121 $this->assertNotEmpty($content->getMimetype());
122 $this->assertNotEmpty($content->getPreviewPicture());
123 $this->assertNotEmpty($content->getLanguage());
124 $this->assertEquals(2, count($content->getTags()));
125 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
126 $this->assertEquals('2016-10-26', $content->getCreatedAt()->format('Y-m-d'));
127 }
128
129 public function testImportPinboardWithFileAndMarkAllAsRead()
130 {
131 $this->logInAs('admin');
132 $client = $this->getClient();
133
134 $crawler = $client->request('GET', '/import/pinboard');
135 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
136
137 $file = new UploadedFile(__DIR__.'/../fixtures/pinboard_export', 'pinboard-read.json');
138
139 $data = [
140 'upload_import_file[file]' => $file,
141 'upload_import_file[mark_as_read]' => 1,
142 ];
143
144 $client->submit($form, $data);
145
146 $this->assertEquals(302, $client->getResponse()->getStatusCode());
147
148 $crawler = $client->followRedirect();
149
150 $content1 = $client->getContainer()
151 ->get('doctrine.orm.entity_manager')
152 ->getRepository('WallabagCoreBundle:Entry')
153 ->findByUrlAndUserId(
154 'https://ilia.ws/files/nginx_torontophpug.pdf',
155 $this->getLoggedInUserId()
156 );
157
158 $this->assertTrue($content1->isArchived());
159
160 $content2 = $client->getContainer()
161 ->get('doctrine.orm.entity_manager')
162 ->getRepository('WallabagCoreBundle:Entry')
163 ->findByUrlAndUserId(
164 'https://developers.google.com/web/updates/2016/07/infinite-scroller',
165 $this->getLoggedInUserId()
166 );
167
168 $this->assertTrue($content2->isArchived());
169
170 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
171 $this->assertContains('flashes.import.notice.summary', $body[0]);
172 }
173
174 public function testImportPinboardWithEmptyFile()
175 {
176 $this->logInAs('admin');
177 $client = $this->getClient();
178
179 $crawler = $client->request('GET', '/import/pinboard');
180 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
181
182 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt');
183
184 $data = [
185 'upload_import_file[file]' => $file,
186 ];
187
188 $client->submit($form, $data);
189
190 $this->assertEquals(302, $client->getResponse()->getStatusCode());
191
192 $crawler = $client->followRedirect();
193
194 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
195 $this->assertContains('flashes.import.notice.failed', $body[0]);
196 }
197}
diff --git a/tests/Wallabag/ImportBundle/fixtures/pinboard_export b/tests/Wallabag/ImportBundle/fixtures/pinboard_export
new file mode 100644
index 00000000..2dd744d3
--- /dev/null
+++ b/tests/Wallabag/ImportBundle/fixtures/pinboard_export
@@ -0,0 +1,5 @@
1[{"href":"https:\/\/developers.google.com\/web\/updates\/2016\/07\/infinite-scroller","description":"Complexities of an Infinite Scroller","extended":"TL;DR: Re-use your DOM elements and remove the ones that are far away from the viewport. Use placeholders to account for delayed data","meta":"21ff61c6f648901168f9e6119f53df7d","hash":"e69b65724cca1c585b446d4c47865d76","time":"2016-10-31T15:57:56Z","shared":"yes","toread":"no","tags":"infinite dom performance scroll"},
2{"href":"https:\/\/ma.ttias.be\/varnish-explained\/","description":"Varnish (explained) for PHP developers","extended":"A few months ago, I gave a presentation at LaraconEU in Amsterdam titled \"Varnish for PHP developers\". The generic title of that presentation is actually Varnish Explained and this is a write-up of that presentation, the video and the slides.","meta":"d32ad9fac2ed29da4aec12c562e9afb1","hash":"21dd6bdda8ad62666a2c9e79f6e80f98","time":"2016-10-26T06:43:03Z","shared":"yes","toread":"no","tags":"varnish PHP"},
3{"href":"https:\/\/ilia.ws\/files\/nginx_torontophpug.pdf","description":"Nginx Tricks for PHP Developers","extended":"","meta":"9adbb5c4ca6760e335b920800d88c70a","hash":"0189bb08f8bd0122c6544bed4624c546","time":"2016-10-05T07:11:27Z","shared":"yes","toread":"no","tags":"nginx PHP best_practice"},
4{"href":"https:\/\/jolicode.com\/blog\/starting-a-mobile-application-with-react-native","description":"Starting a mobile application with React Native","extended":"While preparing our next React Native training, I learnt a lot on the library and discovered an amazing community with a lot of packages.","meta":"bd140bd3e53e3a0b4cb08cdaf64bcbfc","hash":"015fa10cd97f56186420555e52cfab62","time":"2016-09-23T10:58:20Z","shared":"yes","toread":"no","tags":"react-native"},
5{"href":"http:\/\/open.blogs.nytimes.com\/2016\/08\/29\/testing-varnish-using-varnishtest\/","description":"Testing Varnish Using Varnishtest","extended":"Varnish ships with the ability to test using the testing tool varnishtest. Varnishtest gives you the ability to write VCL tests you can run on the command line or as part of your build process.","meta":"ca2752a07adea4bab52cd19e8fdbf356","hash":"d3e642cc1274d10e4c12ee31f5dde736","time":"2016-08-30T09:33:24Z","shared":"yes","toread":"no","tags":"varnish test vcl"}]