Commit Graph

48 Commits

Author SHA1 Message Date
Sergey Biryukov e72fff9cef Code Modernization: Replace `dirname( __FILE__ )` calls with `__DIR__` magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.

git-svn-id: https://develop.svn.wordpress.org/trunk@47198 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-06 06:31:22 +00:00
Sergey Biryukov 637b6f5456 Site Health: Rename `WP_Site_Health::initialize()` introduced in [47063] to `::get_instance()`, for clarity and consistency with other core classes.
Use `WP_Site_Health::get_instance()` where it's needed, instead of creating multiple instances of the class.

Props afercia, xkon, Clorith, SergeyBiryukov.
See #47606.

git-svn-id: https://develop.svn.wordpress.org/trunk@47149 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-01 00:37:14 +00:00
Sergey Biryukov cfc3b57488 Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47122 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-29 00:43:23 +00:00
Sergey Biryukov 396cc8205b Site Health: Introduce Site Health Status dashboard widget.
The widget informs administrators of any potential issues that should be addressed to improve the performance or security of their website, and directs them to the Site Health screen for more details.

Props Clorith, hedgefield, guddu1315.
See #47606.

git-svn-id: https://develop.svn.wordpress.org/trunk@47063 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-12 13:31:49 +00:00
Sergey Biryukov 4b60e6a0db Site Health: Add a test for PHP default timezone.
The test reports a failure if the default timezone was changed with `date_default_timezone_set()` to anything other than `UTC`.

WordPress historically uses `UTC` as the default timezone for calculating date and time offsets, overriding it is not recommended and can cause widespread and obscure issues.

Props Rarst, Clorith, TimothyBlynJacobs.
Fixes #48692.

git-svn-id: https://develop.svn.wordpress.org/trunk@46797 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-28 15:46:45 +00:00
Sergey Biryukov 04293be9e8 Site Health: Improve the wording for `UTF8MB4` test description.
Props garrett-eclipse, chetan200891, johnjamesjacoby, ayeshrajans.
Fixes #48044.

git-svn-id: https://develop.svn.wordpress.org/trunk@46402 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-05 02:38:14 +00:00
Jonathan Desrosiers d65349005c Site Health: Improve the message displayed to sites not utilizing HTTPS.
The new message better illustrates that there are many potential benefits of using HTTPS, not just a few.

Props garrett-eclipse, dkarfa, ocean90, afragen, desrosj.
Fixes #48118.

git-svn-id: https://develop.svn.wordpress.org/trunk@46358 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-30 17:53:53 +00:00
Jonathan Desrosiers 336960897d Build/Test Tools: Introduce automated PHP compatibility checking.
This change introduces a new Composer script, `compat` that will scan the codebase for (detectable) potential PHP compatibility issues using the `PHP_CodeSniffer` and a custom ruleset based off of the `PHPCompayibilityWP` ruleset (`phpcompat.xml.dist`).

The command will be run as a separate job within each Travis build. While many compatibility issues and false positives have already been corrected in this commit and other Trac tickets, there are still some remaining. For that reason, the job is allowed to fail while the remainder of the potential compatibility issues are investigated and addressed. After those are resolved, the job should be set as required to pass to help prevent new compatibility issues from being introduced.

Props desrosj, jrf, all PHPCompatibilityWP and PHPCompatibility contributors.
Fixes #46152.

git-svn-id: https://develop.svn.wordpress.org/trunk@46290 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-25 13:46:55 +00:00
Sergey Biryukov a9fb2f6a38 Site Health: Introduce `site_status_test_result` filter for the output of a finished Site Health test.
Props Clorith.
Fixes #47864.

git-svn-id: https://develop.svn.wordpress.org/trunk@46269 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 20:03:15 +00:00
Sergey Biryukov 9a105cf004 Site Health: Update PHP extension tests to reflect the current state of the Hosting Teams handbook recommendations.
Props Clorith, bronsonquick, jrf, johnbillion, galbaras, mikeschroder, jorbin.
Fixes #47454.

git-svn-id: https://develop.svn.wordpress.org/trunk@46268 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 19:49:06 +00:00
Sergey Biryukov 13be30f493 Site Health: Improve wording for PHP update warning.
Props danieltj, garrett-eclipse, marybaum, afragen, chetan200891.
Fixes #47644.

git-svn-id: https://develop.svn.wordpress.org/trunk@46267 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 19:38:56 +00:00
Dominik Schilling 144c5f760d Site Health: Don't verify SSL certificate when testing the local site.
The SSL certificate may be self-signed which prevents various tests from returning proper results. Since the Cron API and file editors don't verify the certificate the tests shouldn't either.

Props Clorith, ocean90.
Fixes #47957.

