}
$nf = 0;
+ $bstarted = microtime(true);
// For each feed, we call the feed update function.
foreach ($feeds_to_update as $feed) {
while ($tline = db_fetch_assoc($tmp_result)) {
if($debug) _debug(" => " . $tline["last_updated"] . ", " . $tline["id"] . " " . $tline["owner_uid"]);
+ $fstarted = microtime(true);
$rss = update_rss_feed($tline["id"], true, false);
_debug_suppress(false);
+
+ _debug(sprintf(" %.4f (sec)", microtime(true) - $fstarted));
+
++$nf;
}
}
}
+ if ($nf > 0) {
+ _debug(sprintf("Processed %d feeds in %.4f (sec), %.4f (sec/feed avg)", $nf,
+ microtime(true) - $bstarted, (microtime(true) - $bstarted) / $nf));
+ }
+
require_once "digest.php";
// Send feed digests by email if needed.
if (!$registered_title || $registered_title == "[Unknown]") {
- $feed_title = db_escape_string($rss->get_title());
+ $feed_title = db_escape_string(mb_substr($rss->get_title(), 0, 199);
if ($feed_title) {
_debug("registering title: $feed_title", $debug_enabled);
$entry_language = $lang->detect($entry_title . " " . $entry_content, 1);
if (count($entry_language) > 0) {
- @$entry_language = array_keys($entry_language)[0];
+ $possible = array_keys($entry_language);
+ $entry_language = $possible[0];
_debug("detected language: $entry_language", $debug_enabled);
} else {
"link" => $entry_link,
"tags" => $entry_tags,
"author" => $entry_author,
+ "language" => $entry_language, // read only
"feed" => array("id" => $feed,
"fetch_url" => $fetch_url,
"site_url" => $site_url)
_debug("article hash: $entry_current_hash [stored=$entry_stored_hash]", $debug_enabled);
- if ($entry_current_hash == $entry_stored_hash) {
+ if ($entry_current_hash == $entry_stored_hash && !isset($_REQUEST["force_rehash"])) {
_debug("stored article seems up to date [IID: $base_entry_id], updating timestamp only", $debug_enabled);
// we keep encountering the entry in feeds, so we need to
db_query("UPDATE ttrss_entries SET date_updated = NOW()
WHERE id = '$base_entry_id'");
- continue;
+ // if we allow duplicate posts, we have to continue to
+ // create the user entries for this feed
+ if (!get_pref("ALLOW_DUPLICATE_POSTS", $owner_uid, false)) {
+ continue;
+ }
}
_debug("hash differs, applying plugin filters:", $debug_enabled);