aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2016-10-21 15:12:29 +0200
committerGitHub <noreply@github.com>2016-10-21 15:12:29 +0200
commit49dee2d2de63af36248e92ce740da2692358280e (patch)
tree01649e5e6fcfeadeb61cc56408a03658be85a69a /src/Wallabag
parent7180aaed45dce62e40620a9e4b202526ebd6a3bb (diff)
parentf6798f69c3f3d6f4f8295f8168785ade6f1f125a (diff)
downloadwallabag-49dee2d2de63af36248e92ce740da2692358280e.tar.gz
wallabag-49dee2d2de63af36248e92ce740da2692358280e.tar.zst
wallabag-49dee2d2de63af36248e92ce740da2692358280e.zip
Merge pull request #2482 from wallabag/avoid-bad-refresh
If reload content failed, don’t update it
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php9
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/Configuration.php2
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php1
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml2
4 files changed, 13 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 3b28e635..97bb3d12 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -330,6 +330,15 @@ class EntryController extends Controller
330 330
331 $this->updateEntry($entry, 'entry_reloaded'); 331 $this->updateEntry($entry, 'entry_reloaded');
332 332
333 // if refreshing entry failed, don't save it
334 if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) {
335 $bag = $this->get('session')->getFlashBag();
336 $bag->clear();
337 $bag->add('notice', 'flashes.entry.notice.entry_reloaded_failed');
338
339 return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
340 }
341
333 $em = $this->getDoctrine()->getManager(); 342 $em = $this->getDoctrine()->getManager();
334 $em->persist($entry); 343 $em->persist($entry);
335 $em->flush(); 344 $em->flush();
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
index d8141eea..3a3da024 100644
--- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
+++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
@@ -39,6 +39,8 @@ class Configuration implements ConfigurationInterface
39 ->integerNode('cache_lifetime') 39 ->integerNode('cache_lifetime')
40 ->defaultValue(10) 40 ->defaultValue(10)
41 ->end() 41 ->end()
42 ->scalarNode('fetching_error_message')
43 ->end()
42 ->end() 44 ->end()
43 ; 45 ;
44 46
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
index 0cbde908..b4992d54 100644
--- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
+++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
@@ -23,6 +23,7 @@ class WallabagCoreExtension extends Extension
23 $container->setParameter('wallabag_core.version', $config['version']); 23 $container->setParameter('wallabag_core.version', $config['version']);
24 $container->setParameter('wallabag_core.paypal_url', $config['paypal_url']); 24 $container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
25 $container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']); 25 $container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']);
26 $container->setParameter('wallabag_core.fetching_error_message', $config['fetching_error_message']);
26 27
27 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); 28 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
28 $loader->load('services.yml'); 29 $loader->load('services.yml');
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index a4b727f4..614488a6 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -40,7 +40,7 @@ services:
40 class: Graby\Graby 40 class: Graby\Graby
41 arguments: 41 arguments:
42 - 42 -
43 error_message: "wallabag can't retrieve contents for this article. Please report this issue to us." 43 error_message: '%wallabag_core.fetching_error_message%'
44 http_client: 44 http_client:
45 user_agents: 45 user_agents:
46 'lifehacker.com': 'PHP/5.2' 46 'lifehacker.com': 'PHP/5.2'