-
Notifications
You must be signed in to change notification settings - Fork 2
chore: WPGraphQL Logging Data Management #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Introduces a new data sanitization method selection in the settings, allowing users to choose between recommended and custom methods. Adds fields for specifying custom fields to anonymize, remove, or truncate. Includes supporting JavaScript and CSS for dynamic UI behavior, and minor code cleanup in LogsRepository.
🦋 Changeset detectedLatest commit: 228692e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📦 Plugin Artifacts Ready!Download from GitHub Actions run Available plugins:
See the "Artifacts" section at the bottom of the Actions run page |
Introduces DataSanitizationProcessor to sanitize sensitive data in log records based on configurable rules. Updates QueryActionLogger and QueryFilterLogger to encode requests as arrays for improved processing. Registers the new processor in LoggerService to enhance privacy and compliance.
There was a problem hiding this 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 introduces comprehensive data management capabilities for the WPGraphQL Logging plugin, focusing on automated log cleanup, data retention policies, and data sanitization for privacy compliance.
Key Changes
- Added a new Data Management tab with configurable retention periods and deletion settings
- Implemented data sanitization processor with recommended and custom field filtering
- Created automated daily cleanup scheduler with manual cleanup options
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
Plugin.php |
Initialize data deletion scheduler and handle plugin deactivation cleanup |
DataDeletionScheduler.php |
New scheduler class for automated daily log cleanup based on retention settings |
DataSanitizationProcessor.php |
New processor for sanitizing sensitive fields in log records |
LoggerService.php |
Added data sanitization processor to the logging pipeline |
LogsRepository.php |
Added method to delete logs older than specified date |
QueryFilterLogger.php |
Encode request data as JSON before logging |
QueryActionLogger.php |
Encode request data as JSON before logging |
Data_Management_Tab.php |
New admin settings tab for data management configuration |
Settings_Field_Collection.php |
Register the new data management tab |
Text_Integer_Field.php |
New field type for integer input with number validation |
| JavaScript/CSS files | UI enhancements for conditional field display and styling |
README.md |
Comprehensive documentation for data sanitization features |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
plugins/wpgraphql-logging/src/Logger/Processors/DataSanitizationProcessor.php
Show resolved
Hide resolved
plugins/wpgraphql-logging/src/Logger/Scheduler/DataDeletionScheduler.php
Show resolved
Hide resolved
plugins/wpgraphql-logging/src/Logger/Processors/DataSanitizationProcessor.php
Show resolved
Hide resolved
plugins/wpgraphql-logging/src/Logger/Processors/DataSanitizationProcessor.php
Show resolved
Hide resolved
Introduces a ConfigurationHelper class to provide cached, singleton-based access to WPGraphQL Logging configuration. Refactors settings and config retrieval throughout the plugin to use this helper, improving performance, consistency, and cache management. Updates related classes and documentation to use the new approach and initializes automatic cache invalidation in the main plugin setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 47 out of 48 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
plugins/wpgraphql-logging/src/Logger/Processors/DataSanitizationProcessor.php
Show resolved
Hide resolved
plugins/wpgraphql-logging/src/Logger/Processors/DataSanitizationProcessor.php
Show resolved
Hide resolved
plugins/wpgraphql-logging/src/Logger/Scheduler/DataDeletionScheduler.php
Show resolved
Hide resolved
plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/TextIntegerField.php
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 47 out of 48 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
plugins/wpgraphql-logging/src/Logger/Processors/DataSanitizationProcessor.php:1
- This code appears to be in the wrong file. The sanitize_text_field and intval logic should be in TextIntegerField.php, not in DataSanitizationProcessor.php.
<?php
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Description
This pull request introduces a comprehensive "Data Management" feature set for the WPGraphQL Logging plugin, focusing on automated log cleanup, data retention, and data sanitization. It adds a new settings tab in the admin interface, backend logic for retention and sanitization configuration, UI/UX improvements, and supporting code for scheduled cleanup and privacy compliance.
Major new features and changes:
1. Data Management Tab & Settings (Admin UI & Backend)
Data Managementtab to the plugin settings, allowing admins to configure log retention (number of days), enable/disable data deletion, and set up data sanitization options, including custom field handling. (plugins/wpgraphql-logging/src/Admin/Settings/Fields/Tab/Data_Management_Tab.php,plugins/wpgraphql-logging/src/Admin/Settings/Fields/Settings_Field_Collection.php,plugins/wpgraphql-logging/README.md) [1] [2] [3]2. Data Sanitization & Retention Logic
Text_Integer_Fieldfor integer settings in the admin UI, used for specifying retention days. (plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/Text_Integer_Field.php)DataSanitizationProcessorto the logging pipeline to sanitize sensitive fields based on admin configuration. (plugins/wpgraphql-logging/src/Logger/LoggerService.php) [1] [2]3. Automated & Manual Log Cleanup
plugins/wpgraphql-logging/src/Logger/Database/LogsRepository.php)plugins/wpgraphql-logging/README.md,plugins/wpgraphql-logging/src/Admin/Settings/Templates/admin.php) [1] [2]4. UI/UX Improvements for Settings
plugins/wpgraphql-logging/assets/js/settings/wp-graphql-logging-settings.js,plugins/wpgraphql-logging/assets/css/settings/wp-graphql-logging-settings.css) [1] [2] [3]plugins/wpgraphql-logging/src/Admin/Settings/Templates/admin.php,plugins/wpgraphql-logging/README.md) [1] [2]5. Miscellaneous Improvements
plugins/wpgraphql-logging/src/Events/QueryActionLogger.php,plugins/wpgraphql-logging/src/Events/QueryFilterLogger.php) [1] [2]plugins/wpgraphql-logging/README.md)Related Issue
Fixes #355
Dependant PRs
Type of Change
How Has This Been Tested?
Screenshots
Checklist