2007-03-02 15:41:57 +01:00
|
|
|
#!/usr/bin/php
|
2006-08-19 09:04:45 +02:00
|
|
|
<?php
|
2005-12-03 15:25:40 +01:00
|
|
|
// 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');
|
|
|
|
|
2006-02-11 14:52:17 +01:00
|
|
|
define('DISABLE_SESSIONS', true);
|
|
|
|
|
2005-12-03 15:25:40 +01:00
|
|
|
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'");
|
2007-02-20 09:33:17 +01:00
|
|
|
pg_set_client_encoding("UNICODE");
|
2007-08-17 18:02:15 +02:00
|
|
|
} else {
|
2007-08-21 12:47:25 +02:00
|
|
|
if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
|
|
|
|
db_query($link, "SET NAMES " . MYSQL_CHARSET);
|
|
|
|
db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET);
|
|
|
|
}
|
2005-12-03 15:25:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$result = db_query($link, "SELECT id FROM ttrss_users");
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
$user_id = $line["id"];
|
2006-10-01 06:06:45 +02:00
|
|
|
initialize_user_prefs($link, $user_id);
|
2005-12-03 15:25:40 +01:00
|
|
|
update_all_feeds($link, false, $user_id, true);
|
|
|
|
}
|
|
|
|
|
2006-08-21 09:34:49 +02:00
|
|
|
if (DAEMON_SENDS_DIGESTS) send_headlines_digests($link);
|
2006-08-21 08:43:38 +02:00
|
|
|
|
2005-12-03 15:25:40 +01:00
|
|
|
db_close($link);
|
|
|
|
|
|
|
|
?>
|