]> git.wh0rd.org - tt-rss.git/blob - update_feeds.php
default headline sort order by date_entered instead of updated
[tt-rss.git] / update_feeds.php
1 #!/usr/bin/php
2 <?php
3 define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
4 define('DISABLE_SESSIONS', true);
5
6 error_reporting(DEFAULT_ERROR_LEVEL);
7
8 require_once "sanity_check.php";
9 require_once "config.php";
10 require_once "db.php";
11 require_once "db-prefs.php";
12 require_once "functions.php";
13
14 $lock_filename = "update_feeds.lock";
15
16 $lock_handle = make_lockfile($lock_filename);
17
18 // Try to lock a file in order to avoid concurrent update.
19 if (!$lock_handle) {
20 die("error: Can't create lockfile ($lock_filename). ".
21 "Maybe another process is already running.\n");
22 }
23
24 // Create a database connection.
25 $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
26
27 if (!$link) {
28 if (DB_TYPE == "mysql") {
29 print mysql_error();
30 }
31 // PG seems to display its own errors just fine by default.
32 return;
33 }
34
35 init_connection($link);
36
37 // Update all feeds needing a update.
38 update_daemon_common($link);
39
40 db_close($link);
41
42 unlink(LOCK_DIRECTORY . "/$lock_filename");
43 ?>