X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FImport%2FWallabagV1Import.php;h=a35c411e45110024a854d5c9c180e4d078eb87bb;hb=3ef055ced3d6ea0d2f15ba660602545f477e9c3c;hp=59e3ce026c0ae6d76b79c5f9535d36be11ece5d1;hpb=6fb06904ecde15b1b07d0a2af945338b416cf0e2;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 59e3ce02..a35c411e 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php @@ -4,6 +4,17 @@ namespace Wallabag\ImportBundle\Import; class WallabagV1Import extends WallabagImport { + protected $fetchingErrorMessage; + protected $fetchingErrorMessageTitle; + + public function __construct($em, $contentProxy, $tagsAssigner, $eventDispatcher, $fetchingErrorMessageTitle, $fetchingErrorMessage) + { + $this->fetchingErrorMessageTitle = $fetchingErrorMessageTitle; + $this->fetchingErrorMessage = $fetchingErrorMessage; + + parent::__construct($em, $contentProxy, $tagsAssigner, $eventDispatcher); + } + /** * {@inheritdoc} */ @@ -43,13 +54,14 @@ class WallabagV1Import extends WallabagImport 'created_at' => '', ]; - // force content to be refreshed in case on bad fetch in the v1 installation - if (in_array($entry['title'], $this->untitled)) { - $data['title'] = ''; - $data['html'] = ''; + // 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, true)) { + $data['title'] = $this->fetchingErrorMessageTitle; + $data['html'] = $this->fetchingErrorMessage; } - if (array_key_exists('tags', $entry) && $entry['tags'] != '') { + if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; }