diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/ContentProxy.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/ContentProxy.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 7fb41393..3d585e61 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Helper; | 3 | namespace Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Graby\Graby; | 5 | use Graby\Graby; |
6 | use Psr\Log\LoggerInterface as Logger; | ||
6 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
7 | use Wallabag\CoreBundle\Tools\Utils; | 8 | use Wallabag\CoreBundle\Tools\Utils; |
8 | 9 | ||
@@ -13,10 +14,14 @@ use Wallabag\CoreBundle\Tools\Utils; | |||
13 | class ContentProxy | 14 | class ContentProxy |
14 | { | 15 | { |
15 | protected $graby; | 16 | protected $graby; |
17 | protected $tagger; | ||
18 | protected $logger; | ||
16 | 19 | ||
17 | public function __construct(Graby $graby) | 20 | public function __construct(Graby $graby, RuleBasedTagger $tagger, Logger $logger) |
18 | { | 21 | { |
19 | $this->graby = $graby; | 22 | $this->graby = $graby; |
23 | $this->tagger = $tagger; | ||
24 | $this->logger = $logger; | ||
20 | } | 25 | } |
21 | 26 | ||
22 | /** | 27 | /** |
@@ -59,6 +64,15 @@ class ContentProxy | |||
59 | $entry->setPreviewPicture($content['open_graph']['og_image']); | 64 | $entry->setPreviewPicture($content['open_graph']['og_image']); |
60 | } | 65 | } |
61 | 66 | ||
67 | try { | ||
68 | $this->tagger->tag($entry); | ||
69 | } catch (\Exception $e) { | ||
70 | $this->logger->error('Error while trying to automatically tag an entry.', array( | ||
71 | 'entry_url' => $url, | ||
72 | 'error_msg' => $e->getMessage(), | ||
73 | )); | ||
74 | } | ||
75 | |||
62 | return $entry; | 76 | return $entry; |
63 | } | 77 | } |
64 | } | 78 | } |