Skip to content

v3.4.7 - #262

Merged
TiTidom-RC merged 15 commits into
masterfrom
beta
Sep 5, 2026
Merged

v3.4.7#262
TiTidom-RC merged 15 commits into
masterfrom
beta

Conversation

@TiTidom-RC

Copy link
Copy Markdown
Owner

This pull request introduces several improvements to the codebase, focusing on enhancing PHP compatibility, improving type safety, and adding new CI workflows for syntax and compatibility checks. The main changes include stricter PHP type declarations, better logging, and the addition of GitHub Actions for PHP and JavaScript checks.

CI/CD and Compatibility Improvements:

  • Added .github/workflows/checkPHPCompat.yml to run PHPStan compatibility checks across PHP 7.4, 8.2, and 8.4, ensuring the code remains compatible with older PHP versions.
  • Updated .github/workflows/checkPHP.yml to only run on PHP files, upgraded the checkout action, and clarified the PHP version used for linting.
  • Added .github/workflows/js-check.yml for JavaScript syntax checking using Node.js 22, to catch JS errors early in CI.

PHP Compatibility and Type Safety:

  • Updated .github/copilot-instructions.md to clarify that, while development targets PHP 8.2, the code must remain compatible with PHP 7.4. Explicitly avoid PHP 8+ syntax (e.g., union types, new string functions, etc.) and document union types in docblocks instead of native type hints.
  • Refactored many methods in Monitoring.class.php to add or improve type declarations for parameters and return types, while maintaining PHP 7.4 compatibility (e.g., using docblocks for union types instead of native hints). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Logging and Code Quality:

  • Improved memory usage logging in Monitoring.class.php by combining usage and peak memory into a single log entry for better readability. [1] [2] [3]
  • Refined logging and error handling, and improved variable initialization and return values for clarity and robustness. [1] [2]

Miscellaneous:

  • Added new words to .vscode/cspell.json to avoid false positives in spell checking for terms like phpstan, shivammathur, and sshmanager. [1] [2]
  • Minor code cleanups and whitespace adjustments for consistency.

These changes collectively improve code maintainability, ensure cross-version compatibility, and strengthen CI checks for both PHP and JavaScript.

TiTidom-RC added 15 commits May 23, 2026 13:52
Introduce a new GitHub Action (checkPHPCompat.yml) to run PHPStan compatibility checks across PHP 7.4, 8.2 and 8.4 for PRs targeting the beta branch. The workflow sets up PHP via shivammathur/setup-php, installs PHPStan, sparse-checkouts Jeedom Core, generates a phpstan.neon file with the target phpVersion, and runs phpstan analyse. Also add phpstan.neon.dist (reportUnmatchedIgnoredErrors: true), rename the existing PHP lint job to indicate PHP 8.4, and update cspell dictionary to include phpstan and shivammathur.
Add a sparse checkout step to clone the SSH-Manager repo and include its core/class directory in the PHPStan scanDirectories. The workflow now clones SSH-Manager (depth 1, blob filter, sparse) into /tmp/sshmanager and appends /tmp/sshmanager/core/class to the generated phpstan.neon so PHP compatibility checks cover that code as well.
Replace direct cmd->event() calls with checkAndUpdateCmd for SSH failure and cron status updates to centralize state updates and simplify code. Add a TODO comment advising evaluation of migrating other event() usages to checkAndUpdateCmd and note the impact on historical graphs (recommend enabling repeatEventManagement = always for stable numeric metrics). Bump pluginVersion to 3.4.7 in plugin_info/info.json.
Move the trimming of $cmd_srv into $_cmd before entering the try block so the command is normalized prior to timeout checks. Removes the redundant trim() inside the try and includes minor whitespace cleanup.
Add path filtering to .github/workflows/checkPHP.yml and checkPHPCompat.yml so PHP CI jobs only run for changes to '**/*.php' on the beta branch. Introduce .github/workflows/js-check.yml: a new workflow that runs on beta PRs touching '**/*.js', checks out the repo, sets up Node 22, and runs `node --check` against JavaScript files (excluding node_modules) to validate syntax. This reduces unnecessary CI runs by scoping jobs to relevant file types.
Add workflow_dispatch to .github/workflows/checkPHP.yml, checkPHPCompat.yml, and js-check.yml so these workflows can be triggered manually from the GitHub Actions UI. Existing path and branch triggers are unchanged; this makes it easier to run lint/compatibility checks on demand for debugging or ad-hoc verification.
Update .github/workflows/js-check.yml to use actions/setup-node@v5 instead of @v4. This brings the workflow onto the latest major release of the setup-node action to pick up improvements and fixes.
Reduce log noise by grouping memory, swap, disk, and pull memory usage details into single entries instead of multiple lines. The stats helper is now typed and returns trend log data so tendency values can be collected and logged once per equipment.
Updated Monitoring debug messages for swap, memory, and HDD metrics to use consistent `key = value` formatting instead of `key=value`. This improves log readability and makes parsing/debugging output more uniform.
Adds PHP 7.4-safe signatures and docblocks across Monitoring, fixes nullable/default type mismatches, and normalizes default values for command results. The change also consolidates debug logging to reduce noise and clarifies the repository guidance around supported PHP versions and compatibility constraints.
Update Monitoring local debug output to include `ARMv` alongside distribution name, bits, and OS version. This improves hardware/platform visibility in logs for troubleshooting.
Add a scoped PHPStan `ignoreErrors` rule for `core/class/Monitoring.class.php` to suppress false positives on `hdd_value`, `cpu_freq`, and `cpu_temp` variables created dynamically via `extract()`. This keeps static analysis strict while handling this known dynamic pattern.
Updates three GitHub Actions workflows (`checkPHP.yml`, `checkPHPCompat.yml`, and `js-check.yml`) to use `actions/checkout@v7` instead of `@v6`, keeping CI dependencies current and consistent.
Bump actions/checkout to v7 in CI workflows
@TiTidom-RC
TiTidom-RC merged commit 8a15fac into master Sep 5, 2026
1 check 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.

1 participant