Repository navigation
Port r65394 and r65395: Site Health moves to core's classes - #23
Merged
Merged
Conversation
Ports r65395 from core trunk. The eight underscore-prefixed functions in wp-includes/secrets.php get @access private, so the code reference shows that they are not meant for plugins or themes. Docblocks only. https://core.trac.wordpress.org/changeset/65395 https://core.trac.wordpress.org/ticket/66187 Props wildworks.
Ports r65394 from core trunk. Core's Site Health checks for the Secrets API are now methods of WP_Site_Health and WP_Debug_Data, and wp-admin/includes/secrets-site-health.php is gone. The statuses, labels and descriptions are unchanged. The debug section key is now wp-secrets-api, the results use the blue Security badge, and they include an actions key. A plugin can't add methods to core's classes, so this is not a straight copy: - src/wp-admin/includes/secrets-site-health.php is removed, as in core, and src/ no longer has a wp-admin/ directory. - plugin/class-secrets-api-site-health.php registers copies of core's eight methods for WordPress before 7.2, through the site_status_tests and debug_information filters, under the same test IDs, labels and debug key. The copies are identical to core's, so they pass no text domain; phpcs excludes that warning and the base64_encode() one for the file, and PHPStan ignores core's untyped inner array in get_wp_secrets_api(). - test-secrets-site-health-parity.php, in the stand-down group, compares each copy with core's on trunk and fails when core changes one. - wp secret health required the deleted file on a core that ships the API, which is a fatal error on trunk. It now calls core's WP_Site_Health methods, falls back to the old functions on 7.2 betas before r65394, and uses the plugin's copies before 7.2. A stand-down test covers it on trunk. - PHPStan stubs declare the 7.2 WP_Site_Health methods and the beta functions, which the WordPress stubs don't have. - test-secrets-site-health.php is core's new siteHealth.php run against the plugin's copies, with tests for the filters in place of core's get_tests(). - docs/spec/scope.md, rotation.md, ADR 0014 and docs/reference/ci.md describe the new layout. Checked on trunk with the nightly smoke suite (149/149), with trunk's PHP files over today's nightly, and on that nightly as is, which still has the beta functions (149/149). https://core.trac.wordpress.org/changeset/65394 https://core.trac.wordpress.org/ticket/66187 Props ericmann, peterwilsoncc, mindctrl.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the two core commits since 0.5.0 (r65394, r65395). One commit each.
Why this matters before tonight's nightly
r65394 deleted
wp-admin/includes/secrets-site-health.php. On a core that ships the API,wp secret healthrequires that file, so on trunk it is a fatal error. The nightly smoke leg runswp secret health, so it fails as soon as the nightly includes r65394. I reproduced the fatal withmain's CLI on trunk code.r65395:
@access privateon the internal helpersDocblocks only.
src/wp-includes/is byte-identical to trunk.r65394: Site Health checks move to
WP_Site_HealthandWP_Debug_DataA plugin can't add methods to core's classes, so this isn't a straight copy:
Old file removed.
src/wp-admin/includes/secrets-site-health.phpis gone, as in core, and with itsrc/wp-admin/.Copies for WordPress before 7.2.
plugin/class-secrets-api-site-health.phpregisters copies of core's eight methods throughsite_status_testsanddebug_information. It uses the same test IDs, labels and debug key (wp-secrets-api) as core.Parity tests.
test-secrets-site-health-parity.php, in thestand-downgroup, compares each copy with core's on trunk. It also checks that every Secrets method on core's classes is copied. I confirmed it fails, and names the method to re-copy, when a copy drifts.wp secret healthnow picks its source by WordPress version:WP_Site_Health's methods.A stand-down test covers the trunk path.
PHPStan.
WP_Site_Healthmethods with@methodtags, and another declares the beta functions. The WordPress stubs predate both.get_wp_secrets_api().Tests.
test-secrets-site-health.phpis core's newsiteHealth.phprun against the plugin's copies. It also has tests for the filters, which take the place of core'sget_tests().Docs.
scope.md,rotation.md, ADR 0014 andci.mdare updated for the new layout.docs/reference/is regenerated.Testing
make test-stand-downon wordpress-develop trunkwp secret healthProps from core: ericmann, peterwilsoncc, mindctrl (r65394); wildworks (r65395).