aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-30 21:30:45 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-30 21:30:45 +0100
commitd1495dd0a456f0e35a09fb68679ee51f8d17bfe4 (patch)
treea819eec38d3d8b880460cbaca42b6e08b073585a /src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php
parent309e13c11b54277626f18616c41f68ae9656a403 (diff)
downloadwallabag-d1495dd0a456f0e35a09fb68679ee51f8d17bfe4.tar.gz
wallabag-d1495dd0a456f0e35a09fb68679ee51f8d17bfe4.tar.zst
wallabag-d1495dd0a456f0e35a09fb68679ee51f8d17bfe4.zip
Ability to enable/disable downloading images
This will speed up the test suite because it won’t download everything when we add new entry… Add a custom test with downloading image enabled
Diffstat (limited to 'src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php')
-rw-r--r--src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php
index 0792653e..3f2d460c 100644
--- a/src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php
+++ b/src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php
@@ -52,6 +52,10 @@ class DownloadImagesSubscriber implements EventSubscriber
52 $config = new $this->configClass(); 52 $config = new $this->configClass();
53 $config->setEntityManager($args->getEntityManager()); 53 $config->setEntityManager($args->getEntityManager());
54 54
55 if (!$config->get('download_images_enabled')) {
56 return;
57 }
58
55 // field content has been updated 59 // field content has been updated
56 if ($args->hasChangedField('content')) { 60 if ($args->hasChangedField('content')) {
57 $html = $this->downloadImages($config, $entity); 61 $html = $this->downloadImages($config, $entity);
@@ -87,6 +91,10 @@ class DownloadImagesSubscriber implements EventSubscriber
87 $config = new $this->configClass(); 91 $config = new $this->configClass();
88 $config->setEntityManager($args->getEntityManager()); 92 $config->setEntityManager($args->getEntityManager());
89 93
94 if (!$config->get('download_images_enabled')) {
95 return;
96 }
97
90 // update all images inside the html 98 // update all images inside the html
91 $html = $this->downloadImages($config, $entity); 99 $html = $this->downloadImages($config, $entity);
92 if (false !== $html) { 100 if (false !== $html) {