WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 4 weeks ago

#50593 closed defect (bug) (fixed)

Check requirements when uploading a plugin/theme by ZIP

Reported by: mariovalney Owned by: SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.4.2
Component: Upgrade/Install Keywords: has-patch
Focuses: docs Cc:

Description

From 9757 we agree uploading a plugin should check PHP required version.

We already check the package is a valid plugin and I think we can add both verifications: Requires PHP and Requires at least. And extend it to themes.

Attachments (1)

48666.diff (4.9 KB) - added by audrasjb 4 weeks ago.
Upgrade/Install: Link HelpHub documentation about PHP and WordPress upgrade after failed plugins and themes upgrade attempts

Download all attachments as: .zip

Change History (13)

#1 @SergeyBiryukov
3 months ago

  • Milestone changed from Awaiting Review to 5.5

This ticket was mentioned in PR #401 on WordPress/wordpress-develop by mariovalney.


2 months ago

  • Keywords has-patch added; needs-patch removed

Add PHP/WP version validation to upload ZIP packages.
Support to theme and plugins.

Ticket: https://core.trac.wordpress.org/ticket/50593

#3 @mariovalney
2 months ago

  • Keywords needs-design needs-unit-tests added

Added a PR with validation to themes and plugins.
I'm using the same strings from 9757 to keep UX.

I guess we can improve this UI at least with the link do HelpHub like @desrosj suggested (wp_get_update_php_url / wp_get_default_update_php_url / wp_get_update_php_annotation).

Maybe keep version string in another line?


Here are prints for each case:

PHP Version for Plugin
https://i.imgur.com/Eoi9eIZ.png

WP Version for Theme
https://i.imgur.com/bedGCVw.png

Last edited 2 months ago by mariovalney (previous) (diff)

#4 @SergeyBiryukov
2 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#5 @SergeyBiryukov
8 weeks ago

In 48666:

Upgrade/Install: Check WordPress and PHP version requirements when uploading a plugin or theme from ZIP file.

Props mariovalney, desrosj.
See #50593.

#6 in reply to: ↑ description @SergeyBiryukov
8 weeks ago

  • Keywords needs-patch added; needs-screenshots has-patch needs-design needs-unit-tests removed
  • Milestone changed from 5.5 to 5.5.1

Replying to mariovalney:

(@desrosj suggests) When the PHP or WordPress requirements are not met, can we link to the HelpHub so that the user has some direction: Maybe this page: https://wordpress.org/support/update-php/?

Let's address this in 5.5.1.

@audrasjb
4 weeks ago

Upgrade/Install: Link HelpHub documentation about PHP and WordPress upgrade after failed plugins and themes upgrade attempts

#7 @audrasjb
4 weeks ago

  • Focuses docs added
  • Keywords has-patch added; needs-patch removed

Added HelpHub links as per @SergeyBiryukov ’s previous comment.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


4 weeks ago

This ticket was mentioned in Slack in #core-auto-updates by audrasjb. View the logs.


4 weeks ago

This ticket was mentioned in Slack in #core by desrosj. View the logs.


4 weeks ago

#11 @SergeyBiryukov
4 weeks ago

  • Keywords commit added

#12 @SergeyBiryukov
4 weeks ago

  • Keywords commit removed
  • Milestone changed from 5.5.1 to 5.5
  • Resolution set to fixed
  • Status changed from reviewing to closed

48666.diff doesn't seem to work as expected in my testing:

  • WP_Upgrader_Skin:error() runs the message through esc_html( strip_tags( ... ) ), so any links are stripped. That was likely added for a reason, so I'm not very comfortable with changing that in a minor release.
  • I think the message should use the checks and functions used for similar messages elsewhere: current_user_can( 'update_php' ), wp_get_update_php_url(), wp_get_update_php_annotation().

Going to re-close this as fixed in 5.5. Created #51152 for addressing the remaining bits.

Note: See TracTickets for help on using tickets.