summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2025-07-04 13:32:57 +0300
committerAndrew Dolgov <fox@fakecake.org>2025-07-04 13:32:57 +0300
commit05a90d4ce16cbf2a5c5143a78556e23dc35df8c8 (patch)
tree554be41303257ee7ef04ee4da8f19a238fc7583b
parent9b38a5757086e856f8086995874cf961e38328a7 (diff)
parent775a6066f1c2cf888417aab3cceca8119f5d3574 (diff)
Merge branch 'undying' into 'master'
Undying See merge request tt-rss/tt-rss!161
-rw-r--r--classes/RSSUtils.php3
-rwxr-xr-xupdate.php6
-rwxr-xr-xupdate_daemon2.php18
3 files changed, 18 insertions, 9 deletions
diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php
index d1c55d2fd..bfa79de71 100644
--- a/classes/RSSUtils.php
+++ b/classes/RSSUtils.php
@@ -73,7 +73,8 @@ class RSSUtils {
if (!$limit) $limit = Config::get(Config::DAEMON_FEED_LIMIT);
if (Config::get_schema_version() != Config::SCHEMA_VERSION) {
- die("Schema version is wrong, please upgrade the database.\n");
+ print("Schema version is wrong, please upgrade the database.\n");
+ exit(1);
}
self::init_housekeeping_tasks();
diff --git a/update.php b/update.php
index 093b5ae82..362d056a3 100755
--- a/update.php
+++ b/update.php
@@ -141,7 +141,8 @@
}
if (!isset($options['update-schema']) && Config::is_migration_needed()) {
- die("Schema version is wrong, please upgrade the database (--update-schema).\n");
+ print("Schema version is wrong, please upgrade the database (--update-schema).\n");
+ exit(1);
}
Debug::set_enabled(true);
@@ -188,8 +189,9 @@
// Try to lock a file in order to avoid concurrent update.
if (!$lock_handle) {
- die("error: Can't create lockfile ($lock_filename). ".
+ print("error: Can't create lockfile ($lock_filename). ".
"Maybe another update process is already running.\n");
+ exit(1);
}
if (isset($options["force-update"])) {
diff --git a/update_daemon2.php b/update_daemon2.php
index 4d80bed0a..25fb205ce 100755
--- a/update_daemon2.php
+++ b/update_daemon2.php
@@ -13,16 +13,18 @@
Config::sanity_check();
if (!function_exists('pcntl_fork')) {
- die("error: This script requires PHP compiled with PCNTL module.\n");
+ print("error: This script requires PHP compiled with PCNTL module.\n");
+ exit(1);
}
$options = getopt("");
if (!is_array($options)) {
- die("error: getopt() failed. ".
+ print("error: getopt() failed. ".
"Most probably you are using PHP CGI to run this script ".
"instead of required PHP CLI. Check tt-rss wiki page on updating feeds for ".
"additional information.\n");
+ exit(1);
}
@@ -188,20 +190,23 @@
}
if (file_is_locked("update_daemon.lock")) {
- die("error: Can't create lockfile. ".
+ print("error: Can't create lockfile. ".
"Maybe another daemon is already running.\n");
+ exit(1);
}
// Try to lock a file in order to avoid concurrent update.
$lock_handle = make_lockfile("update_daemon.lock");
if (!$lock_handle) {
- die("error: Can't create lockfile. ".
+ print("error: Can't create lockfile. ".
"Maybe another daemon is already running.\n");
+ exit(1);
}
if (Config::is_migration_needed()) {
- die("Schema version is wrong, please upgrade the database.\n");
+ print("Schema version is wrong, please upgrade the database.\n");
+ exit(1);
}
// Protip: children close shared database handle when terminating, it's a bad idea to
@@ -225,7 +230,8 @@
for ($j = count($children); $j < $max_jobs; $j++) {
$pid = pcntl_fork();
if ($pid == -1) {
- die("fork failed!\n");
+ print("fork failed!\n");
+ exit(1);
} else if ($pid) {
if (!$master_handlers_installed) {