Skip to content

Commit 5f6e82a

Browse files
committed
Return error when requested plugin is not in performance lab's features/plugins
1 parent d2c8bce commit 5f6e82a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugins/performance-lab/includes/admin/plugins.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,17 @@ function perflab_query_plugin_info( string $plugin_slug ) {
8181
while ( count( $plugin_queue ) > 0 ) { // phpcs:ignore Squiz.PHP.DisallowSizeFunctionsInLoops.Found
8282
$current_plugin_slug = array_shift( $plugin_queue );
8383

84-
if ( isset( $plugins[ $current_plugin_slug ] ) || ! isset( $all_performance_plugins[ $current_plugin_slug ] ) ) {
84+
if ( isset( $plugins[ $current_plugin_slug ] ) ) {
8585
continue;
8686
}
8787

88+
if ( ! isset( $all_performance_plugins[ $current_plugin_slug ] ) ) {
89+
return new WP_Error(
90+
'plugin_not_found',
91+
__( 'Plugin not found in Performance Lab\'s features / plugins.', 'performance-lab' )
92+
);
93+
}
94+
8895
$plugin_data = $all_performance_plugins[ $current_plugin_slug ];
8996
$plugins[ $current_plugin_slug ] = wp_array_slice_assoc( $plugin_data, $fields );
9097

0 commit comments

Comments
 (0)