git-svn-id: https://develop.svn.wordpress.org/trunk@46231 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-21 16:05:13 +00:00
Sergey Biryukov 00b03f2a6f I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.

git-svn-id: https://develop.svn.wordpress.org/trunk@45932 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-03 00:39:13 +00:00
Sergey Biryukov 83efbc67e3 Site Health: Standardize on `SELECT VERSION()` query for checking the database server version, due to the MariaDB version declaration potentially causing issues in production environments.
Partially reverts [45691].

Props Clorith.
Fixes #47738.

git-svn-id: https://develop.svn.wordpress.org/trunk@45904 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-28 03:07:59 +00:00
Sergey Biryukov 4f86944a09 Docs: Add missing `@since` tag for `WP_Site_Health::has_late_cron()`.
See #47223.

git-svn-id: https://develop.svn.wordpress.org/trunk@45803 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 00:41:25 +00:00
Peter Wilson f29952ab74 Site Health Check: Increase time allowance for cron checks.
Introduces `WP_Site_Health::has_late_cron()` for late wp-cron jobs and extends the time allowance before a job is considered missed.

In a standard configuration using loopback requests, a job is considered late once past due and missed over five minutes past due.

Late and missed time frames are extended if `DISABLE_WP_CRON` is defined as `true` to allow for crontab tasks running less frequently. A job is considered late once it's 15 minutes past due and missed over one hour past due.

A file for site health unit tests has been introduced with tests for cron in critical, late and missed states.

Props rockfire, afragen, peterwilsoncc.
Fixes #47223.


git-svn-id: https://develop.svn.wordpress.org/trunk@45801 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 00:34:53 +00:00
Sergey Biryukov cbbaca7ade Docs: Fix typo in a comment in `WP_Site_Health::get_test_theme_version()`.
See #47110.

git-svn-id: https://develop.svn.wordpress.org/trunk@45733 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-04 00:47:20 +00:00
Sergey Biryukov 17d1f402e2 Site Health: If `WP_DEFAULT_THEME` doesn't exist, use `WP_Theme::get_core_default_theme()` as a fallback.
Props ajayghaghretiya1, juliobox, SergeyBiryukov.
Fixes #47299.

git-svn-id: https://develop.svn.wordpress.org/trunk@45732 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-04 00:01:14 +00:00
Sergey Biryukov df874c9858 Site Health: Consistently use `wpdb::db_version()` for checking the database server version, instead of partically replicating its functionality.
Props Clorith, wpfed.
Fixes #47738.

git-svn-id: https://develop.svn.wordpress.org/trunk@45691 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-28 14:54:06 +00:00
Sergey Biryukov 8df86efc2b Site Health: Use consistent verbiage for "Learn more" links.
Props ronakganatra, garrett-eclipse.
Fixes #47302.

git-svn-id: https://develop.svn.wordpress.org/trunk@45649 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-16 22:27:55 +00:00
Sergey Biryukov a65fcde5c0 I18N: Merge duplicate "Your plugins/themes/translations are all up to date" strings.
Props ramiy.
Fixes #47252.

git-svn-id: https://develop.svn.wordpress.org/trunk@45647 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-16 22:13:01 +00:00
Sergey Biryukov ee8771923a Site Health: In PHP modules test description, move the space before the screen reader text out from the translatable string.
Props ocean90, tobifjellner.
Fixes #47161.

git-svn-id: https://develop.svn.wordpress.org/trunk@45346 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-17 11:49:52 +00:00
Sergey Biryukov 040a58ff57 Site Health: Use correct singular string for plugin and theme version tests.
Props edocev, Presskopp.
Fixes #47264.

git-svn-id: https://develop.svn.wordpress.org/trunk@45336 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-17 00:59:20 +00:00
Sergey Biryukov e6dcab7803 Site Health: In PHP modules test, ensure the description is translated as a whole sentence, not as separate string parts.
Props dimadin, SergeyBiryukov.
Fixes #47161.

git-svn-id: https://develop.svn.wordpress.org/trunk@45331 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-17 00:06:49 +00:00
Sergey Biryukov 0126a4bd2a Site Health: In HTTP requests test, when checking whether the `WP_HTTP_BLOCK_EXTERNAL` constant is defined, check its value as well.
Props chesio.
Fixes #47297.

git-svn-id: https://develop.svn.wordpress.org/trunk@45328 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-16 22:07:35 +00:00
Jonathan Desrosiers 851cb8b8f2 Site Health: Improve vertical alignment of icons in test result descriptions.
This change removes redundant CSS properties for different health check statuses in favor of utilizing the `.dashicons` class already in Core to define them more consistently. This also fixes the vertical alignment issues.

