Commit Graph

8424 Commits

Author SHA1 Message Date
Andrew Ozz
c9d23006db Site health:
- Add a check to `wp_check_php_version()` whether the current PHP version is lower than the next (desired) minimum version.
- Set the next desired minimum PHP version to 7.2.
- Use that check to update the warnings in the `wp_dashboard_php_nag()` widget, and on the Site Health screen.

Props Clorith, SergeyBiryukov, ironprogrammer, azaozz.
See #56199.
Built from https://develop.svn.wordpress.org/trunk@54169


git-svn-id: http://core.svn.wordpress.org/trunk@53728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 22:19:14 +00:00
Sergey Biryukov
4229519bec Upgrade/Install: Remove _copy_dir() function as originally intended.
WordPress 3.2 introduced several enhancements to the `copy_dir()` function:
* No more re-installing Akismet upon upgrade.
* Respect custom `WP_CONTENT_DIR` for bundled plugins/theme installation.
* Respect custom `WP_CONTENT_DIR`/`WP_LANG_DIR` for language files when upgrading.
* Add an exclusion list to `copy_dir()` as well as `WP_Filesystem_Base::wp_lang_dir()`.
* Standardize `WP_Filesystem` path method returns.

However, the version of `copy_dir()` that runs during the upgrade process is the one from the older install, not the newer, which means that these enhancements would only be available after upgrading to WordPress 3.2 first, e.g. in a subsequent upgrade to WordPress 3.3.

In order to make these enhancements immediately available in WordPress 3.2, specifically to take advantage of skip lists and avoid re-installing Akismet if it was previously deleted, a temporary copy of the function was utilized, with the intention to remove it in WordPress 3.3 or a later release.

With further enhancements made to the Upgrade API to support partial and no-content builds, this temporary copy is no longer relevant and can be safely removed.

Follow-up to [17576], [17580], [17581], [18225].

Props afragen, costdev, dd32, peterwilsoncc, SergeyBiryukov.
Fixes #55712. See #17173.
Built from https://develop.svn.wordpress.org/trunk@54143


git-svn-id: http://core.svn.wordpress.org/trunk@53702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 16:57:10 +00:00
audrasjb
fd3e5e5f21 Themes: Implement file description for theme.json.
This changeset adds a file description for `theme.json`. This description is notably used in the Theme File Editor.

Props ocean90, kapilpaul, poena.
Fixes #55325.

Built from https://develop.svn.wordpress.org/trunk@54140


git-svn-id: http://core.svn.wordpress.org/trunk@53699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-13 08:20:13 +00:00
Sergey Biryukov
c03305852e Code Modernization: Add AllowDynamicProperties attribute to all (parent) classes.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

Trac ticket #56034 is open to investigate and handle the third and fourth type of situations, however it has become clear this will need more time and will not be ready in time for WP 6.1.

To reduce “noise” in the meantime, both in the error logs of WP users moving onto PHP 8.2, in the test run logs of WP itself, in test runs of plugins and themes, as well as to prevent duplicate tickets from being opened for the same issue, this commit adds the `#[AllowDynamicProperties]` attribute to all “parent” classes in WP.

The logic used for this commit is as follows:
* If a class already has the attribute: no action needed.
* If a class does not `extend`: add the attribute.
* If a class does `extend`:
 - If it extends `stdClass`: no action needed (as `stdClass` supports dynamic properties).
 - If it extends a PHP native class: add the attribute.
 - If it extends a class from one of WP's external dependencies: add the attribute.
* In all other cases: no action — the attribute should not be needed as child classes inherit from the parent.

