From: Andrew Dolgov Date: Wed, 1 May 2013 13:56:21 +0000 (+0400) Subject: change caching to save xml data, remove RDF init section X-Git-Tag: 1.7.9~25^2~45 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b8f316dc288d759938aaae1e49d4bd2093dc99a2;p=tt-rss.git change caching to save xml data, remove RDF init section --- diff --git a/classes/feedparser.php b/classes/feedparser.php index fb6344cc..ed284a04 100644 --- a/classes/feedparser.php +++ b/classes/feedparser.php @@ -63,9 +63,6 @@ class FeedParser { array_push($this->items, new FeedItem_Atom($article)); } - break; - case $this::FEED_RDF: - break; case $this::FEED_RSS: diff --git a/include/rssfuncs.php b/include/rssfuncs.php index ec0ca5a4..21040e5a 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -245,7 +245,7 @@ $date_feed_processed = date('Y-m-d H:i'); - $cache_filename = CACHE_DIR . "/simplepie/" . sha1($fetch_url) . ".feed"; + $cache_filename = CACHE_DIR . "/simplepie/" . sha1($fetch_url) . ".feed2"; // Ignore cache if new feed or manual update. $cache_age = ($no_cache || is_null($last_updated) || strpos($last_updated, '1970-01-01') === 0) ? 30 : get_feed_update_interval($feed) * 60; @@ -269,11 +269,10 @@ _debug("using local cache.", $debug_enabled); if ($cache_timestamp > $last_article_timestamp) { - @$rss_data = file_get_contents($cache_filename); + @$feed_data = file_get_contents($cache_filename); - if ($rss_data) { - $rss_hash = sha1($rss_data); - @$rss = unserialize($rss_data); + if ($feed_data) { + $rss_hash = sha1($feed_data); } } else if (!$force_refetch) { _debug("local cache valid and older than last_updated, nothing to do.", $debug_enabled); @@ -385,9 +384,9 @@ $rss_data = serialize($rss); $new_rss_hash = sha1($rss_data); - if ($new_rss_hash != $rss_hash) { + if ($new_rss_hash != $rss_hash && count($rss->get_items()) > 0 ) { _debug("saving $cache_filename", $debug_enabled); - //@file_put_contents($cache_filename, serialize($rss)); NOT YET + @file_put_contents($cache_filename, $rss_data); } }