change caching to save xml data, remove RDF init section

This commit is contained in:
Andrew Dolgov 2013-05-01 17:56:21 +04:00
parent 04d2f9c831
commit b8f316dc28
2 changed files with 6 additions and 10 deletions

View File

@ -63,9 +63,6 @@ class FeedParser {
array_push($this->items, new FeedItem_Atom($article)); array_push($this->items, new FeedItem_Atom($article));
} }
break;
case $this::FEED_RDF:
break; break;
case $this::FEED_RSS: case $this::FEED_RSS:

View File

@ -245,7 +245,7 @@
$date_feed_processed = date('Y-m-d H:i'); $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. // 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; $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); _debug("using local cache.", $debug_enabled);
if ($cache_timestamp > $last_article_timestamp) { if ($cache_timestamp > $last_article_timestamp) {
@$rss_data = file_get_contents($cache_filename); @$feed_data = file_get_contents($cache_filename);
if ($rss_data) { if ($feed_data) {
$rss_hash = sha1($rss_data); $rss_hash = sha1($feed_data);
@$rss = unserialize($rss_data);
} }
} else if (!$force_refetch) { } else if (!$force_refetch) {
_debug("local cache valid and older than last_updated, nothing to do.", $debug_enabled); _debug("local cache valid and older than last_updated, nothing to do.", $debug_enabled);
@ -385,9 +384,9 @@
$rss_data = serialize($rss); $rss_data = serialize($rss);
$new_rss_hash = sha1($rss_data); $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); _debug("saving $cache_filename", $debug_enabled);
//@file_put_contents($cache_filename, serialize($rss)); NOT YET @file_put_contents($cache_filename, $rss_data);
} }
} }