summaryrefslogtreecommitdiff
path: root/update_feeds.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-12-03 15:25:40 +0100
committerAndrew Dolgov <[email protected]>2005-12-03 15:25:40 +0100
commit1f2b01ed8ee1a7934be8d4ea4e7bfc2980910e3a (patch)
tree4fd86bf07603540a52b63e6c80101f026749da16 /update_feeds.php
parent8fe19cd81eae2b5a59652135e11463620b02419c (diff)
update_feeds.php for CLI
Diffstat (limited to 'update_feeds.php')
-rw-r--r--update_feeds.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/update_feeds.php b/update_feeds.php
new file mode 100644
index 000000000..38940896f
--- /dev/null
+++ b/update_feeds.php
@@ -0,0 +1,38 @@
+#!/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);
+
+?>