aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-02-01 14:04:37 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-02-01 14:04:37 +0100
commitcf8ee6bd48221e73b515922e75945e9aa763f907 (patch)
tree75d86ec2448118fd6e9dc3b6859f5dd8594d9de2 /app/Models/Feed.php
parent5e9c60752c9a40e1540de50d02e19ba1d06e5491 (diff)
Rafraîchissement des flux en cache super rapide
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/351#issuecomment-31755012 Les flux non-modifiés et en cache ne coûtent maintenant presque plus rien (304, ou délai de cache SimplePie non expiré), alors qu'avant toutes les entrées étaient rechargées
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 22c019080..662476b7e 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -193,10 +193,10 @@ class FreshRSS_Feed extends Minz_Model {
}
$feed = customSimplePie();
$feed->set_feed_url ($url);
- $feed->init ();
+ $initResult = $feed->init ();
- if ($feed->error ()) {
- throw new FreshRSS_Feed_Exception ($feed->error . ' [' . $url . ']');
+ if ((!$initResult) || $feed->error()) {
+ throw new FreshRSS_Feed_Exception ($feed->error() . ' [' . $url . ']');
}
// si on a utilisé l'auto-discover, notre url va avoir changé
@@ -217,11 +217,15 @@ class FreshRSS_Feed extends Minz_Model {
$this->_description(html_only_entity_decode($feed->get_description()));
}
- // et on charge les articles du flux
- $this->loadEntries ($feed);
+ if (($initResult == SIMPLEPIE_INIT_SUCCESS) || $loadDetails) {
+ $this->loadEntries($feed); // et on charge les articles du flux
+ } else {
+ $this->entries = array();
+ }
}
}
}
+
private function loadEntries ($feed) {
$entries = array ();