aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php2
-rw-r--r--src/Wallabag/ApiBundle/DependencyInjection/Configuration.php4
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php1
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php2
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php4
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EditEntryType.php5
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php (renamed from src/Wallabag/CoreBundle/Filter/EntryFilterType.php)2
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml2
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css2
-rw-r--r--[-rwxr-xr-x]src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md2
-rw-r--r--[-rwxr-xr-x]src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/about.html.twig0
-rw-r--r--[-rwxr-xr-x]src/Wallabag/CoreBundle/Resources/views/themes/material/README.md2
-rw-r--r--[-rwxr-xr-x]src/Wallabag/CoreBundle/Resources/views/themes/material/Static/about.html.twig0
-rw-r--r--src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php60
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php4
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV1Import.php18
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV2Import.php75
-rw-r--r--src/Wallabag/ImportBundle/Resources/config/services.yml9
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/WallabagV2/index.html.twig2
-rw-r--r--src/Wallabag/ImportBundle/Tests/Controller/ImportControllerTest.php2
-rw-r--r--src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php69
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php12
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php97
-rw-r--r--src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v2.json1
24 files changed, 338 insertions, 39 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
index d9035cac..84bc14a9 100644
--- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
@@ -9,6 +9,7 @@ use Nelmio\ApiDocBundle\Annotation\ApiDoc;
9use Symfony\Component\HttpFoundation\Request; 9use Symfony\Component\HttpFoundation\Request;
10use Symfony\Component\HttpFoundation\Response; 10use Symfony\Component\HttpFoundation\Response;
11use Symfony\Component\Routing\Generator\UrlGeneratorInterface; 11use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
12use Symfony\Component\Security\Core\Exception\AccessDeniedException;
12use Wallabag\CoreBundle\Entity\Entry; 13use Wallabag\CoreBundle\Entity\Entry;
13use Wallabag\CoreBundle\Entity\Tag; 14use Wallabag\CoreBundle\Entity\Tag;
14 15
@@ -73,7 +74,6 @@ class WallabagRestController extends FOSRestController
73 $order = $request->query->get('order', 'desc'); 74 $order = $request->query->get('order', 'desc');
74 $page = (int) $request->query->get('page', 1); 75 $page = (int) $request->query->get('page', 1);
75 $perPage = (int) $request->query->get('perPage', 30); 76 $perPage = (int) $request->query->get('perPage', 30);
76 $tags = $request->query->get('tags', []);
77 77
78 $pager = $this->getDoctrine() 78 $pager = $this->getDoctrine()
79 ->getRepository('WallabagCoreBundle:Entry') 79 ->getRepository('WallabagCoreBundle:Entry')
diff --git a/src/Wallabag/ApiBundle/DependencyInjection/Configuration.php b/src/Wallabag/ApiBundle/DependencyInjection/Configuration.php
index cec45412..f70a5835 100644
--- a/src/Wallabag/ApiBundle/DependencyInjection/Configuration.php
+++ b/src/Wallabag/ApiBundle/DependencyInjection/Configuration.php
@@ -20,10 +20,6 @@ class Configuration implements ConfigurationInterface
20 $treeBuilder = new TreeBuilder(); 20 $treeBuilder = new TreeBuilder();
21 $rootNode = $treeBuilder->root('wallabag_api'); 21 $rootNode = $treeBuilder->root('wallabag_api');
22 22
23 // Here you should define the parameters that are allowed to
24 // configure your bundle. See the documentation linked above for
25 // more information on that topic.
26
27 return $treeBuilder; 23 return $treeBuilder;
28 } 24 }
29} 25}
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 93792692..e6a06eea 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -65,7 +65,6 @@ class InstallCommand extends ContainerAwareCommand
65 65
66 $fulfilled = true; 66 $fulfilled = true;
67 67
68 // @TODO: find a better way to check requirements
69 $label = '<comment>PCRE</comment>'; 68 $label = '<comment>PCRE</comment>';
70 if (extension_loaded('pcre')) { 69 if (extension_loaded('pcre')) {
71 $status = '<info>OK!</info>'; 70 $status = '<info>OK!</info>';
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 25e69820..b7799746 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -199,7 +199,7 @@ class ConfigController extends Controller
199 * 199 *
200 * @return \Symfony\Component\HttpFoundation\RedirectResponse 200 * @return \Symfony\Component\HttpFoundation\RedirectResponse
201 */ 201 */
202 public function deleteTaggingRule(TaggingRule $rule) 202 public function deleteTaggingRuleAction(TaggingRule $rule)
203 { 203 {
204 if ($this->getUser()->getId() != $rule->getConfig()->getUser()->getId()) { 204 if ($this->getUser()->getId() != $rule->getConfig()->getUser()->getId()) {
205 throw $this->createAccessDeniedException('You can not access this tagging ryle.'); 205 throw $this->createAccessDeniedException('You can not access this tagging ryle.');
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 3e1b512f..ea77d138 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -9,7 +9,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9use Symfony\Component\HttpFoundation\Request; 9use Symfony\Component\HttpFoundation\Request;
10use Symfony\Component\Routing\Generator\UrlGeneratorInterface; 10use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
11use Wallabag\CoreBundle\Entity\Entry; 11use Wallabag\CoreBundle\Entity\Entry;
12use Wallabag\CoreBundle\Filter\EntryFilterType; 12use Wallabag\CoreBundle\Form\Type\EntryFilterType;
13use Wallabag\CoreBundle\Form\Type\EditEntryType; 13use Wallabag\CoreBundle\Form\Type\EditEntryType;
14use Wallabag\CoreBundle\Form\Type\NewEntryType; 14use Wallabag\CoreBundle\Form\Type\NewEntryType;
15 15
@@ -81,7 +81,7 @@ class EntryController extends Controller
81 * 81 *
82 * @return \Symfony\Component\HttpFoundation\Response 82 * @return \Symfony\Component\HttpFoundation\Response
83 */ 83 */
84 public function addEntryViaBookmarklet(Request $request) 84 public function addEntryViaBookmarkletAction(Request $request)
85 { 85 {
86 $entry = new Entry($this->getUser()); 86 $entry = new Entry($this->getUser());
87 $entry->setUrl($request->get('url')); 87 $entry->setUrl($request->get('url'));
diff --git a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
index 0cb29881..2b1e1ef4 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
@@ -16,11 +16,6 @@ class EditEntryType extends AbstractType
16 $builder 16 $builder
17 ->add('title', TextType::class, array('required' => true)) 17 ->add('title', TextType::class, array('required' => true))
18 ->add('is_public', CheckboxType::class, array('required' => false)) 18 ->add('is_public', CheckboxType::class, array('required' => false))
19 // @todo: add autocomplete
20 // ->add('tags', 'entity', array(
21 // 'class' => 'Wallabag\CoreBundle\Entity\Tag',
22 // 'choice_translation_domain' => true,
23 // ))
24 ->add('save', SubmitType::class) 19 ->add('save', SubmitType::class)
25 ; 20 ;
26 } 21 }
diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
index c38be832..ee10bc8b 100644
--- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2 2
3namespace Wallabag\CoreBundle\Filter; 3namespace Wallabag\CoreBundle\Form\Type;
4 4
5use Doctrine\ORM\EntityRepository; 5use Doctrine\ORM\EntityRepository;
6use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; 6use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 813f8a96..a8796fe4 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -15,7 +15,7 @@ services:
15 - { name: form.type } 15 - { name: form.type }
16 16
17 wallabag_core.filter.type.entry: 17 wallabag_core.filter.type.entry:
18 class: Wallabag\CoreBundle\Filter\EntryFilterType 18 class: Wallabag\CoreBundle\Form\Type\EntryFilterType
19 arguments: 19 arguments:
20 - "@wallabag_core.entry_repository" 20 - "@wallabag_core.entry_repository"
21 - "@security.token_storage" 21 - "@security.token_storage"
diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css b/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css
index d3f92926..62f2964c 100755
--- a/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css
+++ b/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css
@@ -564,7 +564,7 @@ img.preview {
564 height: 100%; 564 height: 100%;
565 width: 100%; 565 width: 100%;
566 margin: 0; 566 margin: 0;
567 margin-top: -30% !important; /* TODO: get rid of !important here; overridden by .messages selector */ 567 margin-top: -30% !important;
568 padding: 2em; 568 padding: 2em;
569 display: none; 569 display: none;
570 border-left: 1px #EEE solid; 570 border-left: 1px #EEE solid;
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md
index 1f0054a4..3db07873 100755..100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md
@@ -1,3 +1,3 @@
1# Baggy Theme 1# Baggy Theme
2 2
3theme created by Thomas LEBEAU alias Courgette http://thomaslebeau.fr/ \ No newline at end of file 3theme created by Thomas LEBEAU alias Courgette http://thomaslebeau.fr/
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/about.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/about.html.twig
index 38f08da6..38f08da6 100755..100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/about.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/about.html.twig
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md b/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md
index 534eea30..54e8a0e2 100755..100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md
@@ -2,4 +2,4 @@
2 2
3Theme created by Danilow (@modos189) Alexandr http://modos189.ru/ 3Theme created by Danilow (@modos189) Alexandr http://modos189.ru/
4 4
5Used framework http://materializecss.com/ \ No newline at end of file 5Used framework http://materializecss.com/
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/about.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/about.html.twig
index d6b8e28a..d6b8e28a 100755..100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/about.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/about.html.twig
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
new file mode 100644
index 00000000..2e6225f2
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
@@ -0,0 +1,60 @@
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 WallabagV2Controller extends Controller
11{
12 /**
13 * @Route("/wallabag-v2", name="import_wallabag_v2")
14 */
15 public function indexAction(Request $request)
16 {
17 $form = $this->createForm(UploadImportType::class);
18 $form->handleRequest($request);
19
20 $wallabag = $this->get('wallabag_import.wallabag_v2.import');
21
22 if ($form->isValid()) {
23 $file = $form->get('file')->getData();
24 $name = $this->getUser()->getId().'.json';
25
26 if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
27 $res = $wallabag
28 ->setUser($this->getUser())
29 ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name)
30 ->import();
31
32 $message = 'Import failed, please try again.';
33
34 if (true === $res) {
35 $summary = $wallabag->getSummary();
36 $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.';
37
38 unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name);
39 }
40
41 $this->get('session')->getFlashBag()->add(
42 'notice',
43 $message
44 );
45
46 return $this->redirect($this->generateUrl('homepage'));
47 } else {
48 $this->get('session')->getFlashBag()->add(
49 'notice',
50 'Error while processing import. Please verify your import file.'
51 );
52 }
53 }
54
55 return $this->render('WallabagImportBundle:WallabagV2:index.html.twig', [
56 'form' => $form->createView(),
57 'import' => $wallabag,
58 ]);
59 }
60}
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 0463a739..22932238 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -24,7 +24,6 @@ class PocketImport implements ImportInterface
24 private $skippedEntries = 0; 24 private $skippedEntries = 0;
25 private $importedEntries = 0; 25 private $importedEntries = 0;
26 protected $accessToken; 26 protected $accessToken;
27 private $translator;
28 27
29 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig) 28 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig)
30 { 29 {
@@ -178,9 +177,6 @@ class PocketImport implements ImportInterface
178 $this->client = $client; 177 $this->client = $client;
179 } 178 }
180 179
181 /**
182 * @todo move that in a more global place
183 */
184 private function assignTagsToEntry(Entry $entry, $tags) 180 private function assignTagsToEntry(Entry $entry, $tags)
185 { 181 {
186 foreach ($tags as $tag) { 182 foreach ($tags as $tag) {
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
index 6f8feaf3..0dac6203 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
@@ -11,12 +11,12 @@ use Wallabag\CoreBundle\Tools\Utils;
11 11
12class WallabagV1Import implements ImportInterface 12class WallabagV1Import implements ImportInterface
13{ 13{
14 private $user; 14 protected $user;
15 private $em; 15 protected $em;
16 private $logger; 16 protected $logger;
17 private $skippedEntries = 0; 17 protected $skippedEntries = 0;
18 private $importedEntries = 0; 18 protected $importedEntries = 0;
19 private $filepath; 19 protected $filepath;
20 20
21 public function __construct(EntityManager $em) 21 public function __construct(EntityManager $em)
22 { 22 {
@@ -72,13 +72,13 @@ class WallabagV1Import implements ImportInterface
72 public function import() 72 public function import()
73 { 73 {
74 if (!$this->user) { 74 if (!$this->user) {
75 $this->logger->error('WallabagV1Import: user is not defined'); 75 $this->logger->error('WallabagImport: user is not defined');
76 76
77 return false; 77 return false;
78 } 78 }
79 79
80 if (!file_exists($this->filepath) || !is_readable($this->filepath)) { 80 if (!file_exists($this->filepath) || !is_readable($this->filepath)) {
81 $this->logger->error('WallabagV1Import: unable to read file', array('filepath' => $this->filepath)); 81 $this->logger->error('WallabagImport: unable to read file', array('filepath' => $this->filepath));
82 82
83 return false; 83 return false;
84 } 84 }
@@ -120,7 +120,7 @@ class WallabagV1Import implements ImportInterface
120 /** 120 /**
121 * @param $entries 121 * @param $entries
122 */ 122 */
123 private function parseEntries($entries) 123 protected function parseEntries($entries)
124 { 124 {
125 $i = 1; 125 $i = 1;
126 126
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php
new file mode 100644
index 00000000..979c671e
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php
@@ -0,0 +1,75 @@
1<?php
2
3namespace Wallabag\ImportBundle\Import;
4
5use Wallabag\CoreBundle\Entity\Entry;
6
7class WallabagV2Import extends WallabagV1Import implements ImportInterface
8{
9 /**
10 * {@inheritdoc}
11 */
12 public function getName()
13 {
14 return 'wallabag v2';
15 }
16
17 /**
18 * {@inheritdoc}
19 */
20 public function getUrl()
21 {
22 return 'import_wallabag_v2';
23 }
24
25 /**
26 * {@inheritdoc}
27 */
28 public function getDescription()
29 {
30 return 'This importer will import all your wallabag v2 articles. On the export sidebar, click on "JSON". You will have a "Unread articles.json" file.';
31 }
32
33 /**
34 * @param $entries
35 */
36 protected function parseEntries($entries)
37 {
38 $i = 1;
39
40 foreach ($entries as $importedEntry) {
41 $existingEntry = $this->em
42 ->getRepository('WallabagCoreBundle:Entry')
43 ->findByUrlAndUserId($importedEntry['url'], $this->user->getId());
44
45 if (false !== $existingEntry) {
46 ++$this->skippedEntries;
47 continue;
48 }
49
50 // @see ContentProxy->updateEntry
51 $entry = new Entry($this->user);
52 $entry->setUrl($importedEntry['url']);
53 $entry->setTitle($importedEntry['title']);
54 $entry->setArchived($importedEntry['is_archived']);
55 $entry->setStarred($importedEntry['is_starred']);
56 $entry->setContent($importedEntry['content']);
57 $entry->setReadingTime($importedEntry['reading_time']);
58 $entry->setDomainName($importedEntry['domain_name']);
59 $entry->setMimetype($importedEntry['mimetype']);
60 $entry->setLanguage($importedEntry['language']);
61 $entry->setPreviewPicture($importedEntry['preview_picture']);
62
63 $this->em->persist($entry);
64 ++$this->importedEntries;
65
66 // flush every 20 entries
67 if (($i % 20) === 0) {
68 $this->em->flush();
69 }
70 ++$i;
71 }
72
73 $this->em->flush();
74 }
75}
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml
index dc536808..e0942b1a 100644
--- a/src/Wallabag/ImportBundle/Resources/config/services.yml
+++ b/src/Wallabag/ImportBundle/Resources/config/services.yml
@@ -32,3 +32,12 @@ services:
32 - [ setLogger, [ "@logger" ]] 32 - [ setLogger, [ "@logger" ]]
33 tags: 33 tags:
34 - { name: wallabag_import.import, alias: wallabag_v1 } 34 - { name: wallabag_import.import, alias: wallabag_v1 }
35
36 wallabag_import.wallabag_v2.import:
37 class: Wallabag\ImportBundle\Import\WallabagV2Import
38 arguments:
39 - "@doctrine.orm.entity_manager"
40 calls:
41 - [ setLogger, [ "@logger" ]]
42 tags:
43 - { name: wallabag_import.import, alias: wallabag_v2 }
diff --git a/src/Wallabag/ImportBundle/Resources/views/WallabagV2/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/WallabagV2/index.html.twig
new file mode 100644
index 00000000..78fe67e4
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Resources/views/WallabagV2/index.html.twig
@@ -0,0 +1,2 @@
1{% extends "WallabagImportBundle:WallabagV1:index.html.twig" %}
2{% block title %}{% trans %}Import > Wallabag v2{% endtrans %}{% endblock %}
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/ImportControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/ImportControllerTest.php
index 30009af4..9f38fa82 100644
--- a/src/Wallabag/ImportBundle/Tests/Controller/ImportControllerTest.php
+++ b/src/Wallabag/ImportBundle/Tests/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(2, $crawler->filter('blockquote')->count()); 27 $this->assertEquals(3, $crawler->filter('blockquote')->count());
28 } 28 }
29} 29}
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php
new file mode 100644
index 00000000..a77c0f6b
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV2ControllerTest.php
@@ -0,0 +1,69 @@
1<?php
2
3namespace Wallabag\ImportBundle\Tests\Controller;
4
5use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
6use Symfony\Component\HttpFoundation\File\UploadedFile;
7
8class WallabagV2ControllerTest extends WallabagCoreTestCase
9{
10 public function testImportWallabag()
11 {
12 $this->logInAs('admin');
13 $client = $this->getClient();
14
15 $crawler = $client->request('GET', '/import/wallabag-v2');
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 testImportWallabagWithFile()
23 {
24 $this->logInAs('admin');
25 $client = $this->getClient();
26
27 $crawler = $client->request('GET', '/import/wallabag-v2');
28 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
29
30 $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json');
31
32 $data = array(
33 'upload_import_file[file]' => $file,
34 );
35
36 $client->submit($form, $data);
37
38 $this->assertEquals(302, $client->getResponse()->getStatusCode());
39
40 $crawler = $client->followRedirect();
41
42 $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text')));
43 $this->assertContains('Import summary', $alert[0]);
44 }
45
46 public function testImportWallabagWithEmptyFile()
47 {
48 $this->logInAs('admin');
49 $client = $this->getClient();
50
51 $crawler = $client->request('GET', '/import/wallabag-v2');
52 $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
53
54 $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt');
55
56 $data = array(
57 'upload_import_file[file]' => $file,
58 );
59
60 $client->submit($form, $data);
61
62 $this->assertEquals(302, $client->getResponse()->getStatusCode());
63
64 $crawler = $client->followRedirect();
65
66 $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text')));
67 $this->assertContains('Import failed, please try again', $alert[0]);
68 }
69}
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
index 90483480..1cb5a233 100644
--- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
+++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
@@ -21,17 +21,17 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
21 ->disableOriginalConstructor() 21 ->disableOriginalConstructor()
22 ->getMock(); 22 ->getMock();
23 23
24 $pocket = new WallabagV1Import($this->em); 24 $wallabag = new WallabagV1Import($this->em);
25 25
26 $this->logHandler = new TestHandler(); 26 $this->logHandler = new TestHandler();
27 $logger = new Logger('test', array($this->logHandler)); 27 $logger = new Logger('test', array($this->logHandler));
28 $pocket->setLogger($logger); 28 $wallabag->setLogger($logger);
29 29
30 if (false === $unsetUser) { 30 if (false === $unsetUser) {
31 $pocket->setUser($this->user); 31 $wallabag->setUser($this->user);
32 } 32 }
33 33
34 return $pocket; 34 return $wallabag;
35 } 35 }
36 36
37 public function testInit() 37 public function testInit()
@@ -77,7 +77,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
77 $this->assertFalse($res); 77 $this->assertFalse($res);
78 78
79 $records = $this->logHandler->getRecords(); 79 $records = $this->logHandler->getRecords();
80 $this->assertContains('WallabagV1Import: unable to read file', $records[0]['message']); 80 $this->assertContains('WallabagImport: unable to read file', $records[0]['message']);
81 $this->assertEquals('ERROR', $records[0]['level_name']); 81 $this->assertEquals('ERROR', $records[0]['level_name']);
82 } 82 }
83 83
@@ -91,7 +91,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
91 $this->assertFalse($res); 91 $this->assertFalse($res);
92 92
93 $records = $this->logHandler->getRecords(); 93 $records = $this->logHandler->getRecords();
94 $this->assertContains('WallabagV1Import: user is not defined', $records[0]['message']); 94 $this->assertContains('WallabagImport: user is not defined', $records[0]['message']);
95 $this->assertEquals('ERROR', $records[0]['level_name']); 95 $this->assertEquals('ERROR', $records[0]['level_name']);
96 } 96 }
97} 97}
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php
new file mode 100644
index 00000000..4ebe93bf
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php
@@ -0,0 +1,97 @@
1<?php
2
3namespace Wallabag\ImportBundle\Tests\Import;
4
5use Wallabag\ImportBundle\Import\WallabagV2Import;
6use Wallabag\UserBundle\Entity\User;
7use Monolog\Logger;
8use Monolog\Handler\TestHandler;
9
10class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
11{
12 protected $user;
13 protected $em;
14 protected $logHandler;
15
16 private function getWallabagV2Import($unsetUser = false)
17 {
18 $this->user = new User();
19
20 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
21 ->disableOriginalConstructor()
22 ->getMock();
23
24 $wallabag = new WallabagV2Import($this->em);
25
26 $this->logHandler = new TestHandler();
27 $logger = new Logger('test', array($this->logHandler));
28 $wallabag->setLogger($logger);
29
30 if (false === $unsetUser) {
31 $wallabag->setUser($this->user);
32 }
33
34 return $wallabag;
35 }
36
37 public function testInit()
38 {
39 $wallabagV2Import = $this->getWallabagV2Import();
40
41 $this->assertEquals('wallabag v2', $wallabagV2Import->getName());
42 $this->assertNotEmpty($wallabagV2Import->getUrl());
43 $this->assertContains('This importer will import all your wallabag v2 articles.', $wallabagV2Import->getDescription());
44 }
45
46 public function testImport()
47 {
48 $wallabagV2Import = $this->getWallabagV2Import();
49 $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json');
50
51 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
52 ->disableOriginalConstructor()
53 ->getMock();
54
55 $entryRepo->expects($this->exactly(2))
56 ->method('findByUrlAndUserId')
57 ->will($this->onConsecutiveCalls(false, true, false));
58
59 $this->em
60 ->expects($this->any())
61 ->method('getRepository')
62 ->willReturn($entryRepo);
63
64 $res = $wallabagV2Import->import();
65
66 $this->assertTrue($res);
67 $this->assertEquals(['skipped' => 1, 'imported' => 1], $wallabagV2Import->getSummary());
68 }
69
70 public function testImportBadFile()
71 {
72 $wallabagV1Import = $this->getWallabagV2Import();
73 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.jsonx');
74
75 $res = $wallabagV1Import->import();
76
77 $this->assertFalse($res);
78
79 $records = $this->logHandler->getRecords();
80 $this->assertContains('WallabagImport: unable to read file', $records[0]['message']);
81 $this->assertEquals('ERROR', $records[0]['level_name']);
82 }
83
84 public function testImportUserNotDefined()
85 {
86 $wallabagV1Import = $this->getWallabagV2Import(true);
87 $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json');
88
89 $res = $wallabagV1Import->import();
90
91 $this->assertFalse($res);
92
93 $records = $this->logHandler->getRecords();
94 $this->assertContains('WallabagImport: user is not defined', $records[0]['message']);
95 $this->assertEquals('ERROR', $records[0]['level_name']);
96 }
97}
diff --git a/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v2.json b/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v2.json
new file mode 100644
index 00000000..49d782bc
--- /dev/null
+++ b/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v2.json
@@ -0,0 +1 @@
[{"id":"23","title":"Site d'information fran\u00e7ais d'actualit\u00e9s ind\u00e9pendant et participatif en ligne | Mediapart","url":"https:\/\/www.mediapart.fr\/","is_archived":false,"is_starred":false,"content":"<div alt=\"li\">\u00c9dition <a href=\"https:\/\/blogs.mediapart.fr\/edition\/camedia-0\">CAM\u00e9dia<\/a>\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/edition\/camedia\/article\/180116\/deux-nouvelles-editions-pour-debattre-dans-le-club-sur-la-laicite-et-sur-la-democratie\">Deux nouvelles \u00e9ditions pour d\u00e9battre dans le club sur la la\u00efcit\u00e9 et sur la d\u00e9mocratie<\/a><\/h3>\n<p>18 janv. 2016 | Par <\/p>\n<p>CAM\u00e9dia apr\u00e8s un \u00e9change sur \u00ab\u00a0l'\u00e9thique du d\u00e9bat\u00a0\u00bb a lanc\u00e9 deux discussions , l'une sur le th\u00e8me de la la\u00efcit\u00e9, l'autre ( encore en cours) sur celui de la d\u00e9mocratie. Nous sommes heureux de pouvoir signaler la cr\u00e9ation de deux nouvelles \u00e9ditions participatives sur ces th\u00e8mes. Nous vous invitons \u00e0 les lire et \u00e0 participer \u00e0 leurs d\u00e9bats.<\/p>\n<\/div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/lucile-longre\/blog\/170116\/de-limportance-de-rever-eloge-du-merveilleux\">De l'importance de r\u00eaver, \u00e9loge du merveilleux<\/a><\/h3>\n<p>17 janv. 2016 | Par <\/p>\n<p>Je parlerai ici des r\u00eaves comme moteur de vie, de ces r\u00eaves qui vous rattachent et vous font esp\u00e9rer \u00e0 ce qu\u2019il y a de plus humain dans l\u2019homme, m\u00eame au milieu de la plus noire des d\u00e9tresses.<\/p>\n<\/div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/barbara-romagnan\/blog\/180116\/fins-dune-toute-puissance\">Fin(s) d'une toute-puissance<\/a><\/h3>\n<p>18 janv. 2016 | Par <\/p>\n<p>En ce d\u00e9but d\u2019ann\u00e9e, je recommande la lecture du dernier ouvrage de Guillaume Duval, La France ne sera jamais plus une grande puissance ? Tant mieux !<\/p>\n<\/div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/jean-pierre-thibaudat\/blog\/170116\/l-allier-departement-de-destruction-massive-du-tissu-culturel\">L\u2019Allier, d\u00e9partement de destruction massive du tissu culturel<\/a><\/h3>\n<p>18 janv. 2016 | Par <\/p>\n<p>Les temps sont durs pour les petites structures, les associations culturelles qui, de bourgades en villages, travaillent au c\u0153ur des r\u00e9gions. Leurs subventions sont souvent revues \u00e0 la baisse. Le d\u00e9partement de l\u2019Allier les a carr\u00e9ment supprim\u00e9es. Pour favoriser \u00ab l\u2019\u00e9v\u00e9nementiel \u00bb.<\/p>\n<\/div><div alt=\"li\">\u00c9dition <a href=\"https:\/\/blogs.mediapart.fr\/edition\/les-invites-de-mediapart\">Les invit\u00e9s de Mediapart<\/a>\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/edition\/les-invites-de-mediapart\/article\/180116\/la-democratie-deja-attaquee-par-la-cooperation-reglementaire-transatlantiqu\">La d\u00e9mocratie d\u00e9j\u00e0 attaqu\u00e9e par la coop\u00e9ration r\u00e9glementaire transatlantique<\/a><\/h3>\n<p>18 janv. 2016 | Par <\/p>\n<p>Lora Verheecke et David Lundy travaillent pour Corporate Europe Observatory, une ONG bas\u00e9e \u00e0 Bruxelles qui enqu\u00eate sur le pouvoir des lobbies des grandes entreprises sur la politique de l\u2019Union europ\u00e9enne. Ils r\u00e9v\u00e8lent que depuis 25 ans le projet de \u00ab coop\u00e9ration r\u00e9glementaire \u00bb men\u00e9 par l\u2019Union europ\u00e9enne et les \u00c9tats-Unis a \u00e9t\u00e9 domin\u00e9 par les grandes entreprises. ET que le TTIP cherche \u00e0 ent\u00e9riner ce projet.<\/p>\n<\/div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/jacqueline-derens\/blog\/180116\/2016-une-annee-test-pour-jacob-zuma-et-son-gouvernement\">2016, une ann\u00e9e test pour Jacob Zuma et son gouvernement<\/a><\/h3>\n<p>18 janv. 2016 | Par <\/p>\n<p>Les turbulences de l\u2019an pass\u00e9 ont toutes les chances de continuer \u00e0 troubler le climat politique et social de l\u2019Afrique du Sud en 2016. La situation exige des changements profonds dans la conduite des affaires du pays. Jacob Zuma tout en admettant la n\u00e9cessit\u00e9 de ces changements, est-il l\u2019homme de la situation ? Son gouvernement r\u00e9pondra-t-il aux attentes des citoyens sud-africains ?<\/p>\n<\/div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/marie-cosnay\/blog\/140116\/un-mal-fou-janvier-2016\">Un mal fou (janvier 2016)<\/a><\/h3>\n<p>14 janv. 2016 | Par <\/p>\n<p>J\u2019ai une fringale d\u2019aventure, d\u2019aventures \u00e0 venir. J\u2019ai la fringale de la fringale des aventures et soudain, rupture. Je n\u2019y arrive plus, tout est bloqu\u00e9, tout emp\u00each\u00e9. Faut dire que depuis un an environ, tout est devenu plus compliqu\u00e9. Ecrire va de moins en moins de soi.<\/p>\n<\/div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/jean-pierre-veran\/blog\/170116\/redoublement-le-changement-bas-bruit\">Redoublement : le changement \u00e0 bas bruit ?<\/a><\/h3>\n<p>17 janv. 2016 | Par <\/p>\n<p>S\u2019il est une caract\u00e9ristique de la forme scolaire fran\u00e7aise bien \u00e9tablie dans la culture des personnels, des \u00e9l\u00e8ves et des parents, c\u2019est bien le redoublement, cens\u00e9 sanctionner des r\u00e9sultats insuffisants pour envisager le passage dans la classe sup\u00e9rieure. Or, en ce domaine, l\u2019\u00e9volution est nette.<\/p>\n<\/div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/michel-de-pracontal\/blog\/160116\/samedi-sciences-196-des-chasseurs-de-mammouths-en-arctique-il-y-45-000-ans\">Samedi-sciences (196): des chasseurs de mammouths en Arctique il y a 45 000 ans<\/a><\/h3>\n<p>16 janv. 2016 | Par <a href=\"https:\/\/blogs.mediapart.fr\/michel-de-pracontal\" class=\"journalist\">Michel de Pracontal<\/a><\/p>\n<p>Les restes d\u2019un mammouth retrouv\u00e9s en Arctique sib\u00e9rien, dat\u00e9s de 45 000 ans, portent les traces de blessures inflig\u00e9es par des chasseurs humains. Les scientifiques pensaient jusqu\u2019ici que notre esp\u00e8ce ne s\u2019\u00e9tait pas aventur\u00e9e dans cette r\u00e9gion glaciale il y a plus de 30 000 ou 35 0000 ans. En r\u00e9alit\u00e9, des hommes ont r\u00e9ussi \u00e0 survivre en Arctique au moins 10 000 ans plus t\u00f4t que l\u2019on croyait.<\/p>\n<\/div><div alt=\"li\">\n<h3 class=\"title\"><a href=\"https:\/\/blogs.mediapart.fr\/alain-zolty\/blog\/140116\/de-la-democratie-du-citoyen-et-de-lethique\">De la d\u00e9mocratie, du citoyen et de l'\u00e9thique<\/a><\/h3>\n<p>14 janv. 2016 | Par <\/p>\n<p>Trois ouvrages sont parus au Seuil, qui font \u00e9tat de la n\u00e9cessit\u00e9 d\u2019int\u00e9grer le citoyen dans la gouvernance de la nation. Non pas \u00e0 titre consultatif mais dot\u00e9 d\u2019un pouvoir d\u00e9lib\u00e9ratif pour constituer une contre-force face aux clans politico-financiers qui dominent la vie publique.<\/p>\n<\/div>","mimetype":"text\/html","language":"fr","reading_time":3,"domain_name":"www.mediapart.fr","preview_picture":"https:\/\/www.mediapart.fr\/images\/social\/800\/mediapart.png","tags":[]},{"id":22,"title":"R\u00e9fugi\u00e9s: l'UE va cr\u00e9er 100\u00a0000\u00a0places d'accueil dans les Balkans","url":"http:\/\/www.liberation.fr\/planete\/2015\/10\/26\/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867","is_archived":false,"is_starred":false,"content":"<p>Pour un sommet sur les r\u00e9fugi\u00e9s qui devait se concentrer sur des <em>\u00abmesures op\u00e9rationnelles imm\u00e9diates\u00bb<\/em> dans les Balkans, la r\u00e9union, dimanche \u00e0 Bruxelles, de 11\u00a0chefs d\u2019Etat et de gouvernement, dont 8 Europ\u00e9ens, a \u00e9t\u00e9 agit\u00e9e. D\u00e8s leur arriv\u00e9e, Viktor\u00a0Orb\u00e1n (Hongrie) et\u00a0Al\u00e9xis Ts\u00edpras (Gr\u00e8ce) se sont jet\u00e9 des anath\u00e8mes. Le Premier ministre grec a d\u00e9nonc\u00e9 l\u2019attitude <em>\u00abnot in my backyard\u00bb<\/em> (pas de \u00e7a chez moi) de certains Etats europ\u00e9ens, alors que son pays est montr\u00e9 du doigt par d\u2019autres dirigeants, dont\u00a0Orb\u00e1n\u00a0: ils reprochent \u00e0 la Gr\u00e8ce de ne pas suffisamment contr\u00f4ler ses fronti\u00e8res avec la Turquie et ne pas montrer assez de z\u00e8le dans l\u2019enregistrement des demandeurs d\u2019asile.<\/p>\n<p>Le sommet, convoqu\u00e9 par la Commission europ\u00e9enne, sur suggestion de l\u2019Allemagne, aura au moins permis \u00e0 ces 11\u00a0Etats \u2013\u00a0Autriche, Bulgarie, Croatie, Allemagne, Gr\u00e8ce, Hongrie, Roumanie, Slov\u00e9nie c\u00f4t\u00e9 europ\u00e9en, et 3 pays \u00abnon UE\u00bb, Albanie, Mac\u00e9doine et Serbie\u00a0\u2013 de discuter ensemble.<\/p>\n<h3>400\u00a0policiers europ\u00e9ens en Slov\u00e9nie<\/h3>\n<p>L\u2019objectif, rappel\u00e9 par Angela Merkel, \u00e9tait de trouver une <em>\u00abr\u00e9ponse coordonn\u00e9e\u00bb<\/em> \u00e0 la crise des r\u00e9fugi\u00e9s. Quelques mesures ont \u00e9t\u00e9 annonc\u00e9es\u00a0: 100\u00a0000\u00a0places d\u2019accueil seront cr\u00e9\u00e9es, dont 50\u00a0000 en Gr\u00e8ce, et le reste le long de la route des Balkans.\u00a0400\u00a0officiers de police de pays europ\u00e9ens partiront en Slov\u00e9nie, actuellement submerg\u00e9e, pour aider au contr\u00f4le des fronti\u00e8res. Frontex, l\u2019agence europ\u00e9enne de surveillance des fronti\u00e8res, s\u2019impliquera aux fronti\u00e8res gr\u00e9co-mac\u00e9donienne et gr\u00e9co-albanaise pour des contr\u00f4les et identifications.<\/p>\n<p>Ce sommet est intervenu dans un contexte de fortes tensions, marqu\u00e9 par des fermetures de fronti\u00e8res bloquant les r\u00e9fugi\u00e9s dans des zones tampon. Ces obstacles ont \u00e9t\u00e9 partiellement lev\u00e9s ces derniers jours, les autorit\u00e9s tentant d\u2019organiser un \u00abcorridor\u00bb informel vers l\u2019Allemagne, qui pourtant durcit sa politique d\u2019accueil et souhaite d\u00e9sormais ralentir le flux. Mais la situation des r\u00e9fugi\u00e9s est catastrophique. L\u2019ONG Human Rights Watch craint que des r\u00e9fugi\u00e9s ne meurent dans les Balkans. Des groupes de centaines, voire de milliers de personnes, bloqu\u00e9s pr\u00e8s des postes-fronti\u00e8res, se retrouvent dans des conditions humanitaires intenables.<\/p>\n<p>Depuis mi-septembre, 250\u00a0000\u00a0personnes ont travers\u00e9 les Balkans. En une semaine, la Slov\u00e9nie a vu 60\u00a0000\u00a0r\u00e9fugi\u00e9s fouler le sol de son territoire. Dimanche, 15\u00a0000\u00a0personnes ont transit\u00e9 en Slov\u00e9nie.<\/p>\n<h3>Des zones tampon<\/h3>\n<p>L\u2019enjeu principal du sommet, aux yeux de nombreux Etats de l\u2019Union europ\u00e9enne, \u00e9tait aussi que les pays des Balkans <em>\u00abprennent leur part\u00bb<\/em> face \u00e0 la crise\u00a0: qu\u2019ils accueillent et enregistrent davantage de r\u00e9fugi\u00e9s. Ces Etats craignent que l\u2019Autriche ou l\u2019Allemagne ne ferment leurs fronti\u00e8res et fassent de leurs pays des <em>\u00abzones tampon\u00bb<\/em>, comme s\u2019en inqui\u00e9tait Boyko Borissov, Premier ministre bulgare.<\/p>\n<p><em>\u00ab\u00a0Aujourd\u2019hui, plusieurs Etats du nord de l\u2019Europe veulent que l\u2019on enregistre les migrants puis que l\u2019on d\u00e9termine leur \u00e9ligibilit\u00e9 au statut de r\u00e9fugi\u00e9,<\/em> explique Marc Pierini, du think tank Carnegie Europe. <em>La difficult\u00e9, c\u2019est que les gens sont en mouvement. Pour le faire, il faut se poser quelque part. La crainte des pays interm\u00e9diaires, donc ceux des Balkans, est qu\u2019on enregistre ces personnes sur leur territoire et qu\u2019ils soient contraints de rester sur leur sol. Donc les pays des Balkans ne sont pas d\u00e9sireux d\u2019accueillir ces r\u00e9fugi\u00e9s et ces derniers veulent avancer.\u00bb<\/em><\/p>\n<p>Le sommet a \u00e9labor\u00e9 quelques principes. L\u2019id\u00e9e g\u00e9n\u00e9rale est de rendre effective la \u00ablogique de hotspot\u00bb\u00a0: un enregistrement des demandeurs d\u2019asile \u00e0 leur point d\u2019entr\u00e9e dans l\u2019Union europ\u00e9enne, suivi de l\u2019expulsion de ceux qui ne correspondraient pas aux crit\u00e8res de la Convention de Gen\u00e8ve, et la r\u00e9partition des autres, via le m\u00e9canisme de relocalisation.<\/p>\n<p>Dans ce cadre, l\u2019enregistrement des demandeurs d\u2019asile est un \u00e9l\u00e9ment cl\u00e9. <em>\u00abPas d\u2019enregistrement, pas de droit\u00bb<\/em>, a pr\u00e9venu le pr\u00e9sident de la Commission europ\u00e9enne, Jean-Claude Juncker, dimanche soir. Les Etats ont tenu \u00e0 rappeler que les migrants qui refusent de demander l\u2019asile \u00e0 la fronti\u00e8re peuvent se voir refuser l\u2019entr\u00e9e dans un pays.<\/p>\n<p>Et les Etats <em>\u00abd\u00e9courageront les mouvements de r\u00e9fugi\u00e9s\u00bb<\/em> de fronti\u00e8re en fronti\u00e8re. La politique consistant \u00e0 laisser passer les migrants vers un autre pays est officiellement jug\u00e9e <em>\u00abinacceptable\u00bb<\/em>.<\/p>\n<h3>Se jeter dans la gueule du loup<\/h3>\n<p>Voil\u00e0 pour la th\u00e9orie. En pratique, la relocalisation ne devrait concerner que 160\u00a0000\u00a0r\u00e9fugi\u00e9s en deux\u00a0ans, alors que pr\u00e8s de 700\u00a0000\u00a0personnes sont arriv\u00e9es en Europe depuis le d\u00e9but de l\u2019ann\u00e9e. De plus, les Etats ne jouent pas le jeu. La semaine pass\u00e9e, seules 854\u00a0places de relocalisation avaient \u00e9t\u00e9 propos\u00e9es.<\/p>\n<p>Dans ce contexte, il est probable que les Etats des Balkans ne s\u2019impliqueront pas outre mesure dans les solutions propos\u00e9es, craignant de devoir \u00abgarder\u00bb les r\u00e9fugi\u00e9s alors que l\u2019Union europ\u00e9enne tarde \u00e0 mettre en \u0153uvre leur r\u00e9partition.<\/p>\n<p>Quant aux r\u00e9fugi\u00e9s, ils pr\u00e9f\u00e8rent traverser les fronti\u00e8res par eux-m\u00eames, plut\u00f4t que de se jeter dans ces \u00abhotspots\u00bb, consid\u00e9r\u00e9s comme la gueule du loup.<\/p>\n<a itemprop=\"name\" href=\"http:\/\/www.liberation.fr\/auteur\/15743-cedric-vallet\">C\u00e9dric Vallet<\/a>","mimetype":"text\/html","language":"fr","reading_time":4,"domain_name":"www.liberation.fr","preview_picture":"http:\/\/md1.libe.com\/photo\/820275-migrants-et-refugies-se-dirigent-vers-la-frontiere-entre-la-slovenie-et-l-autriche-le-23-octobre-201.jpg?modified_at=1445855324&amp;width=750","tags":[]}]