Making WordPress.org

Opened 13 months ago

Closed 13 months ago

Last modified 12 months ago

#4009 closed enhancement (fixed)

Manage supported/recommended PHP versions in a central location

Reported by: flixos90 Owned by: flixos90
Milestone: Priority: normal
Component: General Keywords: 2nd-opinion servehappy has-patch dev-feedback


Currently the PHP versions WordPress supports and recommends are hardcoded across several locations. With the Servehappy API already in place, we can easily centralize this, so that in the future we will only have to adjust these versions in one place. These versions can then be fetched from any locations across wordpress.org.

Attachments (2)

4009.diff (7.5 KB) - added by flixos90 13 months ago.
4009.2.diff (5.8 KB) - added by flixos90 13 months ago.

Download all attachments as: .zip

Change History (12)

13 months ago

#1 @flixos90
13 months ago

  • Keywords has-patch dev-feedback added; needs-patch removed

4009.diff is a take at this.

  • The Servehappy API now also returns the oldest PHP version that WordPress core still works with (currently 5.2.4).
  • The Requirements and Download pages on wordpress.org take these numbers into account via the API.

See #4004 as a related ticket: The Update PHP page also includes these version numbers, it would already be taken care of there.

Also related, but not directly tied to each other is #4006 (for the near future).

This ticket was mentioned in Slack in #core-php by flixos90. View the logs.

13 months ago

#3 @Otto42
13 months ago

I don't understand this patch. Why would we make a loopback query to api.wordpress.org to get that data? This seems to be a wasteful approach.

#4 @dd32
13 months ago

Yeah, let's not do that.

We can instead make the raw data which serve-happy uses available elsewhere on dotorg through either a global function or constants, similar to WP_CORE_LATEST_RELEASE or wporg_get_versions() which you may have run across in some templates.

It'll probably mean removing the constants from https://meta.trac.wordpress.org/browser/sites/trunk/api.wordpress.org/public_html/core/serve-happy/1.0/config.php and instead replacing it with something like the following:

function wporg_get_recommended_php_version() {
	return [
		// The latest branch of PHP which WordPress.org recommends.
		'recommended' => '7.2',

		// The lowest branch of PHP which is actively supported.
		'supported'   => '7.0',

		// The lowest branch of PHP which is receiving security updates.
		'secure'      => '5.6',

		// The lowest branch of PHP which is still considered acceptable in WordPress.
		'acceptable'  => '5.3'

#5 follow-up: @flixos90
13 months ago

@dd32 Agreed. Is there some file with global data in the meta repository, or where could we create something like that? I think it would be great to define similar constants, but in a central location so that they can be accessed from different sites that are part of the repository.

#6 in reply to: ↑ 5 @dd32
13 months ago

Replying to flixos90:

@dd32 Agreed. Is there some file with global data in the meta repository, or where could we create something like that?

Unfortunately not.. Right now due to the mixed nature of the SVNs we're not really able to mix our main config store of all the version constants/etc with the public meta repository.

A middle ground may be to define it in an a mu-plugin, which would be made available everywhere needed, and easily pulled into the stand-alone API endpoints, that would also work around having to redefine it into the meta-environment

13 months ago

#7 @flixos90
13 months ago

4009.2.diff introduces a must-use plugin that exposes these PHP version constants globally. Since the Servehappy API itself does not run on WordPress, it includes the file manually (not sure that is correct, but I have no idea about it).

@dd32 Can you review? If this isn't what you meant, please clarify, and I'm happy to provide another update.

#8 @dd32
13 months ago

In 8065:

API: Serve Happy: Move the Serve-Happy config constants out from the API and into a global mu-plugin to allow it to be used in other WordPress.org pages.

Props flixos90, dd32.
See #4009.

#9 @dd32
13 months ago

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

In 8066:

WordPress.org Main Theme: Use the Serve Happy constants for the PHP requirements to reduce the number of locations it needs updating in.

Props flixos90, dd32.
Fixes #4009.

#10 @ocean90
12 months ago

In 8158:

WordPress.org Main Theme: Use the Serve Happy constant for the recommenced PHP version in the letter.

See #4009.
Fixes #4114.

Note: See TracTickets for help on using tickets.