diff options
author | Andrew Dolgov <[email protected]> | 2008-01-17 06:33:52 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2008-01-17 06:33:52 +0100 |
commit | cfa43e025cf4246d815a5f1539cd34b461130a9a (patch) | |
tree | 46878553faade2228647d512188fdc548bb0e051 | |
parent | e3b9d084d46c34faad8808d3d3624a7c6826ed93 (diff) |
new config option: LOCK_DIRECTORY (bump config version)
-rw-r--r-- | config.php-dist | 6 | ||||
-rw-r--r-- | functions.php | 8 | ||||
-rw-r--r-- | sanity_check.php | 2 | ||||
-rw-r--r-- | update_daemon.php | 2 | ||||
-rw-r--r-- | update_feeds.php | 2 |
5 files changed, 12 insertions, 8 deletions
diff --git a/config.php-dist b/config.php-dist index 5edb79aa3..2c92429ec 100644 --- a/config.php-dist +++ b/config.php-dist @@ -170,7 +170,11 @@ // option can be used to integrate tt-rss with Apache's external // authentication modules. - define('CONFIG_VERSION', 13); + define('LOCK_DIRECTORY', '.'); + // Directory for lockfiles, must be writable to the user you run + // daemon process or cronjobs under. + + define('CONFIG_VERSION', 14); // Expected config version. Please update this option in config.php // if necessary (after migrating all new options from this file). diff --git a/functions.php b/functions.php index 0a55695aa..b445ab675 100644 --- a/functions.php +++ b/functions.php @@ -1857,7 +1857,7 @@ function file_is_locked($filename) { if (function_exists('flock')) { error_reporting(0); - $fp = fopen($filename, "r"); + $fp = fopen(LOCK_DIRECTORY . "/$filename", "r"); error_reporting(DEFAULT_ERROR_LEVEL); if ($fp) { if (flock($fp, LOCK_EX | LOCK_NB)) { @@ -1873,7 +1873,7 @@ } function make_lockfile($filename) { - $fp = fopen($filename, "w"); + $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); if (flock($fp, LOCK_EX | LOCK_NB)) { return $fp; @@ -1883,7 +1883,7 @@ } function make_stampfile($filename) { - $fp = fopen($filename, "w"); + $fp = fopen(LOCK_DIRECTORY . "/$filename", "w"); if (flock($fp, LOCK_EX | LOCK_NB)) { fwrite($fp, time() . "\n"); @@ -1898,7 +1898,7 @@ function read_stampfile($filename) { error_reporting(0); - $fp = fopen($filename, "r"); + $fp = fopen(LOCK_DIRECTORY . "/$filename", "r"); error_reporting (DEFAULT_ERROR_LEVEL); if (flock($fp, LOCK_EX)) { diff --git a/sanity_check.php b/sanity_check.php index de582760f..2efb10758 100644 --- a/sanity_check.php +++ b/sanity_check.php @@ -1,7 +1,7 @@ <?php require_once "functions.php"; - define('EXPECTED_CONFIG_VERSION', 13); + define('EXPECTED_CONFIG_VERSION', 14); define('SCHEMA_VERSION', 28); if (!file_exists("config.php")) { diff --git a/update_daemon.php b/update_daemon.php index 0c075da1b..c3210945a 100644 --- a/update_daemon.php +++ b/update_daemon.php @@ -35,7 +35,7 @@ error_reporting(DEFAULT_ERROR_LEVEL); function sigint_handler() { - unlink("update_daemon.lock"); + unlink(LOCK_DIRECTORY . "/update_daemon.lock"); die("Received SIGINT. Exiting.\n"); } diff --git a/update_feeds.php b/update_feeds.php index d3d6a72cc..4909d881e 100644 --- a/update_feeds.php +++ b/update_feeds.php @@ -56,5 +56,5 @@ db_close($link); - unlink($lock_filename); + unlink(LOCK_DIRECTORY . "/$lock_filename"); ?> |