define_default('DAEMON_SLEEP_INTERVAL', 120);
define_default('_MIN_CACHE_IMAGE_SIZE', 1024);
- function calculate_article_hash($article) {
+ function calculate_article_hash($article, $pluginhost) {
$tmp = "";
foreach ($article as $k => $v) {
}
}
- return sha1(implode(",", PluginHost::getInstance()->get_plugin_names())) . ":" . sha1($tmp);
+ return sha1(implode(",", $pluginhost->get_plugin_names()) . $tmp);
}
function update_feedbrowser_cache() {
}
$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.
$entry_guid = $item->get_id();
if (!$entry_guid) $entry_guid = $item->get_link();
if (!$entry_guid) $entry_guid = make_guid_from_title($item->get_title());
-
- _debug("f_guid $entry_guid", $debug_enabled);
-
if (!$entry_guid) continue;
$entry_guid = "$owner_uid,$entry_guid";
$entry_language = $lang->detect($entry_title . " " . $entry_content, 1);
if (count($entry_language) > 0) {
- $entry_language = array_keys($entry_language);
-
- // the fuck?
- if (is_array($entry_language))
- $entry_language = "";
- else
- $entry_language = db_escape_string(substr($entry_language[0], 0, 2));
+ @$entry_language = array_keys($entry_language)[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)
);
$entry_plugin_data = "";
- $entry_current_hash = calculate_article_hash($article);
+ $entry_current_hash = calculate_article_hash($article, $pluginhost);
_debug("article hash: $entry_current_hash [stored=$entry_stored_hash]", $debug_enabled);