]>
Commit | Line | Data |
---|---|---|
cd2cd415 | 1 | #!/usr/bin/php |
1d3a17c7 | 2 | <?php |
aa8ab7ae | 3 | define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE); |
de696427 AD |
4 | define('DISABLE_SESSIONS', true); |
5 | ||
aa8ab7ae AD |
6 | error_reporting(DEFAULT_ERROR_LEVEL); |
7 | ||
1f2b01ed AD |
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"; | |
31a6d42d AD |
13 | |
14 | $lock_filename = "update_feeds.lock"; | |
15 | ||
16 | $lock_handle = make_lockfile($lock_filename); | |
17 | ||
45004d43 | 18 | // Try to lock a file in order to avoid concurrent update. |
31a6d42d AD |
19 | if (!$lock_handle) { |
20 | die("error: Can't create lockfile ($lock_filename). ". | |
21 | "Maybe another process is already running.\n"); | |
22 | } | |
1f2b01ed | 23 | |
45004d43 | 24 | // Create a database connection. |
1f2b01ed AD |
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 | ||
f29ba148 | 35 | init_connection($link); |
1f2b01ed | 36 | |
d16d57ff | 37 | // Purge all posts (random 30 feeds) |
3907ef71 | 38 | //global_purge_old_posts($link, true, 30); |
d16d57ff | 39 | |
45004d43 | 40 | // Update all feeds needing a update. |
d2bf48f9 | 41 | update_daemon_common($link); |
1f2b01ed AD |
42 | |
43 | db_close($link); | |
44 | ||
cfa43e02 | 45 | unlink(LOCK_DIRECTORY . "/$lock_filename"); |
1f2b01ed | 46 | ?> |