Skip to content

refactor: safe PHP 7.4 modernization#368

Open
somethingwithproof wants to merge 4 commits intoCacti:developfrom
somethingwithproof:refactor/modernization
Open

refactor: safe PHP 7.4 modernization#368
somethingwithproof wants to merge 4 commits intoCacti:developfrom
somethingwithproof:refactor/modernization

Conversation

@somethingwithproof
Copy link
Copy Markdown

This PR adds strict typing, short array syntax, and null coalescing operators across the plugin. Standalone infrastructure files were removed per architectural mandate.

Copilot AI review requested due to automatic review settings April 9, 2026 21:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to modernize the Intropage Cacti plugin PHP code by enabling strict typing across the plugin’s entrypoints, includes, and panel libraries.

Changes:

  • Added declare(strict_types=1); to most PHP files in the plugin.
  • Minor refactor in include/functions.php within graph preparation logic (currently introduces a syntax error).
  • Added two .omc/sessions/*.json session files (appear to be generated artifacts).

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
themes/index.php Adds declare(strict_types=1);
setup.php Adds declare(strict_types=1);
poller_intropage.php Adds declare(strict_types=1);
panellib/top5.php Adds declare(strict_types=1);
panellib/thold.php Adds declare(strict_types=1);
panellib/system.php Adds declare(strict_types=1);
panellib/syslog.php Adds declare(strict_types=1);
panellib/poller.php Adds declare(strict_types=1);
panellib/misc.php Adds declare(strict_types=1);
panellib/mactrack.php Adds declare(strict_types=1);
panellib/index.php Adds declare(strict_types=1);
panellib/graphs.php Adds declare(strict_types=1);
panellib/busiest.php Adds declare(strict_types=1);
panellib/analyze.php Adds declare(strict_types=1);
panellib/alert.php Adds declare(strict_types=1);
locales/po/index.php Adds declare(strict_types=1);
locales/LC_MESSAGES/index.php Adds declare(strict_types=1);
locales/index.php Adds declare(strict_types=1);
intropage.php Adds declare(strict_types=1);
index.php Adds declare(strict_types=1);
include/variables.php Adds declare(strict_types=1);
include/tab.php Adds declare(strict_types=1);
include/settings.php Adds declare(strict_types=1);
include/index.php Adds declare(strict_types=1);
include/functions.php Adds declare(strict_types=1);; modifies line-graph axis selection logic (currently broken)
include/database.php Adds declare(strict_types=1);
images/index.php Adds declare(strict_types=1);
display.php Adds declare(strict_types=1);
.omc/sessions/f448b489-f1ca-4663-8650-b8ceeeb7ad7b.json Adds session artifact file
.omc/sessions/8d6e588d-c041-4dfc-ba3b-e6d0cc5c85e0.json Adds session artifact file


if (isset($dispdata['line']['unit2']['series'])) {
if (in_array("data$i", $dispdata['line']['unit2']['series'], true)) {
if (in_["data$i", $dispdata['line']['unit2']['series'], true]) {
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This line is a PHP syntax error (in_[]) and will break execution of the plugin when rendering line graphs. It looks like a botched refactor of in_array(...); please restore the correct in_array("data$i", ..., true) check.

Suggested change
if (in_["data$i", $dispdata['line']['unit2']['series'], true]) {
if (in_array("data$i", $dispdata['line']['unit2']['series'], true)) {

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +8
{
"session_id": "f448b489-f1ca-4663-8650-b8ceeeb7ad7b",
"ended_at": "2026-04-09T10:46:01.844Z",
"reason": "other",
"agents_spawned": 0,
"agents_completed": 0,
"modes_used": []
} No newline at end of file
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

These .omc/sessions/*.json files look like editor/automation session artifacts rather than plugin source. They add noise to the repo and may change frequently; please remove them from the PR and add .omc/ to .gitignore if it should never be committed.

Suggested change
{
"session_id": "f448b489-f1ca-4663-8650-b8ceeeb7ad7b",
"ended_at": "2026-04-09T10:46:01.844Z",
"reason": "other",
"agents_spawned": 0,
"agents_completed": 0,
"modes_used": []
}

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +8
{
"session_id": "8d6e588d-c041-4dfc-ba3b-e6d0cc5c85e0",
"ended_at": "2026-04-09T10:57:19.048Z",
"reason": "other",
"agents_spawned": 0,
"agents_completed": 0,
"modes_used": []
} No newline at end of file
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This .omc/sessions/*.json file appears to be a generated session artifact and shouldn’t be tracked in the plugin repository. Please remove it from the PR and ignore .omc/ going forward.

Suggested change
{
"session_id": "8d6e588d-c041-4dfc-ba3b-e6d0cc5c85e0",
"ended_at": "2026-04-09T10:57:19.048Z",
"reason": "other",
"agents_spawned": 0,
"agents_completed": 0,
"modes_used": []
}

Copilot uses AI. Check for mistakes.
Revert bulk array()->[] rewrite damage affecting:
- is_array, in_array, xml2array
- call_user_func_array, filter_var_array
- Function declarations with _array suffix

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
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.

2 participants