Problem/Motivation
When accessing the "Image styles usage" report provided by the xray_audit module, a 404 error occurs if the responsive_image module is disabled. Additionally, the following error is logged in the watchdog log:
The "responsive_image_style" entity type does not exist.
This suggests that the module does not correctly check for the existence of the responsive_image entity type before attempting to load it, leading to a fatal error in environments where the module is not enabled.
Steps to reproduce
- Ensure the
responsive_imagemodule is disabled. - Navigate to:
/admin/reports/xray-audit/content-metric/image-styles-usage - Observe the 404 error and check the logs for the missing entity type exception.
Proposed resolution
Update the report builder logic to check if the responsive_image module is enabled before querying or interacting with the responsive_image_style entity type. This can be done using \Drupal::moduleHandler()->moduleExists('responsive_image') and conditionally adjusting the logic accordingly.
Remaining tasks
- Implement the module existence check in the image style report generator.
- Add a test to ensure the report does not fail when
responsive_imageis disabled.
User interface changes
No user interface changes expected.
API changes
No API changes expected.
Data model changes
No data model changes expected.
Issue fork xray_audit-3520333
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
antonio nunez commentedComment #5
antonio nunez commentedFixed two issues in the Image Styles Report:
without restrictions.
These changes ensure the report remains accessible and functional regardless of the responsive_image module status.
Comment #6
antonio nunez commentedRefactoring and debugging of the timeout management in the image styles report, as well as correcting the coding standards according to phpcs, phpstan and cspell.
Comment #7
antonio nunez commentedComment #9
lpeidro commentedI change the dev branch (2.x-dev).
Comment #13
lpeidro commentedThe logic for the report related to image styles has been updated. Several independent reports have been created, along with a summary. This approach helps reduce computational load and allows us to manage module dependencies in a more granular way.
Ready to review.
Comment #25
lpeidro commentedTask merged.