Whether or not a class contains magic methods has not been taken into account, as a review of the currently existing magic methods has shown that those are generally not sturdy enough and often even set dynamic properties (which they should not). See the [https://www.youtube.com/watch?v=vDZWepDQQVE live stream from August 16, 2022] for more details.

This commit only affects classes in the `src` directory of WordPress core.
* Tests should not get this attribute, but should be fixed to not use dynamic properties instead. Patches for this are already being committed under ticket #56033.
* While a number bundled themes (2014, 2019, 2020, 2021) contain classes, they are not a part of this commit and may be updated separately.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [53922].

Props jrf, hellofromTonya, markjaquith, peterwilsoncc, costdev, knutsp, aristath.
See #56513, #56034.
Built from https://develop.svn.wordpress.org/trunk@54133


git-svn-id: http://core.svn.wordpress.org/trunk@53692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 15:47:14 +00:00
Joe McGill
8f390b309a Editor: Refresh nones for metaboxes after reauthentication.
This fixes an issue where metaboxes fail to save after a session expires and a user logs in again via the heartbeat API.

Props LinSoftware.
Fixes #52584.

Built from https://develop.svn.wordpress.org/trunk@54122


git-svn-id: http://core.svn.wordpress.org/trunk@53681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-11 20:46:10 +00:00
audrasjb
7c20a1d2d5 Docs: Various docblock fixes in Site Health related files, as per documentation standards.
This addresses some files modified in changeset [54113].

See #55646.

Built from https://develop.svn.wordpress.org/trunk@54114


git-svn-id: http://core.svn.wordpress.org/trunk@53673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 08:47:08 +00:00
audrasjb
c7fe0f88d2 Coding Standards: Clarify time units for various timeout or expiration values.
This changeset implements a clearer and more consistent timeout/duration/expiration format. It updates time durations used in various files, as per WordPress coding standards:

- If the value can be represented as an integer (not a fractional) number of minutes (hours, etc.), use the appropriate constant (e.g.: `MINUTE_IN_SECONDS`) multiplied by that number.
- Otherwise, keep the value as is and add a comment with the units for clarity.

Follow-up to [11823], [13177], [21996], [37747], [53714].

Props hztyfoon, audrasjb, arrasel403, krupalpanchal, GaryJ, SergeyBiryukov, peterwilsoncc, rudlinkon, costdev, robinwpdeveloper.
Fixes #56293.
See #55647.

Built from https://develop.svn.wordpress.org/trunk@54113


git-svn-id: http://core.svn.wordpress.org/trunk@53672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-09 08:16:18 +00:00
spacedmonkey
6542de4220 Posts, Post Types: Call update_post_author_caches function in WP_Posts_List_Table class.
Call the `update_post_author_caches` function in the `WP_Posts_List_Table` class to prime post author caches in a single database request.

Props spacedmonkey, thakkarhardik, desrosj. 
Fixes #56100.
Built from https://develop.svn.wordpress.org/trunk@54099


git-svn-id: http://core.svn.wordpress.org/trunk@53658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 10:17:12 +00:00
spacedmonkey
6d882a5dd9 Media: Call update_post_parent_caches function in WP_Media_List_Table class.
Call the `update_post_parent_caches` in `WP_Media_List_Table` class to prime parent caches in a single database request.

Props spacedmonkey, antpb, hellofromTonya, jeawhanlee, peterwilsoncc, alaca. 
Fixes #56036.
Built from https://develop.svn.wordpress.org/trunk@54098


git-svn-id: http://core.svn.wordpress.org/trunk@53657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 09:37:17 +00:00
Felix Arntz
610d2d6a44 Media: Generate WebP only for certain registered image sizes.
The existing filter `image_editor_output_format` receives an additional parameter `$size_name` which is populated whenever it controls the output format for a specific registered image size to create. Otherwise, it remains empty. In order to achieve this, a low level change has been added in bringing a new `$size_name` class property to the `WP_Image_Editor` base class, which is introduced in a backward compatible way that will not cause conflicts with custom implementations.

This parameter is then used in new logic inside the `wp_default_image_output_mapping()` callback function for the filter, controlling whether `image/jpeg` should map to `image/webp` output or not. By default, this is enabled for all WordPress core image sizes by default, and this list can be modified using a new `wp_image_sizes_with_additional_mime_type_support` filter, e.g. to remove core sizes or add custom sizes.

The customization per image size may be further enhanced by providing a more declarative API via a new parameter on the `add_image_size()` function.

Props eugenemanuilov, flixos90, adamsilverstein, joegrainger.

Fixes #56526.
See #55443, #56288.

Built from https://develop.svn.wordpress.org/trunk@54097


git-svn-id: http://core.svn.wordpress.org/trunk@53656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 21:45:14 +00:00
Felix Arntz
42416cf392 Media: Move wp_default_image_output_mapping() filter callback to frontend scope.
While the `image_editor_output_format` filter is primarily used in WP Admin, it can also be executed in frontend scope, as the related `WP_Image_Editor` class and `wp_unique_filename()` function are being loaded in that scope.

Follow up to [54086].

See #55443, #56526.

Built from https://develop.svn.wordpress.org/trunk@54094


git-svn-id: http://core.svn.wordpress.org/trunk@53653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-07 15:41:15 +00:00
Adam Silverstein
897a9743be Media: Output WebP by default when uploading JPEGs.
Uploaded JPEGs will automatically be converted to WebP sub-sizes instead of JPEG, saving space and making sites faster.

The original JPEG upload is always retained and can be accessed by calling `wp_get_original_image_url`.

Props azaozz, flixos90.
Fixes #55443.


Built from https://develop.svn.wordpress.org/trunk@54086


git-svn-id: http://core.svn.wordpress.org/trunk@53645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 21:15:08 +00:00
Adam Silverstein
4b5968aa9b Media: revert the multi-mime feature.
This feature isn't quite ready to land.

Reverts r53786, r53848, r53847, r53845, r53751.

Props flixos90, azaozz, dd32.
See #55443.


Built from https://develop.svn.wordpress.org/trunk@54085


git-svn-id: http://core.svn.wordpress.org/trunk@53644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 21:13:12 +00:00
Sergey Biryukov
c54960342b Coding Standards: Use more meaningful variable names for output in the admin.
This renames some variables for clarity, per the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions]:
> Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

