gérer exception sur lecture de rss (ref #197)

This commit is contained in:
afornerot 2020-09-02 11:44:22 +02:00
parent ececb38afe
commit cbbd67c6ea
4 changed files with 166 additions and 151 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1004,7 +1004,14 @@ class PagewidgetController extends Controller
$logger = new \Psr\Log\NullLogger();
$feedIo = new \FeedIo\FeedIo($client, $logger);
try {
$result = $feedIo->read($url);
}
catch (\Exception $e) {
$result=null;
}
if($result) {
$feedtitle = $result->getFeed()->getTitle();
@ -1085,6 +1092,7 @@ class PagewidgetController extends Controller
$filesystem->dumpFile($filecache, serialize($backup));
}
}
}
// Trie des fluxs
$fluxsordered = $fluxs->getIterator();
@ -1218,7 +1226,14 @@ class PagewidgetController extends Controller
$feeds=array();
// On lit le flux rss
try {
$result = $feedIo->read($url);
}
catch (\Exception $e) {
$result=null;
}
if($result) {
$feedtitle = $result->getFeed()->getTitle();
@ -1295,6 +1310,7 @@ class PagewidgetController extends Controller
// On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn
$filesystem->dumpFile($filecache, serialize($feeds));
}
}
// Render
return $this->render($this->labelentity.':viewflux.html.twig', [

View File

@ -56,7 +56,6 @@
{% set firstflux="" %}
{% if fluxs is defined and fluxs is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }} ">
{% if fluxs is defined %}
{% if fluxs|length > 1 %}
@ -117,7 +116,7 @@
{% endfor %}
</div>
</div>
{% endif %}
</div>