diff options
author | Jerome Charaoui <jerome@riseup.net> | 2016-12-16 09:46:21 -0500 |
---|---|---|
committer | Jeremy Benoist <jbenoist@20minutes.fr> | 2017-06-01 09:48:14 +0200 |
commit | 704803e182068923eba16f3dc451e9231f15ecb5 (patch) | |
tree | 4f12c0a34fee66bd40170ae268d3741592eedd90 /src/Wallabag/ImportBundle/Import | |
parent | d0e9b3d640acce49068d1a2c5603b92c1bda363e (diff) | |
download | wallabag-704803e182068923eba16f3dc451e9231f15ecb5.tar.gz wallabag-704803e182068923eba16f3dc451e9231f15ecb5.tar.zst wallabag-704803e182068923eba16f3dc451e9231f15ecb5.zip |
Replace Wallabag v1 error strings with v2 strings
Diffstat (limited to 'src/Wallabag/ImportBundle/Import')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/WallabagV1Import.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 59e3ce02..872fd642 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php | |||
@@ -4,6 +4,17 @@ namespace Wallabag\ImportBundle\Import; | |||
4 | 4 | ||
5 | class WallabagV1Import extends WallabagImport | 5 | class WallabagV1Import extends WallabagImport |
6 | { | 6 | { |
7 | protected $fetchingErrorMessage; | ||
8 | protected $fetchingErrorMessageTitle; | ||
9 | |||
10 | public function __construct($em, $contentProxy, $eventDispatcher, $fetchingErrorMessageTitle, $fetchingErrorMessage) | ||
11 | { | ||
12 | $this->fetchingErrorMessageTitle = $fetchingErrorMessageTitle; | ||
13 | $this->fetchingErrorMessage = $fetchingErrorMessage; | ||
14 | |||
15 | parent::__construct($em, $contentProxy, $eventDispatcher); | ||
16 | } | ||
17 | |||
7 | /** | 18 | /** |
8 | * {@inheritdoc} | 19 | * {@inheritdoc} |
9 | */ | 20 | */ |
@@ -43,10 +54,11 @@ class WallabagV1Import extends WallabagImport | |||
43 | 'created_at' => '', | 54 | 'created_at' => '', |
44 | ]; | 55 | ]; |
45 | 56 | ||
46 | // force content to be refreshed in case on bad fetch in the v1 installation | 57 | // In case of a bad fetch in v1, replace title and content with v2 error strings |
58 | // If fetching fails again, they will get this instead of the v1 strings | ||
47 | if (in_array($entry['title'], $this->untitled)) { | 59 | if (in_array($entry['title'], $this->untitled)) { |
48 | $data['title'] = ''; | 60 | $data['title'] = $this->fetchingErrorMessageTitle; |
49 | $data['html'] = ''; | 61 | $data['html'] = $this->fetchingErrorMessage; |
50 | } | 62 | } |
51 | 63 | ||
52 | if (array_key_exists('tags', $entry) && $entry['tags'] != '') { | 64 | if (array_key_exists('tags', $entry) && $entry['tags'] != '') { |