// */30 * * * * /usr/bin/wget -O /dev/null -T 600 "http://www.your-site.xxx/tt-rss/backend.php?op=globalUpdateFeeds&daemon=1"
//
+ // The alternative approach is to run update_feeds.php from your crontab
+ // with command line PHP interpreter.
+
define('SMART_RPC_COUNTERS', true);
// If enabled, stores feed counter information on the server side and sends
// only diffs to the client. In the nutshell, it saves your bandwidth and
<?
- session_start();
if ($_GET["debug"]) {
define('DEFAULT_ERROR_LEVEL', E_ALL);
(SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0");
}
- function update_all_feeds($link, $fetch, $user_id = false) {
+ function update_all_feeds($link, $fetch, $user_id = false, $force_daemon = false) {
if (WEB_DEMO_MODE) return;
if ($fetch || (!$line["last_updated"] ||
time() - strtotime($line["last_updated"]) > ($upd_intl * 60))) {
- update_rss_feed($link, $line["feed_url"], $line["id"]);
+ update_rss_feed($link, $line["feed_url"], $line["id"], $force_daemon);
}
}
--- /dev/null
+#!/usr/bin/php4
+
+<?
+ // this script is probably run not from your httpd-user, so cache
+ // directory defined in config.php won't be accessible
+ define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache-cli');
+
+ require_once "sanity_check.php";
+ require_once "config.php";
+ require_once "db.php";
+ require_once "db-prefs.php";
+ require_once "functions.php";
+ require_once "magpierss/rss_fetch.inc";
+
+ $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
+
+ if (!$link) {
+ if (DB_TYPE == "mysql") {
+ print mysql_error();
+ }
+ // PG seems to display its own errors just fine by default.
+ return;
+ }
+
+ if (DB_TYPE == "pgsql") {
+ pg_query("set client_encoding = 'utf-8'");
+ }
+
+ $result = db_query($link, "SELECT id FROM ttrss_users");
+
+ while ($line = db_fetch_assoc($result)) {
+ $user_id = $line["id"];
+ update_all_feeds($link, false, $user_id, true);
+ }
+
+ db_close($link);
+
+?>