Props chetan200891, Clorith, desrosj.
Fixes #46940.

git-svn-id: https://develop.svn.wordpress.org/trunk@45309 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-15 14:24:15 +00:00
Jonathan Desrosiers f10ea0702a Site Health: Link to the correct plugin update screen in multisite installs.
Props Clorith, sebastienserre, jeremyfelt, desrosj.
Fixes #47189.

git-svn-id: https://develop.svn.wordpress.org/trunk@45308 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-15 14:11:50 +00:00
Jonathan Desrosiers 62645be17e Site Health: Disable recommendations that could be problematic on multisite installs.
When viewing Site Health for a multisite install, there are a few recommendations that are not appropriate and could have negative implications for other sites on the install if the administrator follows the advice provided.

For example, Site Health recommends that inactive plugins and themes for a site should be removed. On a single site install, this is a great recommendation. However, on a multisite install, inactive plugins and themes for one site should not be removed because they could be active for other sites on the network.

This change also disables the `test_wp_version_check_attached()` test for multisite. This test checks for the presence of the `wp_version_check()` function on the `wp_version_check` hook, which is not present for every site on multisite.

Reviewed by jeremyfelt and desrosj.

Props iandunn, Clorith, azaozz, jeremyfelt.
Fixes #47084.

git-svn-id: https://develop.svn.wordpress.org/trunk@45275 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-01 18:07:46 +00:00
Andrew Ozz e13ef071ff Site Health: Fix count of inactive themes and the recommendation to remove them when the default theme is active or is a parent of the active child theme.
Props sudhiryadav, ianbelanger, mukesh27, azaozz.
Fixes #46900.

git-svn-id: https://develop.svn.wordpress.org/trunk@45260 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-23 21:36:02 +00:00
Sergey Biryukov 60fd53ef96 Site Health: Allow any callable added via `site_status_tests` filter to return test results for direct tests.
Async tests still need to be a string for the AJAX action.

Props kraftbj.
Fixes #46836.

git-svn-id: https://develop.svn.wordpress.org/trunk@45234 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-17 14:34:12 +00:00
Sergey Biryukov d52d60c809 Site Health: Merge duplicate "utf8mb4 requires a newer client library" strings.
Props ramiy.
Fixes #46917.

git-svn-id: https://develop.svn.wordpress.org/trunk@45196 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-13 18:17:16 +00:00
Sergey Biryukov 7d54ac58cc Site Health: Merge duplicate "Error" strings.
Props ramiy.
Fixes #46915.

git-svn-id: https://develop.svn.wordpress.org/trunk@45195 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-13 18:11:46 +00:00
Sergey Biryukov 936db1b0e1 Site Health: i18n audit, take 2.
* Use `wp.i18n` to translate JavaScript strings.
* Use `_n()` for proper plural forms support.

Props TimothyBlynJacobs, ocean90, afercia.
Fixes #46683.

git-svn-id: https://develop.svn.wordpress.org/trunk@45178 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-12 20:33:48 +00:00
Jonathan Desrosiers 94b6167a04 Site Health: Add missing actions to tests.
This change adds missing actions for several tests. This ensures that the user is provided with a next step, whenever possible.

Also, change the URL displayed in the WordPress.org communication test description to `api.wordpress.org` for accuracy.

Props: garrett-eclipse, Clorith, vaishalipanchal.
Fixes #46734.

git-svn-id: https://develop.svn.wordpress.org/trunk@45170 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-12 17:39:37 +00:00
Jonathan Desrosiers 3bba7f2f31 Site Health: Improve the test badge implementation.
Label badges for each Site Health test currently display in either red, orange, or green, regardless of if the test passed or failed. This is confusing, as seeing red labels in the “Passed Test” section could alarm users (when really everything is OK and no action is required), and seeing green labels in the “Failed Tests” section would not appropriately encourage the user to take appropriate action.

This change makes several improvements to the label badges:

