]>
Commit | Line | Data |
---|---|---|
3f459bc8 AD |
1 | #!/usr/bin/php |
2 | <?php | |
e3b54693 AD |
3 | /* This script updates feedbrowser (e.g. Other Feeds tab) cache |
4 | * If you are using update daemon, it is NOT necessary to run | |
5 | * this script, as updates are handled automatically. */ | |
6 | ||
3f459bc8 AD |
7 | define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE); |
8 | define('DISABLE_SESSIONS', true); | |
9 | ||
10 | error_reporting(DEFAULT_ERROR_LEVEL); | |
11 | ||
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"; | |
17 | ||
18 | $lock_filename = "update_feedbrowser.lock"; | |
19 | ||
20 | $lock_handle = make_lockfile($lock_filename); | |
21 | ||
22 | // Try to lock a file in order to avoid concurrent update. | |
23 | if (!$lock_handle) { | |
24 | die("error: Can't create lockfile ($lock_filename). ". | |
25 | "Maybe another process is already running.\n"); | |
26 | } | |
27 | ||
28 | // Create a database connection. | |
29 | $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); | |
30 | ||
31 | if (!$link) { | |
32 | if (DB_TYPE == "mysql") { | |
33 | print mysql_error(); | |
34 | } | |
35 | // PG seems to display its own errors just fine by default. | |
36 | return; | |
37 | } | |
38 | ||
39 | init_connection($link); | |
40 | ||
5e96ca9d | 41 | $count = update_feedbrowser_cache($link); |
3f459bc8 | 42 | |
2c2dd64d AD |
43 | print "Finished, $count feeds processed.\n"; |
44 | ||
3f459bc8 AD |
45 | db_close($link); |
46 | ||
47 | unlink(LOCK_DIRECTORY . "/$lock_filename"); | |
48 | ||
49 | ?> |