28 Commits
Author SHA1 Message Date
TheWitnessandCopilot 9b217e0e3a INFO: set compat to 1.2.29 (#838)
* INFO: set compat to 1.2.32

* docs: update Copilot instructions Cacti baseline to 1.2.32 (matches INFO compat)

* INFO: back off compat to 1.2.29

* Add manifest.json + upgrade-time file pruning

* Prune phpunit.xml on upgrade and ignore markdown-lint configs

phpunit.xml ships in the repo for CI but is a dev-only test artifact, so it
is removed from manifest.json 'expected', pruned from installs on upgrade
(like tests/), and excluded from the manifest drift check.

The retired markdown-lint configs (.mdlrc, .md_style.rb) are deleted, and
.md* is now ignored like .git*: protected from pruning and excluded from
drift if it reappears.

* Move thold_functions.php and thold_webapi.php into includes/; flatten css

The main threshold library becomes includes/functions.php and the web API
helper becomes includes/webapi.php; every caller (setup.php, includes/*, the
CLI/poller/notify entry points and the test suite) loads them from includes/.
Each per-theme stylesheet css/<theme>/main.css becomes css/<theme>.css so users
can drop their own css/<theme>.css into the css base, and the page_head hook
looks there. Old paths are tombstoned so existing installs drop the stale
copies on upgrade.

* Regenerate cacti.pot for the includes/ file relocations

Moving the plugin's library files into includes/ changed the source-reference
lines in the translation template; regenerate it so the 'Verify translation
template' CI check passes.

* Harden the hook-include test and make RPN integer ops explicit

The HookFunctionsIncludeTest invokes real hooks with placeholder input purely
to execute their relocated include_once lines; it now swallows engine
notices/warnings/deprecations during those calls (and restores the error
handler and config afterward) so it cannot trip the suite's failOnDeprecation
or leak state into other tests. The RPN % and ^ operators now cast their
operands to int explicitly, matching their long-standing integer-truncation
behaviour while silencing the implicit float-to-int conversion deprecation.

* Harden prune against tampered-manifest path traversal

The upgrade-time prune now rejects any tombstone containing '.'/'..' segments
(which could escape the plugin directory or resolve to its root) and treats
ancestors of whitelist entries as protected, so a tombstone on a parent
directory can no longer delete a whitelisted file beneath it.

* docs: update and align the Project Structure block

Point the structure tree at the relocated files (libraries now under
includes/, data files under docs/, stylesheets under css/) and align the
trailing '# ...' comments to a single column so they no longer drift right.

* docs/tests: standardize test header and correct manifest-contract notes

- Use the full license header (from the plugin's own setup.php) in
  tests/Unit/PruneFilesTest.php instead of the abbreviated copyright banner.
- Document that the manifest drift check and the upgrade-time prune also
  handle phpunit.xml and .md* files, matching the implemented behavior.

* refactor: rename prune helpers to the plugin-slug function prefix

The repository naming contract reserves the plugin_<name>_ prefix for plugin
lifecycle / hook-registration functions; all other functions use the plain
<name>_ prefix. Rename the internal upgrade helpers accordingly:

  plugin_<name>_prune_files() -> <name>_prune_files()
  plugin_<name>_rmtree()      -> <name>_rmtree()

The call site, unit tests, and the copilot-instructions.md references are
updated to match. No behavioral change.

* chore: set the Cacti compatibility floor to 1.2.29

Align the compat metadata (and the contributor-guide references) with the
team decision to standardize the minimum supported Cacti version at 1.2.29;
the previously proposed 1.2.32 floor was not adopted.

---------

Co-authored-by: Copilot <copilot@users.noreply.github.com>
2026-10-01 01:40:00 -05:00
TheWitness 41dc700357 Add PHPDoc blocks to undocumented functions (partial - thold_functions.php follow-up owed) (#828)
* Add PHPDoc blocks: small files batch (cli_import, poller_thold, includes/tab, includes/database, cli_thresholds, thold_notify, notify_queue)

* Add PHPDoc blocks: includes/polling.php, includes/settings.php (WIP checkpoint)

* Add PHPDoc blocks: thold_process.php, thold_daemon.php (WIP checkpoint)

* Add PHPDoc blocks: thold_webapi.php (WIP checkpoint)

* Add PHPDoc blocks: thold.php (WIP checkpoint)

* Add PHPDoc blocks: thold_graph.php (WIP checkpoint)

* Add PHPDoc blocks: notify_lists.php (WIP checkpoint)

* Add PHPDoc blocks: thold_templates.php (WIP checkpoint)

* Add PHPDoc blocks: setup.php batch 1-2 (WIP checkpoint)

* Add PHPDoc blocks: setup.php batch 3-4 (WIP checkpoint)

* Add PHPDoc blocks: setup.php batch 5 (WIP checkpoint)

* Add PHPDoc blocks: setup.php batch 6-7 (WIP checkpoint)

* Add PHPDoc blocks: setup.php complete

* Address review feedback and refresh translation template

- Fix thold_update_host_status() return type (int|null, since it
  falls through with no explicit return in the normal case)
- Fix @global $device_change_fields description in
  thold_config_arrays() (appends this plugin's fields, not unused)
- Fix @global $config description in thold_graph_button() (used to
  build the Create Threshold link's URL)
- Fix thold_data_source_action_prepare()/thold_graphs_action_prepare()
  return types (array|void; only the non-plugin_thold_create branch
  returns $save)
- Fix @global $timearray description in list_tholds() (used to render
  each baseline threshold's reference time range)
- Fix @global $thold_types description in thold_show_log() (used to
  render each log row's type column)
- Regenerate locales/po/cacti.pot (source line references only)
- Fix .gitignore pattern for compiled .mo files (locales/LC_MESSAGES/, not locales/po/)

* test(coverage): allowlist untestable entry points touched by PHPDoc pass

This PR only adds PHPDoc blocks (no functional changes), but touching every file in the plugin newly triggers the 'Enforce coverage of changed lines' CI gate for files that were never require()'d by any test before now:

- cli_import.php, cli_thresholds.php: CLI entry points (include cli_check.php / chdir + execute at the top level).

- poller_thold.php: poller entry point, same category.

- thold.php, thold_graph.php, thold_templates.php, notify_lists.php: authenticated web entry points (chdir + include(auth.php) at the top level), like notify_queue.php/thold_notify.php already allowlisted above.

- thold_daemon.php: daemon entry point, same category as thold_process.php already allowlisted above.

- includes/settings.php, includes/tab.php: Settings-page/header-tab-bar hook callbacks, only meaningful inside a live Cacti page render.

- thold_webapi.php: web-page action handlers that read \ and the database directly.

None of these can be require()'d into the isolated unit test process, matching the existing allowlist entries' precedent exactly. Verified locally: running patch-coverage.php against the PR's actual base ref confirms all 11 files are no longer reported as unexpected-unmeasured.

* docs: add PHPDoc blocks to remaining thold_functions.php functions

* chore: refresh translation template after PHPDoc line-number shifts
2026-09-25 12:30:04 -04:00
TheWitness 0f526404f7 Updating copyrights to 2026 (#740) 2026-02-14 14:16:33 -05:00
TheWitnessandCopilot 2d3b623d7a Updating workflow to include code validation PHP8.4 and MariaDB 10.6 (#739)
* Adding Worflows for code validation

* Apply php-cs-fixer rules

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-06 06:59:30 -05:00
TheWitness a7991dc6cf QA: Update Copyrights to 2025 2025-06-16 09:26:09 -04:00
TheWitness 4b14a89172 Allow Templates and Thresholds to have an External ID
feature: Allow Templates and Thresholds to include an External ID
2024-01-30 20:22:37 -05:00
netniV 4d9210e76b Update copyright for 2023 2023-01-04 22:31:06 +00:00
TheWitness 9e7443b3f0 Updating copyrights 2023-01-03 19:38:50 -05:00
Jing Chen 877d6044ee Fixed: error_reporting() does not support string format MACRO since PHP 8.0 (#561) 2022-12-01 08:33:20 +00:00
TheWitness 33a1342835 Fixing Issue #542 and Copyright Years 2022-02-13 13:21:17 -05:00
browniebraun af7c0bb35f clean up
-unreachable statement
-typo
2021-01-13 21:27:11 +01:00
netniV 2db7e7f61c Update copyright year and tweak service documentation 2020-02-15 09:56:40 +00:00
TheWitness 9809bda400 Fixing Issue #292
* New Requirement: CLI to import thold template
* This function moves some of the import functions to thold_functions.php
* Additionally updated the cli_thresholds.php to use cli_check over global
* Added import logging to the import of templates.
2019-04-10 10:06:34 -04:00
TheWitness 7053e7e834 Fixing one bug and half implementing another feature. 2019-01-02 18:43:48 -05:00
TheWitness 8517b189ac Code context review 2018-12-28 14:48:11 -05:00
TheWitness 0ad5286c97 Major forked thold merge to Cacti core thold plugin
For those of you watching, you may have thought I was never going to commit again.  Well, you were wrong 👍  I'm alive and still working on Cacti and a number of plugins.  Just not in a very public way.  You may be aware of my other work, and if so, that's great!

My current employer is allowing me to port a number of thold changes back to the Cacti community from our forked version.
 It was a necessity since the Cacti core version of the plugin has advanced so much since our forked version was first created.

Of the commits that will be forthcoming, this is the first.  In this first commit, I'm adding the following:

* Adding some additional hooks to the Notification List functionality for one of my non-public plubins.
* Adding Acknowledgment functionality to thold
* Allowing optional per threshold and per template specific email body support for both warnings and alerts
* Allow optional command line execution as the result of a threshold alert breach or restoral event.
* Allow threshold actions to be hooked by other plugins.  These hooks will be used by some of my non-public plugins for performing specific thold actions
* Add hooks for threshold and and template editing and saving
* Some faily significant code cleanup and code reduction
* In addition, I've found a number of smaller bugs that I will remediate via the GitHub issues list.

There are additional changes that I will be making subsequent to this commit, that include:

* Using a Threshold template to drive the creation of Graphs.  It's kind of backwards, but it works pretty well.
* Possible additional changes to the various hooks as I modify my gridalarms plugin to work with this version of thold.
* Any bug fixes that I discover from this major change.

Note, that you must be using Cacti 1.2 in order to leverage this new version of thold.  You are free to test it prior to it's release formal release of course.  I'm pretty sure all the core functionality is there as of right now.  However be warned, that I may for example pull or add a column or two, but you can rest assured that forcing another upgrade should fix things automatically.

Finally, let's not all get too excited.  I'm doing this work for my employer who has been kind enough to allow this work to happen.  None-the-less, I'm glad to be back, if only for a short time.

TW
2018-12-28 14:15:20 -05:00
netniV f6ae90a989 Convert remaining messages to use thold_raise_message() 2018-09-20 14:00:08 +00:00
cigamit 29060a20e0 Help and Version Audit 2017-02-09 19:53:02 -06:00
cigamit 4c91ea49ff Resolving Issues #32
After this change, you will have to run the following SQL command, and
then goto the Threshold console pick to completely resolve.

UPDATE plugin_config SET version='1.0 WHERE directory='thold';

Thanks for reporting.
2017-01-15 12:35:32 -06:00
cigamit ce4aefe2e6 Correcting spelling and grammar issues
Also, add new columns for future HRULE feature.
2017-01-12 19:10:21 -06:00
cigamit 511a405a5f Update Copyright Years plus some missed updates 2017-01-02 08:11:29 -06:00
cigamit 2783b75b26 Support new warning system 2016-08-23 16:36:26 -05:00
cigamit ea3bb05390 double to single quotes, daemon work, ui and css changes 2016-05-07 10:08:11 -05:00
cigamit 66c52935c6 compatibility for Cacti 1.0 2016-04-12 21:34:02 -05:00
Andreas Braun 41b4c07e1c update copyrights
git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti_plugins/thold/trunk@2247 67214365-cc29-0410-bfbe-843132f0f3d7
2014-08-23 08:26:22 +00:00
Jimmy Conner f843a09103 Copy the stable branch over to trunk
git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti_plugins/thold/trunk@2087 67214365-cc29-0410-bfbe-843132f0f3d7
2012-05-18 17:27:14 +00:00
Larry Adams e260287415 QA: Fix numerous dos2unix issues
QA: Change Many buttons from Images to buttons
QA: Change Table Widths
Note: No Functional Changes

git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti_plugins/thold/trunk@790 67214365-cc29-0410-bfbe-843132f0f3d7
2010-03-23 01:13:52 +00:00
Jimmy Conner 93469c48a8 Update truck to latest dev version:
Major changes to how thresholds work
Add in threshold escalation
Add in ability to run scripts / snmp write / etc... (hookable) - Still more work necessary
Add in log viewer (lots more tweaking necessary)


git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti_plugins/thold/trunk@660 67214365-cc29-0410-bfbe-843132f0f3d7
2010-02-19 16:06:33 +00:00