Skip to content

fix: load Thold's relocated function library and guard the intropage poller - #409

Merged
cigamit merged 3 commits into
developfrom
fix/thold-includes-relocation
Oct 1, 2026
Merged

cigamit merged 3 commits into
developfrom
fix/thold-includes-relocation

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Summary

The Cacti integration CI (syntax.yml "Check All Pages Using Recursive wget") clones the live default branches of the plugins and runs the poller. It currently fatals in intropage:

PHP WARNING: include_once(.../plugins/thold/thold_functions.php): Failed to open stream: No such file or directory
  in plugins/intropage/panellib/thold.php on line 595
PHP ERROR: Uncaught Error: Call to undefined function get_allowed_thresholds()
  in plugins/intropage/panellib/thold.php:629
CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'intropage'

Root cause

plugin_thold relocated its function library from the plugin root thold_functions.php into includes/functions.php. panellib/thold.php still did include_once($config['base_path'] . '/plugins/thold/thold_functions.php') at four sites, and thold_collect() (run from poller_intropage.php) then called get_allowed_thresholds() without a guard — so the missing include left the function undefined and the poller fataled.

Fix

  • Add intropage_load_thold_functions(), which loads Thold's library from the new includes/functions.php, falling back to the legacy thold_functions.php for older Thold installs.
  • Repoint all four include_once sites to the helper.
  • Guard thold_collect() to return early when Thold's threshold API isn't available (function_exists('get_allowed_thresholds')), so a relocated/missing/incompatible Thold degrades gracefully instead of fataling the poller.

Validation

  • php -l panellib/thold.php clean.
  • No remaining references to the legacy include path except the intentional fallback in the helper.
  • CHANGELOG updated under --- develop ---.

This unblocks the Cacti core integration CI (e.g. Cacti/cacti#8126), which was red solely due to this plugin drift.

Thold moved thold_functions.php to includes/functions.php. intropage's panellib/thold.php still include_once()'d the old plugins/thold/thold_functions.php path and thold_collect() then called get_allowed_thresholds() unguarded, fataling the intropage poller (and the cacti integration CI) with an undefined function. Add intropage_load_thold_functions() (new path preferred, legacy fallback), repoint all four include sites to it, and skip thold_collect() when the threshold API is unavailable.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused compatibility fix correctly handles both library locations and safely avoids the reported undefined-function failure.

Review effort: Balanced
Findings: None

What changed in this PR

Updates Intropage’s Thold integration after its function library relocation.

Changes:

  • Adds current and legacy Thold library path resolution.
  • Prevents poller failures when the threshold API is unavailable.
  • Documents the compatibility fix.
File Description
panellib/​thold.php Adds compatible library loading and poller guard.
CHANGELOG.md Records the Thold integration fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

xmacan
xmacan previously approved these changes Oct 1, 2026
Adds patch-coverage for the new Thold loader helper (new path, legacy fallback, and absent branches) and the four panellib/thold.php call sites by invoking the panel renderers with Thold not installed.
The suite already loads includes/functions.php, so rely on the real get_user_list()/save_panel_result() (require functions.php here too for load-order safety) instead of colliding stubs, set \['is_web']=false so get_user_list() takes its non-web branch without a notice, and assert on the recorded db calls.
@TheWitness
TheWitness requested a review from xmacan October 1, 2026 15:46
@cigamit
cigamit merged commit ab6d9f4 into develop Oct 1, 2026
5 checks passed
@cigamit
cigamit deleted the fix/thold-includes-relocation branch October 1, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants