Skip to content

fix(upgrade): stop cleanly when an install older than 1.5 is refused - #913

Merged
TheWitness merged 2 commits into
Cacti:developfrom
somethingwithproof:fix/upgrade-refusal
Dec 4, 2026
Merged

TheWitness merged 2 commits into
Cacti:developfrom
somethingwithproof:fix/upgrade-refusal

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Fixes #908.

After #905, thold_upgrade_database() returns false for an install older than 1.5. Three callers ignored that:

  • poller_thold.php carried on against the old schema, hit a fatal TypeError, and Cacti disabled the plugin. It now checks the stored version before reading thresholds, prints the reason and returns. The process is unregistered as usual.
  • cli/upgrade.php printed "Upgrade Complete!". It now reports the refusal, names cli/upgrade_legacy.php, and exits 1.
  • thold.php (threshold edit) now prints the reason in the page and stops. The page header is already sent at that point, so a redirect would not work.

The web check in setup.php also raises a message that names the legacy script, so the reason is visible outside the log. New string added to locales/po/cacti.pot.

The CHANGELOG commit also carries the entries for #907 and #909, so only one open pull request edits that file.

Not changed, and still listed in #908: cli/upgrade_legacy.php records 1.5 before the install step, and calls thold_setup_database() twice.

Tested locally: the full Pest suite passes except TholdCommandExecutionTest ("success without output"), which fails on my macOS shell with exit 127 and is unrelated. New tests cover the web message, the poller/CLI case, and that every thold_upgrade_database(true) call checks for false. The poller path was not run against a real pre-1.5 database with this change; the crash it prevents was reproduced earlier on the v1.0.4 and v1.2 schemas.

thold_upgrade_database() returns false for an install that has not been through cli/upgrade_legacy.php, and three callers ignored it. The poller went on to check thresholds against the old schema, hit a fatal error, and Cacti disabled the plugin. cli/upgrade.php printed 'Upgrade Complete!'. Thold pages only logged the reason.

The poller now leaves before reading thresholds, cli/upgrade.php reports the refusal and exits non-zero, the threshold edit page redirects with a message, and the web check raises a message naming the legacy script.

Fixes Cacti#908

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

@somethingwithproof

Copy link
Copy Markdown
Member Author

Note on the CHANGELOG: #903 (issue#580) and #904 (feature#709) merged without lines under --- develop ---. I have not added them here since they are not my changes. Say if you want them in this commit and I will add them.

@TheWitness
TheWitness merged commit cac927d into Cacti:develop Dec 4, 2026
8 checks passed
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.

Installs older than 1.5: poller crashes and Thold is disabled, and cli/upgrade.php reports success

2 participants