- Always right align the badges for consistent display.
- Remove background fill for badges. Instead, use a border.
- Use a consistent styling for all tests (passed and failed).
- The text color no longer uses true black (#000000).
- The `.badge.pink` CSS definition has been switched to `.badge.purple`, and the definitions for blue, gray, and green have also been updated to more closely follow the official WordPress color palette.

Props: pbiron, garrett-eclipse, hedgefield, Clorith, xkon, melchoyce, mdwolinski, alexdenning.
Fixes #46623.

git-svn-id: https://develop.svn.wordpress.org/trunk@45169 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-12 17:03:24 +00:00
Mike Schroder 635adfbe68 Site Health: Clarify `WP_DEBUG` warning and translation contexts.
Clarifies that `WP_DEBUG` can cause `WP_DEBUG_DISPLAY` to be enabled,
and uses the constants themselves in related translation contexts.

Props mukesh27, ocean90, clorith, SergeyBiryukov, mikeschroder.
Fixes #46877.

git-svn-id: https://develop.svn.wordpress.org/trunk@45164 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-12 02:26:44 +00:00
Sergey Biryukov c8a29d2789 Site Health: Update recommendation labels to highlight Performance instead of Security when using a supported and actively maintained version of WordPress, PHP, or MySQL.
Props Clorith, earnjam.
Fixes #46789.

git-svn-id: https://develop.svn.wordpress.org/trunk@45121 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-06 15:59:29 +00:00
Sergey Biryukov 681edf04bc Site Health: Use correct property for database-related messages.
Props mukesh27, birgire.
Fixes #46783.

git-svn-id: https://develop.svn.wordpress.org/trunk@45107 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-03 11:00:06 +00:00
Sergey Biryukov fa0ad447c8 Site Health: Use a consistent verbiage for the suggestion to remove inactive plugins and themes.
Props garrett-eclipse, marybaum, Clorith.
Fixes #46735.

git-svn-id: https://develop.svn.wordpress.org/trunk@45105 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-03 02:00:56 +00:00
Sergey Biryukov b3a625fdf1 Site Health: i18n audit, take 1.
* Split plural strings with multiple sentences to avoid duplicating translations.
* Decouple strings where the singular and plural form are not just the same string with different numbers, but essentially two different strings.
* Use an established pattern for numbered placeholders in translator comments.
* Replace constants in translatable strings with placeholders, mark them as code.
* Make sure sentences are translated as a whole, not as separate string parts.
* Remove unnecessary context and escaping.

Props ocean90, SergeyBiryukov.
See #46683.

git-svn-id: https://develop.svn.wordpress.org/trunk@45099 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-02 21:31:43 +00:00
Sergey Biryukov fbf73bc8de Site Health: Add missing i18n for Security and Performance badge labels.
Props iworks.
Fixes #46755. See #46683.

git-svn-id: https://develop.svn.wordpress.org/trunk@45095 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-02 10:07:36 +00:00
Sergey Biryukov adfe5e271b Docs: Fix more typos in `WP_Site_Health` DocBlocks.
See #46753.

git-svn-id: https://develop.svn.wordpress.org/trunk@45094 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-01 20:29:52 +00:00
Sergey Biryukov 302233dd11 Docs: Fix typos in `WP_Site_Health` DocBlocks.
Props mukesh27.
Fixes #46753.

git-svn-id: https://develop.svn.wordpress.org/trunk@45093 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-01 20:22:42 +00:00
Sergey Biryukov 421da58d8e Docs: Add missing `@since` tag for `WP_Site_Health::get_test_php_extensions()`.
Props mukesh27.
Fixes #46752.

git-svn-id: https://develop.svn.wordpress.org/trunk@45092 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-01 20:16:54 +00:00
Sergey Biryukov 74211739fe Docs: Fix typos in `site_status_tests` filter DocBlock.
Props kraftbj.
Fixes #46727.

git-svn-id: https://develop.svn.wordpress.org/trunk@45073 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-30 10:58:00 +00:00
Sergey Biryukov aae789324f Site Health: Add description for a successful HTTPS check.
Props Clorith, xkon.
Fixes #46617.

git-svn-id: https://develop.svn.wordpress.org/trunk@45052 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-28 16:14:03 +00:00
Sergey Biryukov b45b58c6b6 Site Health: Correct `wp_version_check()` existence verification by performing a request to the Site Health page instead of Dashboard.
Props Clorith, audrasjb.
Fixes #46616.

git-svn-id: https://develop.svn.wordpress.org/trunk@45049 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-28 14:30:12 +00:00
Gary Pendergast dad6b61cfb Admin: Introduce the Site Health screens.
The Site Health tool serves two purposes:
- Provide site owners with information to improve the performance, reliability, and security of their site.
- Collect comprehensive debug information about the site.

By encouraging site owners to maintain their site and adhere to modern best practices, we ultimately improve the software hygeine of both the WordPress ecosystem, and the open internet as a whole.

Props Clorith, hedgefield, melchoyce, xkon, karmatosed, jordesign, earnjam, ianbelanger, wpscholar, desrosj, pedromendonca, peterbooker, jcastaneda, garyj, soean, pento, timothyblynjacobs, zodiac1978, dgroddick, garrett-eclipse, netweb, tobifjellner, pixolin, afercia, joedolson, birgire.
See #46573.


git-svn-id: https://develop.svn.wordpress.org/trunk@44986 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-23 03:54:16 +00:00