feat: #3263615 Add an option to log CLI events, flagged in the report
Issue: https://www.drupal.org/project/admin_audit_trail/issues/3263615
Rerolled sonnykt's CLI logging option onto current 1.0.x (design credit: sonnykt). Changes from the original approach, per the maintainer's feedback:
- CLI events are now FLAGGED in the report: the IP column reads "CLI" and the Path column carries the command line (
cli: <argv>). - The toggle moved to the module's own settings form (
/admin/config/development/audit-trail/settings) as a "Log CLI events" checkbox - the original form_alter on the site-information form is gone; everything lives in the existingSettingsFormandAdminAuditTrailLoggerclasses, no procedural additions. log_cliships in config/install + schema, default off; no update hook needed (a missing key reads as off on existing sites).- Adapts
LoggerForwardingTestto the logger's new constructor signature (the config factory injection this MR adds).
Tests: 3 Kernel tests exercising the genuine CLI code path (PHPUnit runs under the CLI SAPI - no test double): default-off writes nothing, enabled writes a row flagged CLI with the command line, a caller-provided path is preserved. Plus 2 functional scenarios on the settings form (control visible, enabling persists and restores).
Verified locally: kernel suite + PHPStan level 7 green; full varbase-e2e suite and a manual DDEV site check follow before merge.
AI-Generated: Yes
Checkpoints:
- File an issue
- Addition/Change/Update/Fix
- Testing to ensure no regression
- Automated unit testing coverage
- Automated functional testing coverage
-
UX/UI designer responsibilities - Readability
-
Accessibility - Performance
- Security
- Developer Documentation
-
User Guide Documentation - Reviewed by human
- Code review by maintainers
- Full testing and approval
- Credit contributors
- Review with the product owner
- Release notes snippet
- Release
Edited by Rajab Natshah