]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ImportBundle/Import/WallabagV1Import.php
Replace Wallabag v1 error strings with v2 strings
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Import / WallabagV1Import.php
index 59e3ce026c0ae6d76b79c5f9535d36be11ece5d1..872fd642f5b6465773773cd5d8584547de56dbca 100644 (file)
@@ -4,6 +4,17 @@ namespace Wallabag\ImportBundle\Import;
 
 class WallabagV1Import extends WallabagImport
 {
+    protected $fetchingErrorMessage;
+    protected $fetchingErrorMessageTitle;
+
+    public function __construct($em, $contentProxy, $eventDispatcher, $fetchingErrorMessageTitle, $fetchingErrorMessage)
+    {
+        $this->fetchingErrorMessageTitle = $fetchingErrorMessageTitle;
+        $this->fetchingErrorMessage = $fetchingErrorMessage;
+
+        parent::__construct($em, $contentProxy, $eventDispatcher);
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -43,10 +54,11 @@ class WallabagV1Import extends WallabagImport
             'created_at' => '',
         ];
 
-        // force content to be refreshed in case on bad fetch in the v1 installation
+        // In case of a bad fetch in v1, replace title and content with v2 error strings
+        // If fetching fails again, they will get this instead of the v1 strings
         if (in_array($entry['title'], $this->untitled)) {
-            $data['title'] = '';
-            $data['html'] = '';
+            $data['title'] = $this->fetchingErrorMessageTitle;
+            $data['html'] = $this->fetchingErrorMessage;
         }
 
         if (array_key_exists('tags', $entry) && $entry['tags'] != '') {