gérer exception sur lecture de rss (ref #197)
This commit is contained in:
parent
ececb38afe
commit
cbbd67c6ea
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 |
|
@ -1004,7 +1004,14 @@ class PagewidgetController extends Controller
|
||||||
$logger = new \Psr\Log\NullLogger();
|
$logger = new \Psr\Log\NullLogger();
|
||||||
$feedIo = new \FeedIo\FeedIo($client, $logger);
|
$feedIo = new \FeedIo\FeedIo($client, $logger);
|
||||||
|
|
||||||
|
try {
|
||||||
$result = $feedIo->read($url);
|
$result = $feedIo->read($url);
|
||||||
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
|
$result=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($result) {
|
||||||
$feedtitle = $result->getFeed()->getTitle();
|
$feedtitle = $result->getFeed()->getTitle();
|
||||||
|
|
||||||
|
|
||||||
|
@ -1085,6 +1092,7 @@ class PagewidgetController extends Controller
|
||||||
$filesystem->dumpFile($filecache, serialize($backup));
|
$filesystem->dumpFile($filecache, serialize($backup));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Trie des fluxs
|
// Trie des fluxs
|
||||||
$fluxsordered = $fluxs->getIterator();
|
$fluxsordered = $fluxs->getIterator();
|
||||||
|
@ -1218,7 +1226,14 @@ class PagewidgetController extends Controller
|
||||||
$feeds=array();
|
$feeds=array();
|
||||||
|
|
||||||
// On lit le flux rss
|
// On lit le flux rss
|
||||||
|
try {
|
||||||
$result = $feedIo->read($url);
|
$result = $feedIo->read($url);
|
||||||
|
}
|
||||||
|
catch (\Exception $e) {
|
||||||
|
$result=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($result) {
|
||||||
$feedtitle = $result->getFeed()->getTitle();
|
$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
|
// 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));
|
$filesystem->dumpFile($filecache, serialize($feeds));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
return $this->render($this->labelentity.':viewflux.html.twig', [
|
return $this->render($this->labelentity.':viewflux.html.twig', [
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
|
|
||||||
{% set firstflux="" %}
|
{% set firstflux="" %}
|
||||||
|
|
||||||
{% if fluxs is defined and fluxs is not empty %}
|
|
||||||
<div class="widgetbody" style="{{ stylewidgetbody }} ">
|
<div class="widgetbody" style="{{ stylewidgetbody }} ">
|
||||||
{% if fluxs is defined %}
|
{% if fluxs is defined %}
|
||||||
{% if fluxs|length > 1 %}
|
{% if fluxs|length > 1 %}
|
||||||
|
@ -117,7 +116,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue