From 5da7c036422a8e5544da1da16e3ec7c5edb3c6a0 Mon Sep 17 00:00:00 2001 From: emkael Date: Sun, 15 Oct 2017 23:07:37 +0200 Subject: * updates to RSS-to-RSS proxy --- providers/Rss.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/providers/Rss.php b/providers/Rss.php index 6fdae6c..9f64088 100644 --- a/providers/Rss.php +++ b/providers/Rss.php @@ -7,8 +7,6 @@ require_once('Item.php'); class Rss extends \Providers\Provider { - protected $_cacheTimeout = '1 second'; - private $_feedUrl; private $_feedXml; @@ -61,7 +59,17 @@ class Rss extends \Providers\Provider { } public function title() { - return strval($this->_feedXml->title ?: $this->_feedXml->channel->title); + $cacheFile = sprintf($this->_getCachePath() . '.title', $this->_feed); + if (!file_exists($cacheFile)) { + $this->_fetchItems(); + } + if ($this->_feedXml) { + $title = strval($this->_feedXml->title ?: $this->_feedXml->channel->title); + file_put_contents($cacheFile, $title); + return $title; + } else { + return file_get_contents($cacheFile); + } } } -- cgit v1.2.3