* `$out` is renamed to `$output` in various list table methods and admin functions.
* `$sep` is renamed to `$separator` in various list table methods and admin functions.

This affects:
* `WP_Comments_List_Table::handle_row_actions()`
* `WP_List_Table::row_actions()`
* `WP_Media_List_Table::column_default()`
* `WP_MS_Sites_List_Table::site_states()`
* `WP_MS_Users_List_Table::column_blogs()`
* `WP_Terms_List_Table::column_name()`
* `_wp_dashboard_recent_comments_row()`
* `image_align_input_fields()`
* `image_size_input_fields()`
* `wp_doc_link_parse()`
* `_post_states()`
* `_media_states()`

Follow-up to [8653], [8692], [8864], [8910], [8911], [8916], [9103], [9153], [10607], [15491], [17793], [32644], [54070].

Props mukesh27, costdev.
See #56448, #55647.
Built from https://develop.svn.wordpress.org/trunk@54071


git-svn-id: http://core.svn.wordpress.org/trunk@53630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 17:19:09 +00:00
Sergey Biryukov
cdfb7d7ef0 Coding Standards: Use more meaningful variable names in WP_Users_List_Table.
This renames some variables for clarity, per the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions]:
> Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

* `$c` is renamed to `$columns` in `::get_columns()` and `::get_sortable_columns()`.
* `$r` is renamed to `$row` in `::single_row()`.

Follow-up to [3677], [5542], [6852], [8936], [15491], [16573].

Props burhandodhy, costdev, mukesh27, Presskopp.
See #56448, #55647.
Built from https://develop.svn.wordpress.org/trunk@54070


git-svn-id: http://core.svn.wordpress.org/trunk@53629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 16:02:09 +00:00
Sergey Biryukov
b43dcea01e Site Health: Bump the recommended MySQL and MariaDB versions.
* MySQL 5.6 has reached EOL (“End of Life”) in February 2021. The recommended minimum is bumped to 5.7 for now.
* MariaDB 10.2 has reached EOL in May 2022. The recommended minimum is bumped to 10.3 for now.

This commit brings the Site Health recommendations in line with `readme.html`.

Includes:
* Adding two unit tests to ensure the SQL server versions recommended by Site Health match `readme.html`.
* Consistently declaring the recommended and required versions as the `WP_Site_Health` class properties.
* Renaming some pre-existing private properties for clarity.

Follow-up to [44986], [52319], [52358], [52420], [52424], [53431], [53433], [53435], [meta11407], [meta11866].

See #55791, #meta5999, #meta6322.
Built from https://develop.svn.wordpress.org/trunk@54069


