From 074e94f942a755a211985cd660bbb7287118e61e Mon Sep 17 00:00:00 2001 From: TheWitness Date: Fri, 20 Nov 2026 16:11:29 -0500 Subject: [PATCH] fix: load lib/poller.php before the process-helper compat shims The function_exists() guards around the cacti_process_still_running() and cacti_process_kill() fallbacks only defer to core when lib/poller.php is already loaded. syslog_check_upgrade() loads includes/functions.php via syslog_connect() and later include_once's lib/poller.php, so on Cacti 1.2.32+ the shim was declared first and core then fataled with "Cannot redeclare cacti_process_still_running()". Include core's lib/poller.php ahead of the shims so the native helpers win when present and the fallbacks still apply on older releases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 1 + includes/functions.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ba98587..f150e090 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * issue#473: Syslog Status: choosing a card in Add card now appends it (Cacti's select2 dropdowns report changes through jQuery, which the card controller's native listener missed), and the Refresh interval is saved per user through a callback and refreshes the cards in place instead of reloading the page * issue#473: Bound every log query at the current time so empty future partitions are always pruned, whatever the filter's own date range * issue#473: The partition rebuild CLI now refuses to start while Syslog processing is enabled and holds a database lock that syslog_process.php also takes (on a connection of its own, so nested locks cannot release it); copies stored and removed messages without seq into a replacement whose AUTO_INCREMENT starts above the original high-water mark; verifies each 50,000-row batch by checksum and checkpoints it for resumable retries; widens the incoming queue in place to keep its sequence identities; and refuses legacy DATETIME history before changing anything +* issue: Load Cacti's lib/poller.php before the process-helper compatibility shims so a later include of it (for example during plugin upgrade checks) no longer fatals with "Cannot redeclare cacti_process_still_running()" on Cacti 1.2.32+ * issue: Tombstone the replaced cli/updatedb_convert_ms.php so upgrades remove it; it truncated the message tables and failed on legacy TO_DAYS partitioned tables. Use cli/upgrade_partitioning.php --convert-ms instead * issue: Keep log column resizing within the results area on both log tabs, preserve message ellipsis, and use an accessible Font Awesome export button * issue: Load grouped message details only on expansion, 50 at a time, preserving the displayed query's date range and filters instead of rendering every occurrence into hidden rows diff --git a/includes/functions.php b/includes/functions.php index 91ad79a1..767481de 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -30,6 +30,18 @@ require_once $syslog_query_builder; } +/* + * Load core's process helpers before the shims below. The function_exists() + * guards only defer to core when lib/poller.php is already loaded; otherwise + * a later include_once of lib/poller.php (e.g. from syslog_check_upgrade()) + * fatals with "Cannot redeclare cacti_process_still_running()". + */ +global $config; + +if (!function_exists('cacti_process_still_running') && isset($config['base_path']) && file_exists($config['base_path'] . '/lib/poller.php')) { + include_once($config['base_path'] . '/lib/poller.php'); +} + /* * Compatibility shims for Cacti process helpers. *