-
Notifications
You must be signed in to change notification settings - Fork 2
chore: Internal Testing & Validation WPGraphQL Logging Plugin #456
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
base: main
Are you sure you want to change the base?
Conversation
|
📦 Plugin Artifacts Ready!Download from GitHub Actions run Available plugins:
See the "Artifacts" section at the bottom of the Actions run page |
…cks. Expanded and clarified the readme.txt with detailed features, requirements, installation, and FAQ for the WPGraphQL Logging plugin beta release. Updated contributor list, license, and tested PHP/WP versions. Added and improved PHPDoc blocks in templates and event class for consistency. Renamed TESTING.md to docs/how-to/run_tests.md for better documentation structure. Minor description update in main plugin file.
Renamed admin view template files to use the WPGraphQLLogger* naming convention for consistency. Updated all references in code, documentation, and psalm.xml to match the new filenames.
Wrap CACHE_DURATION in apply_filters to allow customization of the configuration cache duration via the 'wpgraphql_logging_config_cache_duration' filter.
Introduces a filter 'wpgraphql_logging_allowed_orderby_columns' to whitelist allowed columns for ORDER BY in find_logs() queries, enhancing security against SQL injection. Documentation updated with usage details and examples; code now validates both column and direction, falling back to defaults if invalid values are provided.
Introduces Monolog's BufferHandler for database logging and adds the 'wpgraphql_logging_default_buffer_limit' filter to customize buffer size. Updates tests to flush buffer before asserting log counts and documents the new filter. Also adds an index for 'level_name' in the database entity.
… for DatabaseSanitization
Introduces LogEntityInterface defining the contract for log entities and implements it in WordPressDatabaseEntity, which provides methods for creating, saving, and managing log entries in a WordPress database. This lays the foundation for structured logging within the WPGraphQL Logging plugin.
Refactored LogEntityInterface to require a constructor and static from_array method, and removed the create method. Added LogServiceInterface for CRUD operations on log entities. Updated WordPressDatabaseEntity to implement the new interface, including a new constructor, from_array, and static get_table_name. Added WordPressDatabaseLogService to provide database-backed CRUD operations for log entities.
Replaces direct repository usage with LogStoreService for log retrieval in DownloadLogService, improving extensibility. Adds get_query() to LogEntityInterface and implements it in WordPressDatabaseEntity to extract GraphQL queries from log context. Updates related tests to use the new service and interface.
Replaces direct dependency on LogsRepository with LogServiceInterface in DataDeletionScheduler. Updates instantiation to use LogStoreService and modifies log deletion to use the new service method for improved abstraction and flexibility.
Replaces direct usage of LogsRepository with LogServiceInterface in ViewLogsPage for improved abstraction and flexibility. Updates method to retrieve logs via the log service and adds a protected getter for the log service instance. Removes unused LogsRepository import from the related test file.
af8a84c to
9b5ee54
Compare
…processing for Database Service.
Replaces direct usage of DatabaseEntity with LogStoreService in WordPressDatabaseHandler. This change centralizes log entity creation and storage, improving maintainability and consistency.
… the plugin to use interface methods instead so developers can replace the service via the log store service.
Removed DatabaseEntity and LogsRepository classes and their tests. Updated tests to use the new WordPressDatabaseEntity class, including renaming and refactoring the test file. Updated documentation to reflect the new API structure. This change consolidates database logging logic under WordPressDatabaseEntity for improved maintainability.
Description
This PR performs internal testing and validation of the WPGraphQL Logging Plugin to ensure it is ready for GA.
Fixes in the PR
Related Issue
Dependant PRs
Type of Change
How Has This Been Tested?
Screenshots
Checklist