mirror of
https://github.com/wallabag/wallabag.git
synced 2025-10-15 19:42:08 +00:00
If reload content failed, don’t update it
In case user wants a fresh version of the current one and the website isn’t available, don’t erase it with a boring message saying wallabag wasn’t able to refresh the content.
This commit is contained in:
parent
7180aaed45
commit
2297d60f10
6 changed files with 55 additions and 2 deletions
|
@ -330,6 +330,15 @@ class EntryController extends Controller
|
|||
|
||||
$this->updateEntry($entry, 'entry_reloaded');
|
||||
|
||||
// if refreshing entry failed, don't save it
|
||||
if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) {
|
||||
$bag = $this->get('session')->getFlashBag();
|
||||
$bag->clear();
|
||||
$bag->add('notice', 'flashes.entry.notice.entry_reloaded_failed');
|
||||
|
||||
return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
|
||||
}
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
|
|
@ -39,6 +39,8 @@ class Configuration implements ConfigurationInterface
|
|||
->integerNode('cache_lifetime')
|
||||
->defaultValue(10)
|
||||
->end()
|
||||
->scalarNode('fetching_error_message')
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ class WallabagCoreExtension extends Extension
|
|||
$container->setParameter('wallabag_core.version', $config['version']);
|
||||
$container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
|
||||
$container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']);
|
||||
$container->setParameter('wallabag_core.fetching_error_message', $config['fetching_error_message']);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.yml');
|
||||
|
|
|
@ -40,7 +40,7 @@ services:
|
|||
class: Graby\Graby
|
||||
arguments:
|
||||
-
|
||||
error_message: "wallabag can't retrieve contents for this article. Please report this issue to us."
|
||||
error_message: '%wallabag_core.fetching_error_message%'
|
||||
http_client:
|
||||
user_agents:
|
||||
'lifehacker.com': 'PHP/5.2'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue