티스토리 수익 글 보기
{{ message }}
Avoid passing incomplete data to perflab_render_plugin_card() and show error when plugin directory API query fails #1175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Summary
When working on Image Prioritizer (#1172), I added the plugin to the
perflab_get_standalone_plugin_data()but then I started getting PHPUnit test failures. I also got a bunch of warnings on the Performance screen:The issue here is that Image Prioritizer is not on WordPress.org yet, so the call to
perflab_query_plugin_info()is returning an empty array. Nevertheless, this logic inperflab_render_plugin_card()is not working as expected:performance/includes/admin/plugins.php
Lines 130 to 134 in cb5a37e
This is because we are merging the response from WordPress.org with our own data from
perflab_get_standalone_plugin_data()meaning$plugin_datawill never be empty:performance/includes/admin/plugins.php
Lines 76 to 88 in cb5a37e
This scenario could happen not only if the plugin is not on WordPress.org but also if the query fails due to WordPress.org being down. So with this PR an error is now shown when an error occurs:
This PR also removes the standalone plugin version from being referenced on the Performance screen. It was only referenced in
aria-labelanddata-titleattributes.Lastly, when a WordPress.org Plugins API query fails during installation, an error message is now displayed rather than just a generic error.
Related: #1170