git-svn-id: http://core.svn.wordpress.org/trunk@53628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-05 15:20:09 +00:00
Sergey Biryukov
e5fd46da70 Site Health: Use $wpdb->db_server_info() to retrieve database server type.
This updates an older fragment in `WP_Site_Health::prepare_sql_data()` to use a dedicated `$wpdb` method introduced later in WordPress 5.5 specifically for retrieving the database server information.

Follow-up to [44986], [47451].

Props hilayt24, mukesh27, Clorith, SergeyBiryukov.
Fixes #56484.
Built from https://develop.svn.wordpress.org/trunk@54065


git-svn-id: http://core.svn.wordpress.org/trunk@53624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-04 14:40:14 +00:00
audrasjb
ac9f6594c4 Docs: Use third-person singular verbs for various function descriptions, as per docblocks standards.
This addresses various files modified in changeset [54062].

See #55646.

Built from https://develop.svn.wordpress.org/trunk@54063


git-svn-id: http://core.svn.wordpress.org/trunk@53622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-02 06:58:09 +00:00
audrasjb
16bc8d38a6 Coding Standards: Use a consistent markup for line break tags across Core.
This changeset replaces `<br/>` with `<br />` on various places, as per WordPress Coding Standards.
See https://developer.wordpress.org/coding-standards/wordpress-coding-standards/html/#self-closing-elements

Props haritpanchal, costdev, audrasjb.
Fixes #56457.

Built from https://develop.svn.wordpress.org/trunk@54062


git-svn-id: http://core.svn.wordpress.org/trunk@53621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-02 06:51:13 +00:00
Felix Arntz
7f4f1ead61 Site Health: Ensure persistent object cache check short-circuit filter also short-circuits multisite.
Follow up to [54053].

See #56040.

Built from https://develop.svn.wordpress.org/trunk@54054


git-svn-id: http://core.svn.wordpress.org/trunk@53613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 17:47:09 +00:00
Sergey Biryukov
acf94cb859 Site Health: Some documentation and test improvements for WP_Site_Health:
* Add a `@coversDefaultClass` annotation to address `@covers ::get_test_page_cache" is invalid` notices.
* Rename data providers to start with the `data_` prefix and match the test method names, for consistency.
* Move data providers next to the test methods they are used in.
* Move `::get_test_page_cache()` closer to `::get_test_persistent_object_cache()`, for a bit more predictable placement.
* Fix a typo in `::get_test_persistent_object_cache()` description.

Follow-up to [53955], [54043], [54044], [54045].

See #56041.
Built from https://develop.svn.wordpress.org/trunk@54047


git-svn-id: http://core.svn.wordpress.org/trunk@53606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 15:28:16 +00:00
Sergey Biryukov
7a94e6c200 Site Health: Minor i18n cleanup in page cache and persistent object cache tests.
Includes:
* Moving leading and trailing spaces out of a translatable string.
* Using the established format for translator comments.
* Using a consistent typography for the apostrophe.

Follow-up to [53955], [54043].

See #56041.
Built from https://develop.svn.wordpress.org/trunk@54044


git-svn-id: http://core.svn.wordpress.org/trunk@53603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 00:19:18 +00:00
Felix Arntz
fab7a3bb92 Site Health: Introduce page cache check.
This changeset adds a new `page_cache` check which determines whether the site uses a full page cache, and in addition assesses the server response time. If no page cache is present and the server response time is slow, the check will suggest use of a page cache.

A few filters are included for customization of the check:
* `site_status_good_response_time_threshold` filters the number of milliseconds below which the server response time is considered good. The default value is based on the `server-response-time` Lighthouse audit and can be altered using this filter.
* `site_status_page_cache_supported_cache_headers` filters the map of supported cache headers and their callback to determine whether it was a cache hit. The default list includes commonly used cache headers, and it is filterable to support e.g. additional cache headers used by specific vendors.

Note that due to the nature of this check it is only run in production environments.

Props furi3r, westonruter, spacedmonkey, swissspidy, Clorith.
Fixes #56041.

Built from https://develop.svn.wordpress.org/trunk@54043


git-svn-id: http://core.svn.wordpress.org/trunk@53602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 22:46:11 +00:00
Felix Arntz
7322419ced Site Health: Update persistent object cache check documentation URL.
The anchor for the relevant documentation section had changed since the original code had been written.

