ttrss/update_feeds.php

44 lines
996 B
PHP
Raw Normal View History

#!/usr/bin/php
2006-08-19 09:04:45 +02:00
<?php
define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
2006-02-11 14:52:17 +01:00
define('DISABLE_SESSIONS', true);
error_reporting(DEFAULT_ERROR_LEVEL);
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";
2007-09-25 05:23:29 +02:00
$lock_filename = "update_feeds.lock";
$lock_handle = make_lockfile($lock_filename);
// Try to lock a file in order to avoid concurrent update.
2007-09-25 05:23:29 +02:00
if (!$lock_handle) {
die("error: Can't create lockfile ($lock_filename). ".
"Maybe another process is already running.\n");
}
2005-12-03 15:25:40 +01:00
// Create a database connection.
2005-12-03 15:25:40 +01:00
$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;
}
init_connection($link);
2005-12-03 15:25:40 +01:00
// Update all feeds needing a update.
update_daemon_common($link);
2005-12-03 15:25:40 +01:00
db_close($link);
unlink(LOCK_DIRECTORY . "/$lock_filename");
2005-12-03 15:25:40 +01:00
?>