]> git.wh0rd.org Git - tt-rss.git/commitdiff
change caching to save xml data, remove RDF init section
authorAndrew Dolgov <fox@fakecake.org>
Wed, 1 May 2013 13:56:21 +0000 (17:56 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Wed, 1 May 2013 13:56:21 +0000 (17:56 +0400)
classes/feedparser.php
include/rssfuncs.php

index fb6344cc02b1bb815863cb45b3fd24a4c4a10410..ed284a0437cbf6c469b5296130f7aa8b437260c5 100644 (file)
@@ -63,9 +63,6 @@ class FeedParser {
                                        array_push($this->items, new FeedItem_Atom($article));
                                }
 
-                               break;
-                       case $this::FEED_RDF:
-
                                break;
                        case $this::FEED_RSS:
 
index ec0ca5a4f1d05307461a40032549e9e188350c9a..21040e5a78d7fc2bb276c2a11492f6b129ac7d9e 100644 (file)
 
                $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;
                                _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);
                                $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);
                                }
                        }