Props furi3r.
See #56040.

Built from https://develop.svn.wordpress.org/trunk@54042


git-svn-id: http://core.svn.wordpress.org/trunk@53601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-31 22:19:12 +00:00
Felix Arntz
09369981e1 Site Health: Introduce persistent object cache check.
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.

A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:

* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.

Note that due to the nature of this check it is only run in production environments.

Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes #56040.

Built from https://develop.svn.wordpress.org/trunk@53955


git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 16:54:12 +00:00
Sergey Biryukov
a0163f91d4 Code Modernization: Explicitly declare all properties in WP_Ajax_Upgrader_Skin.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this case, the `$plugin_info` and `$theme_info` properties are set in `Plugin_Upgrader::bulk_upgrade()` and `Theme_Upgrader::bulk_upgrade()` specifically.

The `Bulk_Plugin_Upgrader_Skin` class and the `Bulk_Theme_Upgrader_Skin` class both already allow for this, but the `wp_ajax_update_plugin()` and `wp_ajax_update_theme()` functions also call the `*_Upgrader::bulk_upgrade()` methods, so the `WP_Ajax_Upgrader_Skin` class also needs to have these properties explicitly declared.

Includes adding proper DocBlocks for the pre-existing properties in the `Bulk_Plugin_Upgrader_Skin` and the `Bulk_Theme_Upgrader_Skin` classes.

Follow-up to [13686], [37714], [38199], [42677], [42873], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949].

Props jrf, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53952


git-svn-id: http://core.svn.wordpress.org/trunk@53511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-29 12:46:10 +00:00
Sergey Biryukov
f8c9068b79 Upgrade/Install: Make WP_Filesystem_FTPext::size() return false on failure.
While `WP_Filesystem_Base::size()` is documented to return `false` on failure, `ftp_size()` returns -1, and the method documentation was recently updated to reflect that.

This commit restores the previous `@return` tag and corrects the actual return value instead, to bring consistency with all the other `WP_Filesystem_*::size()` methods:
* `WP_Filesystem_Base::size()`
* `WP_Filesystem_Direct::size()`
* `WP_Filesystem_ftpsockets::size()`
* `WP_Filesystem_SSH2::size()`
{{{
@return int|false Size of the file in bytes on success, false on failure.
}}}

This better matches the purpose of the API to provide a consistent interface for various filesystem implementations.

Follow-up to [6779], [30678], [45226], [53860], [53862].

Fixes #51170.
Built from https://develop.svn.wordpress.org/trunk@53898


git-svn-id: http://core.svn.wordpress.org/trunk@53457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-16 13:41:14 +00:00
Sergey Biryukov
b90c2adb7f Database: Ignore display width for integer data types in dbDelta() on MySQL 8.0.17 or later.
MySQL 8.0.17 deprecated the display width attribute for integer data types:
> As of MySQL 8.0.17, the `ZEROFILL` attribute is deprecated for numeric data types, as is the display width attribute for integer data types. You should expect support for `ZEROFILL` and display widths for integer data types to be removed in a future version of MySQL. Consider using an alternative means of producing the effect of these attributes. For example, applications can use the `LPAD()` function to zero-pad numbers up to the desired width, or they can store the formatted numbers in `CHAR` columns.

In practice, this means that display width is removed for integer types when creating a table:
* `BIGINT(20)` → `BIGINT`
* `INT(11)` → `INT`
* `MEDIUMINT(9)` → `MEDIUMINT`
* `SMALLINT(6)` → `SMALLINT`
* `TINYINT(4)` → `TINYINT`

Note: This only applies specifically to MySQL 8.0.17 or later. In MariaDB, display width for integer types is still available and expected.

This commit ensures that `dbDelta()`, which relies on the `DESCRIBE` SQL command to get the existing table structure and field types, when running on MySQL 8.0.17 or later, does not unnecessarily attempt to convert `BIGINT` fields back to `BIGINT(20)`, `INT` back to `INT(11)`, etc. When comparing the field type in the query with the existing field type, if display width is the only difference, it can be safely ignored to match MySQL behavior.

