warn if daemon process is not running on server

This commit is contained in:
Andrew Dolgov 2006-02-13 14:08:23 +01:00
parent 3e4950c7bb
commit 27981ca30f
2 changed files with 24 additions and 0 deletions

View File

@ -928,6 +928,22 @@
} }
} }
function file_is_locked($filename) {
error_reporting(0);
$fp = fopen($filename, "r");
error_reporting(DEFAULT_ERROR_LEVEL);
if ($fp) {
if (flock($fp, LOCK_EX | LOCK_NB)) {
flock($fp, LOCK_UN);
fclose($fp);
return false;
}
fclose($fp);
return true;
}
return false;
}
function make_lockfile($filename) { function make_lockfile($filename) {
$fp = fopen($filename, "w"); $fp = fopen($filename, "w");

View File

@ -50,6 +50,14 @@
<body onload="init()"> <body onload="init()">
<? if (ENABLE_UPDATE_DAEMON && !file_is_locked("update_daemon.lock")) { ?>
<div class="warning">
<b>Warning:</b> Update daemon is enabled in configuration, but daemon
process is not running, which prevents all feeds from updating. Please
start the daemon process or contact instance owner.
</div>
<? } ?>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" class="main"> <table width="100%" height="100%" cellspacing="0" cellpadding="0" class="main">
<? if (get_pref($link, 'DISPLAY_HEADER')) { ?> <? if (get_pref($link, 'DISPLAY_HEADER')) { ?>
<tr> <tr>