mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 12:55:56 +00:00
fix image caching not working on plugin-rewritten content; remove content cache stuff
This commit is contained in:
@@ -642,23 +642,6 @@ class Pref_Feeds extends Handler_Protected {
|
|||||||
$checked> <label for=\"cache_images\">".
|
$checked> <label for=\"cache_images\">".
|
||||||
__('Cache images locally')."</label>";
|
__('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> <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"));
|
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
|
||||||
|
|
||||||
if ($mark_unread_on_update) {
|
if ($mark_unread_on_update) {
|
||||||
|
|||||||
@@ -173,7 +173,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = db_query($link, "SELECT id,update_interval,auth_login,
|
$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,
|
mark_unread_on_update, owner_uid, update_on_checksum_change,
|
||||||
pubsub_state
|
pubsub_state
|
||||||
FROM ttrss_feeds WHERE id = '$feed'");
|
FROM ttrss_feeds WHERE id = '$feed'");
|
||||||
@@ -200,7 +200,6 @@
|
|||||||
$auth_pass = db_fetch_result($result, 0, "auth_pass");
|
$auth_pass = db_fetch_result($result, 0, "auth_pass");
|
||||||
|
|
||||||
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
|
$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");
|
$fetch_url = db_fetch_result($result, 0, "feed_url");
|
||||||
|
|
||||||
$feed = db_escape_string($feed);
|
$feed = db_escape_string($feed);
|
||||||
@@ -450,17 +449,12 @@
|
|||||||
$entry_content = $item->get_content();
|
$entry_content = $item->get_content();
|
||||||
if (!$entry_content) $entry_content = $item->get_description();
|
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) {
|
if ($_REQUEST["xdebug"] == 2) {
|
||||||
print "update_rss_feed: content: ";
|
print "update_rss_feed: content: ";
|
||||||
print $entry_content;
|
print $entry_content;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$entry_cached_content = "";
|
|
||||||
|
|
||||||
$entry_comments = $item->data["comments"];
|
$entry_comments = $item->data["comments"];
|
||||||
|
|
||||||
if ($item->get_author()) {
|
if ($item->get_author()) {
|
||||||
@@ -549,6 +543,9 @@
|
|||||||
$entry_author = db_escape_string($article["author"]);
|
$entry_author = db_escape_string($article["author"]);
|
||||||
$entry_link = db_escape_string($article["link"]);
|
$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);
|
$content_hash = "SHA1:" . sha1($entry_content);
|
||||||
|
|
||||||
db_query($link, "BEGIN");
|
db_query($link, "BEGIN");
|
||||||
@@ -562,19 +559,6 @@
|
|||||||
_debug("update_rss_feed: base guid [$entry_guid] not found");
|
_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
|
// base post entry does not exist, create it
|
||||||
|
|
||||||
$result = db_query($link,
|
$result = db_query($link,
|
||||||
@@ -599,7 +583,7 @@
|
|||||||
'$entry_timestamp_fmt',
|
'$entry_timestamp_fmt',
|
||||||
'$entry_content',
|
'$entry_content',
|
||||||
'$content_hash',
|
'$content_hash',
|
||||||
'$entry_cached_content',
|
'',
|
||||||
$no_orig_date,
|
$no_orig_date,
|
||||||
NOW(),
|
NOW(),
|
||||||
NOW(),
|
NOW(),
|
||||||
@@ -629,7 +613,7 @@
|
|||||||
id,content_hash,no_orig_date,title,
|
id,content_hash,no_orig_date,title,
|
||||||
".SUBSTRING_FOR_DATE."(date_updated,1,19) as date_updated,
|
".SUBSTRING_FOR_DATE."(date_updated,1,19) as date_updated,
|
||||||
".SUBSTRING_FOR_DATE."(updated,1,19) as updated,
|
".SUBSTRING_FOR_DATE."(updated,1,19) as updated,
|
||||||
num_comments, cached_content
|
num_comments
|
||||||
FROM
|
FROM
|
||||||
ttrss_entries
|
ttrss_entries
|
||||||
WHERE guid = '$entry_guid'");
|
WHERE guid = '$entry_guid'");
|
||||||
@@ -647,7 +631,6 @@
|
|||||||
$orig_content_hash = db_fetch_result($result, 0, "content_hash");
|
$orig_content_hash = db_fetch_result($result, 0, "content_hash");
|
||||||
$orig_title = db_fetch_result($result, 0, "title");
|
$orig_title = db_fetch_result($result, 0, "title");
|
||||||
$orig_num_comments = db_fetch_result($result, 0, "num_comments");
|
$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,
|
$orig_date_updated = strtotime(db_fetch_result($result,
|
||||||
0, "date_updated"));
|
0, "date_updated"));
|
||||||
|
|
||||||
@@ -783,7 +766,6 @@
|
|||||||
|
|
||||||
$post_needs_update = false;
|
$post_needs_update = false;
|
||||||
$update_insignificant = false;
|
$update_insignificant = false;
|
||||||
$cached_content_needs_update = false;
|
|
||||||
|
|
||||||
if ($orig_num_comments != $num_comments) {
|
if ($orig_num_comments != $num_comments) {
|
||||||
$post_needs_update = true;
|
$post_needs_update = true;
|
||||||
@@ -793,27 +775,6 @@
|
|||||||
if ($content_hash != $orig_content_hash) {
|
if ($content_hash != $orig_content_hash) {
|
||||||
$post_needs_update = true;
|
$post_needs_update = true;
|
||||||
$update_insignificant = false;
|
$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) {
|
if (db_escape_string($orig_title) != $entry_title) {
|
||||||
@@ -834,7 +795,6 @@
|
|||||||
db_query($link, "UPDATE ttrss_entries
|
db_query($link, "UPDATE ttrss_entries
|
||||||
SET title = '$entry_title', content = '$entry_content',
|
SET title = '$entry_title', content = '$entry_content',
|
||||||
content_hash = '$content_hash',
|
content_hash = '$content_hash',
|
||||||
cached_content = '$entry_cached_content',
|
|
||||||
updated = '$entry_timestamp_fmt',
|
updated = '$entry_timestamp_fmt',
|
||||||
num_comments = '$num_comments'
|
num_comments = '$num_comments'
|
||||||
WHERE id = '$ref_id'");
|
WHERE id = '$ref_id'");
|
||||||
|
|||||||
Reference in New Issue
Block a user