Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions features/plugin-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,67 @@ Feature: Update WordPress plugins
Success: Updated 2 of 2 plugins.
"""

@require-wp-5.2
Scenario: Updating several plugins downloads their packages side by side
Given a WP install
And an empty cache
And I run `wp plugin delete akismet`

When I run `wp plugin install health-check --version=1.5.0`
Then STDOUT should not be empty

When I run `wp plugin install wordpress-importer --version=0.5`
Then STDOUT should not be empty

When I try `wp plugin update --all`
Then STDOUT should contain:
"""
Downloading 2 packages...
"""
And STDOUT should contain:
"""
Using cached file
"""
And STDOUT should contain:
"""
Success: Updated 2 of 2 plugins.
"""

When I run `wp plugin install health-check --version=1.5.0 --force`
And I run `wp plugin install wordpress-importer --version=0.5 --force`
And I try `wp plugin update --all`
Then STDOUT should not contain:
"""
Downloading 2 packages...
"""
And STDOUT should contain:
"""
Success: Updated 2 of 2 plugins.
"""

@require-wp-5.2
Scenario: Updating a single plugin downloads its package on its own
Given a WP install
And an empty cache
And I run `wp plugin delete akismet`

When I run `wp plugin install wordpress-importer --version=0.5`
Then STDOUT should not be empty

When I try `wp plugin update --all`
Then STDOUT should not contain:
"""
Downloading 1 package
"""
And STDOUT should not contain:
"""
Using cached file
"""
And STDOUT should contain:
"""
Success: Updated 1 of 1 plugins.
"""

@require-wp-5.2 @skip-windows
Scenario: Failed plugin update keeps JSON output parseable
Given a WP install
Expand Down
26 changes: 26 additions & 0 deletions features/theme-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,32 @@ Feature: Update WordPress themes
Success: Updated 2 of 2 themes.
"""

@require-wp-4.5
Scenario: Updating several themes downloads their packages side by side
Given a WP install
And an empty cache
And I run `wp theme delete --all --force`

When I run `wp theme install storefront --version=1.0.0`
Then STDOUT should not be empty

When I run `wp theme install twentytwelve --version=1.0`
Then STDOUT should not be empty

When I try `wp theme update --all`
Then STDOUT should contain:
"""
Downloading 2 packages...
"""
And STDOUT should contain:
"""
Using cached file
"""
And STDOUT should contain:
"""
Success: Updated 2 of 2 themes.
"""

Scenario: Skip theme update when theme directory is a VCS checkout
Given a WP install
And I run `wp theme install twentytwelve --version=3.0 --force`
Expand Down
4 changes: 4 additions & 0 deletions src/WP_CLI/CommandWithUpgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,10 @@ function ( $item ) {
foreach ( $items_to_update as $item ) {
$cache_manager->whitelist_package( $item['update_package'], $this->item_type, $item['name'], $item['update_version'] );
}
// Fetch the packages side by side before the upgrader asks for them one at a time.
if ( method_exists( $cache_manager, 'prefetch' ) ) {
$cache_manager->prefetch( wp_list_pluck( $items_to_update, 'update_package' ) );
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
$upgrader = $this->get_upgrader( $assoc_args );
// Ensure the upgrader uses the download offer present in each item.
$transient_filter = function ( $transient ) use ( $items_to_update ) {
Expand Down
Loading