Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#52547 closed defect (bug) (fixed)

async loopback site health test fails on alternative setups

Reported by: levdbas's profile Levdbas Owned by: peterwilsoncc's profile peterwilsoncc
Milestone: 5.7 Priority: normal
Severity: normal Version: 5.7
Component: Site Health Keywords: has-patch commit
Focuses: administration Cc:


In changeset [49917] site_url() was used to work with the new REST api tests.
This causes errors in alternative setups like Bedrock where site_url() points to which causes an error on the front-end of the website.

Changing site_url() to home_url() fixes this issue.

Attachments (1)

52547.diff (586 bytes) - added by peterwilsoncc 3 years ago.

Download all attachments as: .zip

Change History (10)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Site Health
  • Milestone changed from Awaiting Review to 5.7

#2 @SergeyBiryukov
3 years ago

  • Version set to trunk

3 years ago

#3 @peterwilsoncc
3 years ago

  • Keywords has-patch commit added

Thanks @Levdbas, I've uploaded 52547.diff which makes the change you suggested.

Manually tested on a sub-directory install locally and all seems good.

#4 @peterwilsoncc
3 years ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from new to closed

In 50381:

Site Health: Use home page for loopback test.

Use home_url() for asynchronous loopback test to ensure correct results on sites with WordPress installed elsewhere, for example WordPress in a sub-directory.

Props Levdbas.
Fixes #52547.

#5 @TimothyBlynJacobs
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening per-discussion in #core-site-health. The intent of using site_url was to more closely mimic how a cron request works. So we need to find a way to keep this close to testing loopback for cron, but not error out on subdirectory installs.

Per discussion with @peterwilsoncc, ( see above ), it looks like the best way to do this would be to make a POST request to site_url( 'wp-cron.php' ). Making this a POST request allows us to quickly exit out of Cron without triggering any cron jobs which might error out since cron would have just been executed when Site Health itself is loaded.

This ticket was mentioned in Slack in #core-site-health by peterwilsoncc. View the logs.

3 years ago

#8 @peterwilsoncc
3 years ago

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

In 50399:

Site Health: Update loopback test to POST to wp-cron.

Replace loopback health check URL with a POST request to wp-cron.php in the WordPress install directory. This more closely represents how WordPress uses loopback requests.

A POST request is used to cause wp-cron.php to exit prior to running any cron jobs. This allows the test to indicate success quicker and accounts for sites that set the DISABLE_WP_CRON constant to avoid running cron jobs on loopback requests.

Props clorith, peterwilsoncc, TimothyBlynJacobs.
Fixes #52547.

Note: See TracTickets for help on using tickets.