]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix image caching not working on plugin-rewritten content; remove content cache stuff
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 4 Feb 2013 09:00:50 +0000 (13:00 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 4 Feb 2013 09:00:50 +0000 (13:00 +0400)
classes/pref/feeds.php
include/rssfuncs.php

index 31373c972ddda9647ad408cd96cfd0d28a486aaf..52d5e89aa7ce4874da8b0107c344115439064a25 100644 (file)
@@ -642,23 +642,6 @@ class Pref_Feeds extends Handler_Protected {
                        $checked>&nbsp;<label for=\"cache_images\">".
                __('Cache images locally')."</label>";
 
-
-               if (defined('_FEEDS_CONTENT_CACHE') && _FEEDS_CONTENT_CACHE) {
-                       $cache_content = sql_bool_to_bool(db_fetch_result($result, 0, "cache_content"));
-
-                       if ($cache_content) {
-                               $checked = "checked=\"1\"";
-                       } else {
-                               $checked = "";
-                       }
-
-                       print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"cache_content\"
-               name=\"cache_content\"
-                               $checked>&nbsp;<label for=\"cache_content\">".
-                       __('Cache content locally')."</label>";
-
-               }
-
                $mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
 
                if ($mark_unread_on_update) {
index 8500df0df718626c5e511fd5308d38600f96ba2a..a3cb94c7073856a91dbcd492ed073f4dd4c5e1d3 100644 (file)
                }
 
                $result = db_query($link, "SELECT id,update_interval,auth_login,
-                       feed_url,auth_pass,cache_images,last_updated,cache_content,
+                       feed_url,auth_pass,cache_images,last_updated,
                        mark_unread_on_update, owner_uid, update_on_checksum_change,
                        pubsub_state
                        FROM ttrss_feeds WHERE id = '$feed'");
                $auth_pass = db_fetch_result($result, 0, "auth_pass");
 
                $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
-               $cache_content = sql_bool_to_bool(db_fetch_result($result, 0, "cache_content"));
                $fetch_url = db_fetch_result($result, 0, "feed_url");
 
                $feed = db_escape_string($feed);
                                $entry_content = $item->get_content();
                                if (!$entry_content) $entry_content = $item->get_description();
 
-                               if ($cache_images && is_writable(CACHE_DIR . '/images'))
-                                       $entry_content = cache_images($entry_content, $site_url, $debug_enabled);
-
                                if ($_REQUEST["xdebug"] == 2) {
                                        print "update_rss_feed: content: ";
                                        print $entry_content;
                                        print "\n";
                                }
 
-                               $entry_cached_content = "";
-
                                $entry_comments = $item->data["comments"];
 
                                if ($item->get_author()) {
                                $entry_author = db_escape_string($article["author"]);
                                $entry_link = db_escape_string($article["link"]);
 
+                               if ($cache_images && is_writable(CACHE_DIR . '/images'))
+                                       $entry_content = cache_images($entry_content, $site_url, $debug_enabled);
+
                                $content_hash = "SHA1:" . sha1($entry_content);
 
                                db_query($link, "BEGIN");
                                                _debug("update_rss_feed: base guid [$entry_guid] not found");
                                        }
 
-                                       if (defined('_FEEDS_CONTENT_CACHE') && _FEEDS_CONTENT_CACHE && $cache_content) {
-                                               if ($debug_enabled) {
-                                                       _debug("update_rss_feed: caching content (initial)...");
-                                               }
-
-                                               $entry_cached_content = cache_content($link, $entry_link, $auth_login, $auth_pass);
-
-                                               if ($cache_images && is_writable(CACHE_DIR . '/images'))
-                                                       $entry_cached_content = cache_images($entry_cached_content, $site_url, $debug_enabled);
-
-                                               $entry_cached_content = db_escape_string($entry_cached_content, false);
-                                       }
-
                                        // base post entry does not exist, create it
 
                                        $result = db_query($link,
                                                        '$entry_timestamp_fmt',
                                                        '$entry_content',
                                                        '$content_hash',
-                                                       '$entry_cached_content',
+                                                       '',
                                                        $no_orig_date,
                                                        NOW(),
                                                        NOW(),
                                                id,content_hash,no_orig_date,title,
                                                ".SUBSTRING_FOR_DATE."(date_updated,1,19) as date_updated,
                                                ".SUBSTRING_FOR_DATE."(updated,1,19) as updated,
-                                               num_comments, cached_content
+                                               num_comments
                                        FROM
                                                ttrss_entries
                                        WHERE guid = '$entry_guid'");
                                        $orig_content_hash = db_fetch_result($result, 0, "content_hash");
                                        $orig_title = db_fetch_result($result, 0, "title");
                                        $orig_num_comments = db_fetch_result($result, 0, "num_comments");
-                                       $orig_cached_content = trim(db_fetch_result($result, 0, "cached_content"));
                                        $orig_date_updated = strtotime(db_fetch_result($result,
                                                0, "date_updated"));
 
 
                                        $post_needs_update = false;
                                        $update_insignificant = false;
-                                       $cached_content_needs_update = false;
 
                                        if ($orig_num_comments != $num_comments) {
                                                $post_needs_update = true;
                                        if ($content_hash != $orig_content_hash) {
                                                $post_needs_update = true;
                                                $update_insignificant = false;
-                                               $cached_content_needs_update = true;
-                                       }
-
-                                       if (defined('_FEEDS_CONTENT_CACHE') && _FEEDS_CONTENT_CACHE && $cache_content) {
-                                               if ($debug_enabled) {
-                                                       _debug("update_rss_feed: caching content because original checksum changed...");
-                                               }
-
-                                               $entry_cached_content = cache_content($link, $entry_link, $auth_login, $auth_pass);
-
-                                               if ($entry_cached_content) {
-                                                       if ($cache_images && is_writable(CACHE_DIR . '/images'))
-                                                               $entry_cached_content = cache_images($entry_cached_content, $site_url, $debug_enabled);
-
-                                                       $entry_cached_content = db_escape_string($entry_cached_content, false);
-                                                       $post_needs_update = true;
-                                               } else {
-                                                       $entry_cached_content = db_escape_string($orig_cached_content);
-                                               }
-                                       } else {
-                                               $entry_cached_content = db_escape_string($orig_cached_content);
                                        }
 
                                        if (db_escape_string($orig_title) != $entry_title) {
                                                db_query($link, "UPDATE ttrss_entries
                                                        SET title = '$entry_title', content = '$entry_content',
                                                                content_hash = '$content_hash',
-                                                               cached_content = '$entry_cached_content',
                                                                updated = '$entry_timestamp_fmt',
                                                                num_comments = '$num_comments'
                                                        WHERE id = '$ref_id'");