Skip to content

Plugins: offer to replace an installed plugin instead of rejecting the upload - #113944

Draft
escapemanuele wants to merge 1 commit into
trunkfrom
add/plugin-replace-on-upload
Draft

Plugins: offer to replace an installed plugin instead of rejecting the upload#113944
escapemanuele wants to merge 1 commit into
trunkfrom
add/plugin-replace-on-upload

Conversation

@escapemanuele

Copy link
Copy Markdown
Contributor

Fixes https://linear.app/a8c/issue/DOTCOM-18352/uploading-a-newer-zip-of-an-installed-plugin-is-rejected-outright-and

Proposed Changes

Uploading a zip for a plugin the site already has now offers to replace it, instead of dead-ending on an error.

  • Sends the upload to /plugins/replace when a slug is given, and keeps the zip around so the replace can re-send it.
  • The error screen names both versions when the API reports them (“Version 2.0 is ready to replace installed version 1.6”), or says it is already installed when they match.
  • Falls back to today’s rejection screen whenever the slug or the retained file is missing.

Why are these changes being made?

WordPress refuses to unpack a plugin zip over a folder that already exists. Until now that ended the flow: the customer was told the upload failed and pointed at wp-admin to do it by hand.

Most of them were not installing something new — they were updating a plugin they already had. Over five days, 674 sites hit this error 4,223 times, and two thirds of the plugins installed afterwards were ones the site already had (DOTCOM-18352).

Testing Instructions

  1. yarn start, open /plugins/upload/:site on a Business-plan site and install any plugin zip.
  2. Upload the same plugin again, ideally a newer version of it.
  3. The screen offers Replace installed plugin rather than sending you to wp-admin.
  4. Click it: the plugin is replaced in place and the flow continues to the plugins page.

…e upload

Uploading a zip whose plugin folder already exists fails with
`folder_exists`, and the install screen's only way out was to send the
customer to wp-admin. Most of them are trying to update a plugin they
already have.

Route the upload to /plugins/replace when a slug is supplied, retain the
zip so the retry can re-send it, and offer the replace on the error
screen with the installed and uploaded versions when the API reports
them. Falls back to the existing rejection when either is missing.
@github-actions

Copy link
Copy Markdown

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~795 bytes added 📈 [gzipped])

Details
Name Parsed Gzip
marketplace +1.58 kB +0.2% +389 B +0.2%
a8c-for-agencies-referrals +236 B +0.0% +67 B +0.0%
a8c-for-agencies-plugins +236 B +0.0% +70 B +0.0%
a8c-for-agencies-sites +236 B +0.0% +71 B +0.0%
a8c-for-agencies-reports +236 B +0.0% +68 B +0.0%
staging-site +236 B +0.0% +73 B +0.0%
github-deployments +236 B +0.0% +70 B +0.0%
site-logs +236 B +0.0% +70 B +0.0%
site-performance +236 B +0.0% +70 B +0.0%
site-monitoring +236 B +0.0% +70 B +0.0%
woocommerce-installation +236 B +0.1% +69 B +0.1%
jetpack-cloud-plugin-management +236 B +0.0% +70 B +0.0%
scan +236 B +0.0% +70 B +0.0%
backup +236 B +0.0% +70 B +0.0%
site-settings +236 B +0.0% +62 B +0.0%
home +236 B +0.0% +80 B +0.0%
plans +236 B +0.0% +70 B +0.0%
domains +236 B +0.0% +70 B +0.0%
theme +236 B +0.0% +70 B +0.0%
themes +236 B +0.0% +70 B +0.0%
hosting +236 B +0.0% +70 B +0.0%
overview +236 B +0.0% +70 B +0.0%
settings-performance +236 B +0.0% +70 B +0.0%
plugins +236 B +0.0% +70 B +0.0%
sites-dashboard +236 B +0.0% +70 B +0.0%
add-ons +130 B +0.0% +21 B +0.0%
woocommerce +130 B +0.0% +21 B +0.0%
jetpack-social +130 B +0.0% +21 B +0.0%
jetpack-cloud-overview +130 B +0.0% +21 B +0.0%
jetpack-search +130 B +0.0% +21 B +0.0%
jetpack-cloud-features-comparison +130 B +0.0% +21 B +0.0%
jetpack-cloud-pricing +130 B +0.0% +21 B +0.0%
jetpack-cloud-settings +130 B +0.0% +21 B +0.0%
jetpack-cloud +130 B +0.0% +21 B +0.0%
migrate +130 B +0.0% +21 B +0.0%
export +130 B +0.0% +21 B +0.0%
import +130 B +0.0% +21 B +0.0%
gutenberg-editor +130 B +0.0% +21 B +0.0%
comments +130 B +0.0% +21 B +0.0%
posts-custom +130 B +0.0% +21 B +0.0%
earn +130 B +0.0% +21 B +0.0%
checkout +130 B +0.0% +21 B +0.0%
email +130 B +0.0% +21 B +0.0%
google-my-business +130 B +0.0% +21 B +0.0%
stats +130 B +0.0% +21 B +0.0%
jetpack-connect +130 B +0.0% +21 B +0.0%
subscribers +130 B +0.0% +21 B +0.0%
marketing +130 B +0.0% +21 B +0.0%
settings +130 B +0.0% +21 B +0.0%
settings-jetpack +130 B +0.0% +21 B +0.0%
settings-security +130 B +0.0% +21 B +0.0%
podcasting +130 B +0.0% +21 B +0.0%
settings-podcast +130 B +0.0% +21 B +0.0%
settings-newsletter +130 B +0.0% +21 B +0.0%
settings-discussion +130 B +0.0% +21 B +0.0%
settings-reading +130 B +0.0% +21 B +0.0%
settings-writing +130 B +0.0% +21 B +0.0%
posts +130 B +0.0% +21 B +0.0%
pages +130 B +0.0% +21 B +0.0%
people +130 B +0.0% +21 B +0.0%
media +130 B +0.0% +21 B +0.0%
site-purchases +130 B +0.0% +21 B +0.0%
activity +130 B +0.0% +21 B +0.0%
me +130 B +0.0% +21 B +0.0%
site-blocks +130 B +0.0% +21 B +0.0%
security +130 B +0.0% +21 B +0.0%
purchases +130 B +0.0% +21 B +0.0%
privacy +130 B +0.0% +21 B +0.0%
notification-settings +130 B +0.0% +21 B +0.0%
developer +130 B +0.0% +21 B +0.0%
concierge +130 B +0.0% +21 B +0.0%
promote-post-i2 +130 B +0.0% +21 B +0.0%
account-close +130 B +0.0% +21 B +0.0%
account +130 B +0.0% +21 B +0.0%
customize +130 B +0.0% +21 B +0.0%

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~256 bytes added 📈 [gzipped])

Details
Name Parsed Gzip
async-load-signup-steps-woocommerce-install-confirm +236 B +0.3% +71 B +0.3%
async-load-calypso-state-lib-automated-transfer-middleware +236 B +0.5% +72 B +0.5%
async-load-calypso-my-sites-customer-home-celebrate-site-... +236 B +0.0% +74 B +0.0%
async-load-calypso-reader-sidebar +130 B +0.0% +21 B +0.0%
async-load-calypso-layout-guided-tours-component +130 B +0.2% +18 B +0.1%

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant