mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-19 23:51:28 +00:00
lock checking in update_feeds.php
This commit is contained in:
@@ -1720,6 +1720,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function file_is_locked($filename) {
|
function file_is_locked($filename) {
|
||||||
|
if (function_exists('flock')) {
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
$fp = fopen($filename, "r");
|
$fp = fopen($filename, "r");
|
||||||
error_reporting(DEFAULT_ERROR_LEVEL);
|
error_reporting(DEFAULT_ERROR_LEVEL);
|
||||||
@@ -1732,6 +1733,7 @@
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,15 @@
|
|||||||
require_once "db.php";
|
require_once "db.php";
|
||||||
require_once "db-prefs.php";
|
require_once "db-prefs.php";
|
||||||
require_once "functions.php";
|
require_once "functions.php";
|
||||||
require_once "magpierss/rss_fetch.inc";
|
|
||||||
|
$lock_filename = "update_feeds.lock";
|
||||||
|
|
||||||
|
$lock_handle = make_lockfile($lock_filename);
|
||||||
|
|
||||||
|
if (!$lock_handle) {
|
||||||
|
die("error: Can't create lockfile ($lock_filename). ".
|
||||||
|
"Maybe another process is already running.\n");
|
||||||
|
}
|
||||||
|
|
||||||
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||||
|
|
||||||
@@ -46,4 +54,5 @@
|
|||||||
|
|
||||||
db_close($link);
|
db_close($link);
|
||||||
|
|
||||||
|
unlink($lock_filename);
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user