1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-26 18:21:02 +00:00

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
This commit is contained in:
Jeremy Benoist 2016-10-30 21:30:45 +01:00
parent 309e13c11b
commit d1495dd0a4
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
4 changed files with 78 additions and 0 deletions

View file

@ -398,6 +398,21 @@ class InstallCommand extends ContainerAwareCommand
'value' => 'wallabag',
'section' => 'misc',
],
[
'name' => 'download_images_enabled',
'value' => '0',
'section' => 'image',
],
[
'name' => 'download_images_with_rabbitmq',
'value' => '0',
'section' => 'image',
],
[
'name' => 'download_images_with_redis',
'value' => '0',
'section' => 'image',
],
];
foreach ($settings as $setting) {

View file

@ -140,6 +140,21 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
'value' => 'wallabag',
'section' => 'misc',
],
[
'name' => 'download_images_enabled',
'value' => '0',
'section' => 'image',
],
[
'name' => 'download_images_with_rabbitmq',
'value' => '0',
'section' => 'image',
],
[
'name' => 'download_images_with_redis',
'value' => '0',
'section' => 'image',
],
];
foreach ($settings as $setting) {

View file

@ -52,6 +52,10 @@ class DownloadImagesSubscriber implements EventSubscriber
$config = new $this->configClass();
$config->setEntityManager($args->getEntityManager());
if (!$config->get('download_images_enabled')) {
return;
}
// field content has been updated
if ($args->hasChangedField('content')) {
$html = $this->downloadImages($config, $entity);
@ -87,6 +91,10 @@ class DownloadImagesSubscriber implements EventSubscriber
$config = new $this->configClass();
$config->setEntityManager($args->getEntityManager());
if (!$config->get('download_images_enabled')) {
return;
}
// update all images inside the html
$html = $this->downloadImages($config, $entity);
if (false !== $html) {