From 68a50deef15f36efedc6ddc68cbb2a6f6072b5a9 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 16 Apr 2023 13:03:33 +0700 Subject: [PATCH] Minor fixes (#158) --- CHANGELOG.md | 2 +- library/includes/cache/common.php | 4 ++++ library/includes/cron/cron_init.php | 14 ++++++++++++-- library/includes/datastore/common.php | 4 ++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b85f1a2..8ed8d551 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ - Use constants instead of string literals [\#151](https://github.com/torrentpier/torrentpier-lts/pull/151) ([belomaxorka](https://github.com/belomaxorka)) - Sync language (html dir) with latest sources [\#152](https://github.com/torrentpier/torrentpier-lts/pull/152) ([belomaxorka](https://github.com/belomaxorka)) - Updated UK lang icons [\#155](https://github.com/torrentpier/torrentpier-lts/pull/155) ([belomaxorka](https://github.com/belomaxorka)) -- Minor fixes [\#124](https://github.com/torrentpier/torrentpier-lts/pull/124), [\#133](https://github.com/torrentpier/torrentpier-lts/pull/133), [\#135](https://github.com/torrentpier/torrentpier-lts/pull/135), [\#136](https://github.com/torrentpier/torrentpier-lts/pull/136), [\#139](https://github.com/torrentpier/torrentpier-lts/pull/139), [\#142](https://github.com/torrentpier/torrentpier-lts/pull/142), [\#144](https://github.com/torrentpier/torrentpier-lts/pull/144), [\#145](https://github.com/torrentpier/torrentpier-lts/pull/145), [\#148](https://github.com/torrentpier/torrentpier-lts/pull/148), [\#153](https://github.com/torrentpier/torrentpier-lts/pull/153), [\#154](https://github.com/torrentpier/torrentpier-lts/pull/154), [\#156](https://github.com/torrentpier/torrentpier-lts/pull/156), [\#157](https://github.com/torrentpier/torrentpier-lts/pull/157) ([belomaxorka](https://github.com/belomaxorka)) +- Minor fixes [\#124](https://github.com/torrentpier/torrentpier-lts/pull/124), [\#133](https://github.com/torrentpier/torrentpier-lts/pull/133), [\#135](https://github.com/torrentpier/torrentpier-lts/pull/135), [\#136](https://github.com/torrentpier/torrentpier-lts/pull/136), [\#139](https://github.com/torrentpier/torrentpier-lts/pull/139), [\#142](https://github.com/torrentpier/torrentpier-lts/pull/142), [\#144](https://github.com/torrentpier/torrentpier-lts/pull/144), [\#145](https://github.com/torrentpier/torrentpier-lts/pull/145), [\#148](https://github.com/torrentpier/torrentpier-lts/pull/148), [\#153](https://github.com/torrentpier/torrentpier-lts/pull/153), [\#154](https://github.com/torrentpier/torrentpier-lts/pull/154), [\#156](https://github.com/torrentpier/torrentpier-lts/pull/156), [\#157](https://github.com/torrentpier/torrentpier-lts/pull/157), [\#158](https://github.com/torrentpier/torrentpier-lts/pull/158) ([belomaxorka](https://github.com/belomaxorka)) ## [v2.1.5-2023.03](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.03) (2023-04-04) [Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.03...main) diff --git a/library/includes/cache/common.php b/library/includes/cache/common.php index 79a0ff52..46f84f6a 100644 --- a/library/includes/cache/common.php +++ b/library/includes/cache/common.php @@ -63,6 +63,10 @@ class cache_common $dbg['time'] = $this->cur_query_time; $id++; } + else + { + trigger_error("[Cache] Invalid debug mode: $mode", E_USER_ERROR); + } } function debug_find_source ($mode = '') diff --git a/library/includes/cron/cron_init.php b/library/includes/cron/cron_init.php index f70edd59..32c8bc94 100644 --- a/library/includes/cron/cron_init.php +++ b/library/includes/cron/cron_init.php @@ -30,7 +30,10 @@ function cron_get_file_lock () function cron_track_running ($mode) { - @define('CRON_STARTMARK', TRIGGERS_DIR .'cron_started_at_'. date('Y-m-d_H-i-s') .'_by_pid_'. getmypid()); + if (!defined('CRON_STARTMARK')) + { + define('CRON_STARTMARK', TRIGGERS_DIR . 'cron_started_at_' . date('Y-m-d_H-i-s') . '_by_pid_' . getmypid()); + } if ($mode == 'start') { @@ -39,8 +42,15 @@ function cron_track_running ($mode) } elseif ($mode == 'end') { - @unlink(CRON_STARTMARK); + if (file_exists(CRON_STARTMARK)) + { + unlink(CRON_STARTMARK); + } } + else + { + bb_simple_die("Invalid cron track mode: $mode"); + } } // diff --git a/library/includes/datastore/common.php b/library/includes/datastore/common.php index 8b723258..87ee9579 100644 --- a/library/includes/datastore/common.php +++ b/library/includes/datastore/common.php @@ -154,6 +154,10 @@ class datastore_common $dbg['time'] = $this->cur_query_time; $id++; } + else + { + trigger_error("[Datastore] Invalid debug mode: $mode", E_USER_ERROR); + } } function debug_find_source ($mode = '')