Skip to content

Commit

Permalink
Revert "Remove hard-coded reference to embed-optimizer"
Browse files Browse the repository at this point in the history
This reverts commit b012d8d.
  • Loading branch information
westonruter committed Nov 11, 2024
1 parent b012d8d commit 70f90b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 2 additions & 6 deletions plugins/performance-lab/includes/admin/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,8 @@ function perflab_install_and_activate_plugin( string $plugin_slug, array &$proce
}

// Add recommended plugins (soft dependencies) to the list of plugins installed and activated.
$standalone_plugin_data = perflab_get_standalone_plugin_data();
if ( isset( $standalone_plugin_data[ $plugin_slug ]['suggest'] ) ) {
$plugin_data['requires_plugins'] = array_merge(
$plugin_data['requires_plugins'],
$standalone_plugin_data[ $plugin_slug ]['suggest']
);
if ( 'embed-optimizer' === $plugin_slug ) {
$plugin_data['requires_plugins'][] = 'optimization-detective';
}

// Install and activate plugin dependencies first.
Expand Down
4 changes: 1 addition & 3 deletions plugins/performance-lab/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,14 @@ function perflab_render_generator(): void {
*
* @since 3.0.0
*
* @return array<string, array{'constant': string, 'experimental'?: bool, 'suggest'?: string[]}> Associative array of $plugin_slug => $plugin_data pairs.
* @return array<string, array{'constant': string, 'experimental'?: bool}> Associative array of $plugin_slug => $plugin_data pairs.
*/
function perflab_get_standalone_plugin_data(): array {
/*
* Alphabetically sorted list of plugin slugs and their data.
* Supported keys per plugin are:
* - 'constant' (string, required)
* - 'experimental' (boolean, optional)
* - 'suggest' (string[], optional)
*/
return array(
'auto-sizes' => array(
Expand All @@ -104,7 +103,6 @@ function perflab_get_standalone_plugin_data(): array {
'embed-optimizer' => array(
'constant' => 'EMBED_OPTIMIZER_VERSION',
'experimental' => true,
'suggest' => array( 'optimization-detective' ),
),
'image-prioritizer' => array(
'constant' => 'IMAGE_PRIORITIZER_VERSION',
Expand Down

0 comments on commit 70f90b6

Please sign in to comment.