WordPress.org

Make WordPress Core

Opened 13 months ago

Closed 11 months ago

Last modified 8 months ago

#46074 closed enhancement (fixed)

Provide way for hosts to create a correctly labeled button or link to directly upgrade PHP

Reported by: mikeschroder Owned by: afragen
Milestone: 5.1.1 Priority: normal
Severity: normal Version: 5.1
Component: Site Health Keywords: dev-reviewed servehappy has-patch has-screenshots
Focuses: Cc:
PR Number:

Description

At the moment, it's straightforward to change the link for more information for a user within the hosting upgrade metabox (see: make/core), but if hosts want to link users to immediately upgrade, the text "Learn more..." isn't appropriate for that action.

I think WordPress should either provide a way to do so, or a documented best practice to do so.

See this P2 comment and feedback in Slack for previous context.

Attachments (7)

46074.diff (1.7 KB) - added by afragen 12 months ago.
screenshot_01.png (50.7 KB) - added by afragen 12 months ago.
screenshot_02.png (65.4 KB) - added by afragen 12 months ago.
46074.2.diff (1.7 KB) - added by afragen 12 months ago.
updated @since
46074.3.diff (2.3 KB) - added by desrosj 12 months ago.
46074.4.diff (2.3 KB) - added by lukecarbis 12 months ago.
46074.5.diff (528 bytes) - added by desrosj 11 months ago.
Add missed @since annotation to the 5.1 branch.

Download all attachments as: .zip

Change History (41)

This ticket was mentioned in Slack in #hosting-community by mike. View the logs.


13 months ago

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


13 months ago

#3 @mikeschroder
13 months ago

  • Keywords servehappy added

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


13 months ago

This ticket was mentioned in Slack in #hosting-community by mike. View the logs.


13 months ago

#6 @pento
12 months ago

  • Milestone changed from Awaiting Review to 5.1.1

Let's look at this for 5.1.1.

@afragen
12 months ago

#7 @afragen
12 months ago

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

At WordCamp Phoenix Contributor Day @aaroncampbell and I came up with this as a solution.

An environmental variable and/or a filter may be used to customize this button link, similarly to the customizable link for information on updating PHP in r44476

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


12 months ago

#9 @lukecarbis
12 months ago

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

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


12 months ago

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


12 months ago

@afragen
12 months ago

updated @since

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


12 months ago

@desrosj
12 months ago

#13 @desrosj
12 months ago

46074.2.diff worked great!

In 46074.3.diff, I pulled the code that determines the URL into a separate function. This allows the URL to be retrieved and used in different contexts without the default button. The main use case I had in mind for this was a host filtering the information page URL to one within the WordPress admin with their own branding. They could then output the URL into a call to action on that page.

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


12 months ago

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


12 months ago

#16 @afragen
12 months ago

Patch looks good.

#17 @pbiron
12 months ago

  • Keywords commit added; dev-feedback removed

#18 @SergeyBiryukov
12 months ago

Two minor notes on 46074.3.diff:

  • "Update your site PHP" label looks a bit strange to me, what about just "Update PHP"?
  • Having two primary buttons next to each other also looks a bit weird. Maybe "Learn more" should not have the button-primary class if there's a direct PHP update URL available?

#19 @afragen
12 months ago

@SergeyBiryukov also consider the situation where the host may have another link for Learn more. #46044

I don’t think changing the button type for “Learn More” depending upon whether there is a direct link results in a stunning visual change for something that is still a link.

I do like shortening the text to “Update PHP”.

Last edited 12 months ago by afragen (previous) (diff)

@lukecarbis
12 months ago

#20 @lukecarbis
12 months ago

This diff includes the suggested text change to "Update PHP". Other than that, it's identical to the previous one.

#21 @desrosj
12 months ago

This looks good. Let's commit it and we can iterate on the button styles later.

#22 @desrosj
12 months ago

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

In 44814:

General: Add a way to specify a direct link for a user to update PHP.

A direct URL to where a user can update PHP for their website can now be specified in one of two ways:

  • Defining the WP_DIRECT_UPDATE_PHP_URL environment variable.
  • Returning a URL to the wp_direct_php_update_url filter.

When a URL is specified, an additional “Update PHP” button will be displayed at the bottom of the Core dashboard widget informing administrators that their site is running an outdated version of PHP (see [42832]).

Fixes #46074.
Props afragen, desrosj, lukecarbis.

#23 @desrosj
12 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening to backport.

#24 @desrosj
12 months ago

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

In 44815:

General: Add a way to specify a direct link for a user to update PHP.

A direct URL to where a user can update PHP for their website can now be specified in one of two ways:

  • Defining the WP_DIRECT_UPDATE_PHP_URL environment variable.
  • Returning a URL to the wp_direct_php_update_url filter.

When a URL is specified, an additional “Update PHP” button will be displayed at the bottom of the Core dashboard widget informing administrators that their site is running an outdated version of PHP (see [42832]).

Merges [44814] to the 5.1 branch.

Fixes #46074.
Props afragen, desrosj, lukecarbis.

#25 @birgire
12 months ago

I noticed that @since 5.1.1 is missing from the doc block of the wp_get_direct_php_update_url() function in changeset:44814 and changeset:44815.

#26 @desrosj
11 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Thanks, @birgire! I will add that now.

#27 @desrosj
11 months ago

In 44829:

General: Add missing @since annotation for wp_get_direct_php_update_url().

Missed in [44815].

Props birgire.
See #46074.

@desrosj
11 months ago

Add missed @since annotation to the 5.1 branch.

#28 @desrosj
11 months ago

  • Keywords needs-dev-review added; commit removed

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


11 months ago

#30 @SergeyBiryukov
11 months ago

  • Keywords dev-reviewed added; needs-dev-review removed

46074.5.diff looks good to me for backporting.

#31 @jorbin
11 months ago

In 44831:

General: Add missing @since annotation for wp_get_direct_php_update_url().

Backports [44829] to 5.1 branch. Dev-reviewed by desrosj and SergeyBiryukov.

Missed in [44815].

Props birgire.
See #46074.

#32 @pbiron
11 months ago

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

This ticket was mentioned in Slack in #hosting-community by j-falk. View the logs.


11 months ago

#34 @spacedmonkey
8 months ago

  • Component changed from General to Site Health
Note: See TracTickets for help on using tickets.