3 // this script is probably run not from your httpd-user, so cache
4 // directory defined in config.php won't be accessible
5 define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache-cli');
6 define('SIMPLEPIE_CACHE_DIR', '/var/tmp/simplepie-ttrss-cache-cli');
7 define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
8 define('DISABLE_SESSIONS', true);
10 error_reporting(DEFAULT_ERROR_LEVEL);
12 require_once "sanity_check.php";
13 require_once "config.php";
14 require_once "db.php";
15 require_once "db-prefs.php";
16 require_once "functions.php";
18 $lock_filename = "update_feeds.lock";
20 $lock_handle = make_lockfile($lock_filename);
22 // Try to lock a file in order to avoid concurrent update.
24 die("error: Can't create lockfile ($lock_filename). ".
25 "Maybe another process is already running.\n");
28 // Create a database connection.
29 $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
32 if (DB_TYPE == "mysql") {
35 // PG seems to display its own errors just fine by default.
39 init_connection($link);
41 // Purge all posts (random 30 feeds)
42 //global_purge_old_posts($link, true, 30);
44 // Update all feeds needing a update.
45 update_daemon_common($link);
49 unlink(LOCK_DIRECTORY . "/$lock_filename");