The change is covered by existing `dbDelta()` unit tests:
* A test for not altering `wp_get_db_schema()` queries on an existing install using MySQL 8.0.17+ now passes.
* More than twenty tests which previously failed on PHP 8.0.x + MariaDB due to incorrect expectations, caused by MariaDB version reporting not being consistent between PHP versions, now pass.

References:
* [https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html MySQL: Nymeric Type Attributes]
* [https://mariadb.com/kb/en/data-types-numeric-data-types/ MariaDB: Numeric Data Types]

Follow-up to [1575], [18899], [37525], [47183], [47184].

Props SergeyBiryukov, pbearne, leewillis77, JavierCasares, desrosj, costdev, johnbillion.
Fixes #49364. See #51740.
Built from https://develop.svn.wordpress.org/trunk@53897


git-svn-id: http://core.svn.wordpress.org/trunk@53456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-15 13:18:13 +00:00
Sergey Biryukov
0e6a976c0a Coding Standards: Restore correct regex formatting in dbDelta().
An earlier regex for normalizing index definitions disables the PHPCS check for extra padding in order to keep a more readable indentation. However, this was missed for index columns regex.

Follow-up to [37583], [42228], [42249], [42343].

See #55647.
Built from https://develop.svn.wordpress.org/trunk@53896


git-svn-id: http://core.svn.wordpress.org/trunk@53455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-14 02:14:12 +00:00
John Blackbourn
85306e1fd6 Taxonomy: Introduce the is_term_publicly_viewable() function.
This is the taxonomy term counterpart to the `is_post_publicly_viewable()` function. Although the logic for terms is more straight forward this serves the same purpose as introducing the corresponding function for posts -- to centralise and reduce the logic needed to validate a term and determine if it's publicly viewable.

Props peterwilsoncc, costdev, johnbillion

Fixes #56215

Built from https://develop.svn.wordpress.org/trunk@53893


git-svn-id: http://core.svn.wordpress.org/trunk@53452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-13 22:44:09 +00:00
audrasjb
e7d91b8017 General: Add required fields helper functions for better reusability.
This changeset introduces new `wp_required_field_indicator()` and `wp_required_field_message()` helper functions to generate reusable and consistent required field indicator and message. It also implements these functions in various admin screens.

Props sabernhardt, ryokuhi, joedolson, audrasjb, SergeyBiryukov.
Fixes #54394.

Built from https://develop.svn.wordpress.org/trunk@53888


git-svn-id: http://core.svn.wordpress.org/trunk@53447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 12:11:09 +00:00
Peter Wilson
0161ef8f72 Media: Cache parent posts in query-attachments AJAX endpoint.
Prime the parent post objects `wp_ajax_query_attachments()` to reduce the number of database queries in the query-attachments admin-ajax endpoint.

Props albatross10.
Fixes #56037.


Built from https://develop.svn.wordpress.org/trunk@53885


git-svn-id: http://core.svn.wordpress.org/trunk@53444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 00:17:07 +00:00
John Blackbourn
1d4e72c798 Docs: Correct and improve the documented types for various functions and hooks.
See #55646

Built from https://develop.svn.wordpress.org/trunk@53877


git-svn-id: http://core.svn.wordpress.org/trunk@53436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 14:03:09 +00:00
John Blackbourn
bbdc255d50 Docs: Remove code tags from WordPress function names within inline documentation.
Removing these code tags means the function name will be automatically linked on the developer.wordpress.org reference, which is more useful than just seeing the function name.

See #55646

Built from https://develop.svn.wordpress.org/trunk@53876


git-svn-id: http://core.svn.wordpress.org/trunk@53435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 13:55:08 +00:00
Sergey Biryukov
c3783c9f3a Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods.
This aims to bring more clarity to the code, and applies to methods where the path can be a file or a directory:

* `WP_Filesystem_*::exists()`
* `WP_Filesystem_*::is_writable()`

Follow-up to [6779], [25560].

See #55647.
Built from https://develop.svn.wordpress.org/trunk@53872


git-svn-id: http://core.svn.wordpress.org/trunk@53431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 11:33:10 +00:00
Peter Wilson
f627535216 Administration: Improve performance of List Tables.
Improve the performance of `WP_List_Table::get_column_info()` by adding the primary column to the cached header values. This reduces the number of calls to the `WP_List_Table::get_primary_column_name()` method to once per table in line with the other header getter functions.

Props bobbingwide, chaion07, costdev, mikeschroder, mukesh27, peterwilsoncc, shetheliving, spacedmonkey.
Fixes #34564.


Built from https://develop.svn.wordpress.org/trunk@53868


git-svn-id: http://core.svn.wordpress.org/trunk@53427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-09 00:33:11 +00:00
Sergey Biryukov
7f0fc452b1 Docs: Improve @since notes for some WP_Filesystem_* methods:
* `WP_Filesystem_FTPext::exists()`
* `WP_Filesystem_FTPext::size()`
* `WP_Filesystem_ftpsockets::exists()`

The `::exists()` methods were previously using the FTP `NLST` command, which works for directories, but is not intended to be applied to a file. This only worked most of the time due to many FTP servers being permissive and allowing to execute `NLST` on files, which cannot be guaranteed and appears to not be the case in newer versions of Pure-FTPd (1.0.48 or later).

With a recent change in [53860], both methods were updated for compatibility with RFC 959:

* Both methods check if the path is a directory that can be changed into (and therefore exists).
* `WP_Filesystem_FTPext` uses `ftp_rawlist()` (FTP `LIST` command) to check for file existence.
* `WP_Filesystem_ftpsockets` uses file size to check for file existence.

Reference: [https://www.ietf.org/rfc/rfc959.txt RFC 959: File Transfer Protocol (FTP)]

Follow-up to [6779], [11821], [25274], [33648], [34733], [35944], [35946], [53860].

See #51170.
Built from https://develop.svn.wordpress.org/trunk@53862


git-svn-id: http://core.svn.wordpress.org/trunk@53421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 17:14:13 +00:00
audrasjb
6a5506304e Filesystem: Rewrite FTP/FTP Sockets exists() methods to implement a more stable check.
WordPress FTP file checking was previously based upon `ftp_nlist()`. This function can be problematic at scale with a directory containing a large number of files. The same issue occurred using it with ftpsockets.

This changeset rewrites the FTP `exists()` functions to utilize a more efficient and stable check.

Props giox069, desrosj, mkox, afragen, costdev, pbiron, peterwilsoncc.
Fixes #51170.
See #53318, #39781.

Built from https://develop.svn.wordpress.org/trunk@53860


git-svn-id: http://core.svn.wordpress.org/trunk@53419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-08 12:41:13 +00:00
Adam Silverstein
66372143a1 Media: use original image size data for full size secondary mime generation.
Correct an issue where the secondary mime type full size image would not be properly resized (and `-scaled` added to the name) when the original upload is over the `big_image_size_threshold` dimensions.

Props mukesh27.
See #55443.



Built from https://develop.svn.wordpress.org/trunk@53848


git-svn-id: http://core.svn.wordpress.org/trunk@53407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 22:16:13 +00:00
Adam Silverstein
4b0450af4f Media: correct a misnamed variable when creating sub sizes with multi_resize.
Props mehulkaklotar, mukesh27.
See #55443.


Built from https://develop.svn.wordpress.org/trunk@53847


git-svn-id: http://core.svn.wordpress.org/trunk@53406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 18:58:12 +00:00
Adam Silverstein
c1862616c2 Media: remove unused _wp_image_belongs_to_attachment function.
Remove the `_wp_image_belongs_to_attachment` function which was left over from a an unused branch and added inadvertently as part of r53751.

Props mukesh27.
Fixes #56333.


Built from https://develop.svn.wordpress.org/trunk@53845


git-svn-id: http://core.svn.wordpress.org/trunk@53404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 16:12:13 +00:00
audrasjb
6996204bab Docs: Various docblock fixes in wp-admin/includes/image.php class, as per docs standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53843


git-svn-id: http://core.svn.wordpress.org/trunk@53402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 14:07:09 +00:00
Sergey Biryukov
5e6acb229d Revisions: Use wp_get_latest_revision_id_and_total_count() where appropriate.
The function executes an optimized query to get the last revision ID and total count. It was originally introduced for `WP_REST_Posts_Controller::prepare_links()`, and is now used in a few more places in core:

* `register_and_do_post_meta_boxes()`
* `wp_get_post_revisions_url()`
* `wp_update_custom_css_post()`

Follow-up to [53759], [53769], [53778], [53779], [53841].

Props peterwilsoncc, mukesh27, SergeyBiryukov.
Fixes #56279.
Built from https://develop.svn.wordpress.org/trunk@53842


git-svn-id: http://core.svn.wordpress.org/trunk@53401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 13:39:11 +00:00
audrasjb
233089c138 Coding standards: Properly escape URLs returned by self_admin_url() calls.
This address some other echoed instances missed by [53839].

Fixes #56329.

Built from https://develop.svn.wordpress.org/trunk@53840


git-svn-id: http://core.svn.wordpress.org/trunk@53399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 06:12:10 +00:00
audrasjb
b79e2df684 Coding standards: Properly escape URLs returned by self_admin_url() calls.
Props krishaweb, audrasjb, SergeyBiryukov.
Fixes #56329.

Built from https://develop.svn.wordpress.org/trunk@53839


git-svn-id: http://core.svn.wordpress.org/trunk@53398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 06:00:09 +00:00
Sergey Biryukov
de97f21367 Coding Standards: Remove extra space in two conditionals.
This fixes WPCS errors in `WP_Site_Health::get_test_plugin_version()` and `::get_test_theme_version()`:

* `Expected exactly one space between closing parenthesis and opening control structure; " " found.`
* `Expected 1 space(s) after closing parenthesis; found 2`

Follow-up to [53816].

See #56134.
Built from https://develop.svn.wordpress.org/trunk@53817


git-svn-id: http://core.svn.wordpress.org/trunk@53376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 14:32:12 +00:00
Sergey Biryukov
1f39318123 Site Health: Improve the wording in plugin and theme version tests.
This displays a more appropriate message in case the site does not have any active plugins or installed themes.

Follow-up to [44986], [45099], [45336].

Props Presskopp, costdev, martin.krcho, Clorith, SergeyBiryukov.
Fixes #56134.
Built from https://develop.svn.wordpress.org/trunk@53816


git-svn-id: http://core.svn.wordpress.org/trunk@53375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 13:09:09 +00:00
audrasjb
66d425d86a Administration: Change default site tagline to an empty string.
This changeset replaces the default "Just another WordPress site" tagline with an empty string for new installations. The reasoning is:

1. Not all themes display the tagline;
2. Not everyone changes the default tagline;
3. When people don't see the tagline in their theme, they may not realize it is still visible in some places, like feeds.

The string "Just another WordPress site" and the related multisite string: "Just another {NETWORK} site" are now only used as a placeholder for the tagline admin option.

Props markjaquith, Denis-de-Bernardy, westi, RyanMurphy, kovshenin, SergeyBiryukov, chriscct7, tyxla, hyperbrand, karmatosed, lukecavanagh, melchoyce, boemedia, khag7, sabernhardt, audrasjb, peterwilsoncc, costdev, martinkrcho, rafiahmedd.
Fixes #6479.

Built from https://develop.svn.wordpress.org/trunk@53815


git-svn-id: http://core.svn.wordpress.org/trunk@53374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-03 12:20:16 +00:00
Sergey Biryukov
f53c815b6e Coding Standards: Use more meaningful variables names in some Ajax functions.
This renames `$tax` to `$taxonomy_object` and `$s` to `$search` for clarity. The latter is only renamed when used as an internal variable and not referring to the `$s` global.

The list of affected functions:
* `wp_ajax_ajax_tag_search()`
* `wp_ajax_add_link_category`
* `wp_ajax_add_tag()`
* `wp_ajax_get_tagcloud()`
* `wp_ajax_inline_save_tax()`
* `wp_ajax_find_posts()`

Follow-up to [6542], [8901], [10222], [12833], [16771], [16992], [22723], [38698].

Props azouamauriac.
Fixes #55098.
Built from https://develop.svn.wordpress.org/trunk@53801


git-svn-id: http://core.svn.wordpress.org/trunk@53360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-30 15:16:08 +00:00
audrasjb
9a517ac7ae Docs: Various docblock improvements in Importer Administration API, as per docs standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53794


git-svn-id: http://core.svn.wordpress.org/trunk@53353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-29 09:22:10 +00:00