Repository navigation
Feature-detect Cacti 1.3 instead of CACTI_VERSION in audit_utilities_array - #93
Merged
Merged
Conversation
TheWitness
requested review from
bmfmancini and
xmacan
and
a balanced review from Copilot
October 8, 2026 18:55
There was a problem hiding this comment.
🟡 Changes recommended
The guard does not distinguish the menu implementations on develop, and required behavioral coverage is missing.
2 open findings
What changed in this PR
Updates the audit plugin’s Utilities hook to inspect the menu structure rather than rely on Cacti’s version string.
Changes:
- Guard against a missing Technical Support section before merging the audit entry.
- Update the hook documentation and changelog.
| File | Description |
|---|---|
| setup.php | Replaces the version gate with a section-existence check. |
| CHANGELOG.md | Documents the intended compatibility fix. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
TheWitness
force-pushed
the
fix/utilities-array-version-gate
branch
2 times, most recently
from
October 8, 2026 19:04
0f1a364 to
c2e3324
Compare
TheWitness
force-pushed
the
fix/utilities-array-version-gate
branch
3 times, most recently
from
October 8, 2026 19:18
692daf4 to
06ebb05
Compare
…array
audit_utilities_array() gated its Utilities-page entry on version_compare(CACTI_VERSION,'1.3.0','<'). A develop build can report < 1.3.0 while surfacing the Audit Log link via config_arrays, so the legacy block also ran: the entry was doubled and array_merge() could run against an unset Technical Support key. Detect 1.3 via class_exists('CactiTableFilter') instead and leave the translatable strings unchanged.
TheWitness
force-pushed
the
fix/utilities-array-version-gate
branch
from
October 8, 2026 19:18
06ebb05 to
86bc3ed
Compare
xmacan
previously approved these changes
Oct 8, 2026
…s branches Guard the legacy array_merge() with a null-coalesce so the Utilities hook never runs against an unset Technical Support section (missing-key protection), and replace the single placeholder test with focused coverage for the absent-section, populated-section-with-access, and access-denied paths.
…ches develop
The CI i18n check compares every __() call occurrence, not just unique strings. Extracting the section into a single \ variable dropped __('Technical Support', 'audit') from two calls to one, tripping the pot-sync gate even though the unique-string set is unchanged. Apply the missing-key null-coalesce in place instead.
xmacan
approved these changes
Oct 8, 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.


Problem
audit_utilities_array()(theutilities_arrayhook, which adds a "View AuditLog" entry under Technical Support on the Utilities page) gates on a version
string:
On 1.3 the Audit Log link is surfaced through
config_arraysinstead. Butcurrent
developbuilds still report a version that compares< 1.3.0, so onthose builds this legacy block runs as well — adding the entry a second time,
and, if core no longer pre-populates the legacy
$utilities['Technical Support']section, running
array_merge()against an unset key (TypeError).Same unreliable
CACTI_VERSIONgating recently fixed inplugin_monitor(#270)and
plugin_flowview.Fix
Detect Cacti 1.3 by a class it introduced (
CactiTableFilter) rather than theversion string — the same signal used in the monitor fix — and leave the
string-bearing body untouched:
CactiTableFilter): the entry is added exactlyas before.
< 1.3.0: the block is skipped, sothe entry is never doubled and the
array_merge()never runs on an unset key.Only the gate line changes; the translatable strings are unchanged, so the i18n
template check stays green.
Testing
php -l setup.php— no syntax errors.php tests/bin/check-i18n-pot.php <base>— exit 0 (no translatable-stringchanges).