// ****** Updating RSS code ******* // Only run in fork process. $start_timestamp = time(); $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); if (!init_connection($link)) { return; } // We disable stamp file, since it is of no use in a multiprocess update. // not really, tho for the time being -fox if (!make_stampfile('update_daemon.stamp')) { print "warning: unable to create stampfile"; } // Call to the feed batch update function // or regenerate feedbrowser cache if (rand(0, 100) > 30) { update_daemon_common($link); } else { $count = update_feedbrowser_cache($link); _debug("Feedbrowser updated, {$count} feeds processed."); purge_orphans($link, true); $rc = cleanup_tags($link, 14, 50000); _debug("Cleaned {$rc} cached tags."); _debug("Updating linked feeds..."); get_linked_feeds($link); } _debug("Elapsed time: " . (time() - $start_timestamp) . " second(s)"); db_close($link); // We are in a fork. // We wait a little before exiting to avoid to be faster than our parent process. sleep(1); unlink(LOCK_DIRECTORY . "/{$lock_filename}");
function globalUpdateFeeds() { include "rssfuncs.php"; // Update all feeds needing a update. update_daemon_common(0, true, false); housekeeping_common(false); PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op); }
$count = update_feedbrowser_cache(); print "Finished, {$count} feeds processed.\n"; } if (isset($options["daemon"])) { while (true) { $quiet = isset($options["quiet"]) ? "--quiet" : ""; passthru(PHP_EXECUTABLE . " " . $argv[0] . " --daemon-loop {$quiet}"); _debug("Sleeping for " . DAEMON_SLEEP_INTERVAL . " seconds..."); sleep(DAEMON_SLEEP_INTERVAL); } } if (isset($options["daemon-loop"])) { if (!make_stampfile('update_daemon.stamp')) { _debug("warning: unable to create stampfile\n"); } update_daemon_common(isset($options["pidlock"]) ? 50 : DAEMON_FEED_LIMIT); if (!isset($options["pidlock"]) || $options["task"] == 0) { housekeeping_common(true); } PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op); } if (isset($options["cleanup-tags"])) { $rc = cleanup_tags(14, 50000); _debug("{$rc} tags deleted.\n"); } if (isset($options["indexes"])) { _debug("PLEASE BACKUP YOUR DATABASE BEFORE PROCEEDING!"); _debug("Type 'yes' to continue."); if (read_stdin() != 'yes') { exit; }
function globalUpdateFeeds() { include "rssfuncs.php"; // Update all feeds needing a update. update_daemon_common($this->link, 0, true, false); }
// help case "dlg": module_popup_dialog($link); break; // dlg // dlg case "pref-pub-items": module_pref_pub_items($link); break; // pref-pub-items // pref-pub-items case "globalUpdateFeeds": // update feeds of all users, may be used anonymously print "<!--"; // Update all feeds needing a update. update_daemon_common($link, 0, true, true); print " -->"; print "<rpc-reply>\n\t\t\t\t<message msg=\"All feeds updated\"/>\n\t\t\t</rpc-reply>"; break; // globalUpdateFeeds // globalUpdateFeeds case "pref-feed-browser": module_pref_feed_browser($link); break; // pref-feed-browser // pref-feed-browser case "publish": $key = db_escape_string($_REQUEST["key"]); $limit = (int) db_escape_string($_REQUEST["limit"]); $result = db_query($link, "SELECT login, owner_uid \n\t\t\t\tFROM ttrss_user_prefs, ttrss_users WHERE\n\t\t\t\tpref_name = '_PREFS_PUBLISH_KEY' AND \n\t\t\t\tvalue = '{$key}' AND \n\t\t\t\tttrss_users.id = owner_uid"); if (db_num_rows($result) == 1) {