WordPress.org

Make WordPress Core

Opened 20 months ago

Closed 6 days ago

Last modified 5 days ago

#48520 closed defect (bug) (fixed)

Remove parsing of readme.txt files from `validate_plugin_requirements()`

Reported by: afragen Owned by: afragen
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: dev-feedback has-patch needs-docs needs-codex
Focuses: administration Cc:

Description

Per discussion in #48515 we are removing the parsing of a plugin readme.txt file.

Everything should belong in the main plugin file headers.

Attachments (1)

48520.diff (1.7 KB) - added by afragen 20 months ago.

Download all attachments as: .zip

Change History (20)

@afragen
20 months ago

#1 @SergeyBiryukov
20 months ago

  • Milestone changed from Awaiting Review to 5.4

Some prerequisites, per comment:25:ticket:48515:

  • Resolve #meta4621, so that all three headers (Requires at least, Tested up to, Requires PHP) could be defined in the same place.
  • Publish posts on make/plugins and make/themes with an announcement for plugin and theme authors to move these headers to the main plugin file or the style.css file, and remove them from readme.txt.

#2 @desrosj
16 months ago

  • Milestone 5.4 deleted

Because the prerequisites are still unresolved, I am going to move this to Future Release. @SergeyBiryukov @afragen feel free to re-milestone this when those are addressed!

#3 @desrosj
16 months ago

  • Milestone set to Future Release

#4 @afragen
12 months ago

Is it really necessary to have Tested up to defined in the main plugin/theme file? For the purposes of this patch the only utilized headers, Requires at least and Requires PHP are already resolved to be required in the main plugin file. https://developer.wordpress.org/plugins/plugin-basics/header-requirements/

While I understand the desire for consistency, the Tested up to header only has relevance to the plugin directory and the plugin directory doesn't parse the main plugin file.

#5 @afragen
4 months ago

  • Keywords needs-refresh added; has-patch removed

#6 @SergeyBiryukov
4 months ago

It seems like a similar change should also be made to validate_theme_requirements() for consistency, which currently reads the Requires at least and Requires PHP headers from the theme's style.css file, and if they are not present there, also checks readme.txt as a fallback.

Since readme.txt is only used as a fallback in both cases, I'm not sure I see a strong benefit in removing it, but if it helps reduce the confusion of putting these headers into the correct place as outlined in #48515, then it might be a good idea.

That said, as of this time, the Requires at least and Requires PHP headers are included as suggested examples both in Header Requirements and Plugin Readmes articles. If we proceed with only recommending a single place for them, I guess they should be removed from the latter.

This ticket was mentioned in PR #1026 on WordPress/wordpress-develop by afragen.


4 months ago

  • Keywords has-patch added; needs-refresh removed

Remove check in readme.txt file for Requires at least and Requires PHP headers in plugins and themes for validation. While these headers may be in the readme.txt files, they should be in the main plugin file and the theme's style.css file.

Trac ticket:https://core.trac.wordpress.org/ticket/48520

#9 @afragen
4 months ago

  • Milestone changed from Future Release to 5.8

#10 @afragen
4 months ago

Requires at least and Requires PHPalso required in Theme Header Requirements to be included in style.css.

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


4 months ago

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


4 months ago

#13 @afragen
3 months ago

  • Owner set to afragen
  • Status changed from new to assigned

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


3 months ago

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


7 days ago

#16 @audrasjb
7 days ago

  • Keywords needs-docs needs-codex added

The PR looks good to me 👍
Adding needs-docs and needs-codex workflow keywords as some articles will need to be updated in both helphub and devhub.

#17 @afragen
7 days ago

I'm not advocating removing any headers from the readme.txt file.

I am advocating better messaging to developers that any WP or PHP requirements for the plugin or theme are placed in the plugin/theme headers.

This means that requirements data for plugins and themes for validate_plugin_requirements() and validate_theme_requirements() are only gathered from the file headers.

I hope that's more clear. If not, let me know and I'll try to clarify.

#18 @SergeyBiryukov
6 days ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 51092:

Upgrade/Install: Remove parsing of readme.txt files for plugin or theme requirements.

This affects:

  • validate_plugin_requirements()
  • validate_theme_requirements()

Historically, the Requires PHP header was introduced in #meta2952 for the Plugin Directory first, so at the time it made sense to have it defined in the same place as Requires at least, which only existed in readme.txt.

Since parsing of PHP and WordPress requirements was later added to WordPress core, the core should retrieve all the necessary data from the main plugin or theme file and not from readme.txt, which only contains the data meant for the Plugin or Theme Directory.

The recommended place for Requires PHP and Requires at least headers is as follows:

  • The plugin's main PHP file
  • The theme's style.css file

The place for the Tested up to header remains in readme.txt for the time being, as it's not used by WordPress core.

Follow-up to [44978], [45546], [47573], [47574], [meta5841], [meta9050].

Props afragen, Otto42, joyously, williampatton, audrasjb.
Fixes #48520. See #48515, #meta2952, #meta4514, #meta4621.

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


5 days ago

Note: See TracTickets for help on using tickets.