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.
Built from https://develop.svn.wordpress.org/trunk@46290
git-svn-id: http://core.svn.wordpress.org/trunk@46102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`wp_get_upload_dir()` returns the theoretical path of the uploads directory. When there was no upload yet the test returns an incorrect result (not writeable) because the directory doesn't exist. Switching to `wp_upload_dir()`, which creates the directory on the fly, ensures a proper test result.
Fixes#47958.
Built from https://develop.svn.wordpress.org/trunk@46228
git-svn-id: http://core.svn.wordpress.org/trunk@46040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Change `recurse_dirsize()` to accept an array of excluded paths.
- Change so we don't calculate the sizes of dirs in wp-content twice.
- Add the size in bytes to the "debug" into.
- Add a custom DOM event after the dir sizes request is done. Can be used by plugins to "daisy chain" more requests.
- Move "WordPress directory location" and "WordPress directory size" to the top in the "Directories and Sizes" section.
- Move "Theme directory location" to the "Active Theme" section.
- Fix labels capitalization.
Props xkon, afercia, Clorith, azaozz.
Fixes#46707.
Built from https://develop.svn.wordpress.org/trunk@45220
git-svn-id: http://core.svn.wordpress.org/trunk@45029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, only the site’s locale was displayed in the Site Health debug information. Moving forward, both the site’s default locale and the user’s locale will be specified.
This change also removes the `@param` tag for `WP_Debug_Data::debug_data()`. This parameter was previously removed in [45156].
Props: mukesh27, ianbelanger, Clorith, desrosj.
Fixes#46803.
Built from https://develop.svn.wordpress.org/trunk@45166
git-svn-id: http://core.svn.wordpress.org/trunk@44975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This change switches to using `get_user_locale()` when adding the language to the Site Health debug information to ensure the user’s locale preference is reflected.
Also, `function_exists()` checks for `switch_to_locale()` and `restore_previous_locale()` were required in the plugin to support older versions of WordPress, but they are not required in core/
Props: Clorith, desrosj.
Fixes#46694.
Built from https://develop.svn.wordpress.org/trunk@45110
git-svn-id: http://core.svn.wordpress.org/trunk@44919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Prevent fatal errors from timeouts on the Tools => Site Health => Info tab.
- Use the `get_dirsize()` and `recurse_dirsize()` functions to calculate directory sizes. The results are cached.
- Introduce "timeout protection" in `recurse_dirsize()`.
Props pento, Clorith, xkon, afercia, jeremyfelt, azaozz.
Fixes#46645.
Built from https://develop.svn.wordpress.org/trunk@45104
git-svn-id: http://core.svn.wordpress.org/trunk@44913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The previous method for copying the debug report to the clipboard involved having a hidden `<textarea>`, but this shows up in screen readers and can't be reliably hidden.
To work around this, the button now uses the `clipboard.js` library, which automatically handles browser differences in the Clipboard API, and can load the text to copy from a `data-` attribute on the button.
Props pento, hedgefield, afercia.
Fixes#46647.
Built from https://develop.svn.wordpress.org/trunk@45044
git-svn-id: http://core.svn.wordpress.org/trunk@44853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@44986
git-svn-id: http://core.svn.wordpress.org/trunk@44817 1a063a9b-81f0-0310-95a4-ce76da25c4cd