Repository navigation
fix(upgrade): stop cleanly when an install older than 1.5 is refused - #913
Merged
Merged
Conversation
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>
|
Member
Author
TheWitness
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #908.
After #905,
thold_upgrade_database()returnsfalsefor an install older than 1.5. Three callers ignored that:poller_thold.phpcarried on against the old schema, hit a fatalTypeError, 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.phpprinted "Upgrade Complete!". It now reports the refusal, namescli/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.phpalso raises a message that names the legacy script, so the reason is visible outside the log. New string added tolocales/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.phprecords 1.5 before the install step, and callsthold_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 everythold_upgrade_database(true)call checks forfalse. 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.