File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
plugins/performance-lab/includes/admin Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -343,11 +343,24 @@ function perflab_install_and_activate_plugin( string $plugin_slug, array &$proce
343
343
}
344
344
$ processed_plugins [] = $ plugin_slug ;
345
345
346
- $ plugin_data = perflab_query_plugin_info ( $ plugin_slug );
346
+ $ plugin_data = plugins_api (
347
+ 'plugin_information ' ,
348
+ array (
349
+ 'slug ' => $ plugin_slug ,
350
+ 'fields ' => array (
351
+ 'sections ' => false ,
352
+ ),
353
+ )
354
+ );
355
+
347
356
if ( $ plugin_data instanceof WP_Error ) {
348
357
return $ plugin_data ;
349
358
}
350
359
360
+ if ( is_object ( $ plugin_data ) ) {
361
+ $ plugin_data = (array ) $ plugin_data ;
362
+ }
363
+
351
364
// Add recommended plugins (soft dependencies) to the list of plugins installed and activated.
352
365
if ( 'embed-optimizer ' === $ plugin_slug ) {
353
366
$ plugin_data ['requires_plugins ' ][] = 'optimization-detective ' ;
@@ -372,9 +385,7 @@ function perflab_install_and_activate_plugin( string $plugin_slug, array &$proce
372
385
// Replace new Plugin_Installer_Skin with new Quiet_Upgrader_Skin when output needs to be suppressed.
373
386
$ skin = new WP_Ajax_Upgrader_Skin ( array ( 'api ' => $ plugin_data ) );
374
387
$ upgrader = new Plugin_Upgrader ( $ skin );
375
- // Remove the version number from the link to download the latest plugin version.
376
- $ download_link = (string ) preg_replace ( '#(\/plugin\/[^\/]+)\.\d+\.\d+\.\d+(?:-\w+)?\.zip# ' , '$1.zip ' , $ plugin_data ['download_link ' ] );
377
- $ result = $ upgrader ->install ( $ download_link );
388
+ $ result = $ upgrader ->install ( $ plugin_data ['download_link ' ] );
378
389
379
390
if ( is_wp_error ( $ result ) ) {
380
391
return $ result ;
You can’t perform that action at this time.
0 commit comments