Commit Graph

4797 Commits

Author SHA1 Message Date
Jb Audras
66dba67484 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@53815 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-03 12:18:22 +00:00
Jb Audras
5dff1e8503 Posts, Post Types: Force unique slugs for draft posts.
This fixes a behavior where a draft created with the same slug as an existing post would set the existing post to a 404.

`wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts, so to ensure that a unique slug is generated, this changeset adds the post data with the 'publish' status to `wp_unique_post_slug()`.

Props Toro_Unit, h2ham, peterwilsoncc, costdev, antonvlasenko, azaozz, ironprogrammer, audrasjb, hellofromTonya.
Fixes #52422.


git-svn-id: https://develop.svn.wordpress.org/trunk@53813 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-03 09:01:05 +00:00
Peter Wilson
d91b7744f1 Date/Time: Increase test coverage of wp_date().
Props costdev, pbearne, rarst.
Fixes #53485.
See #55652.



git-svn-id: https://develop.svn.wordpress.org/trunk@53810 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-01 22:48:42 +00:00
Sergey Biryukov
299ac4dbb9 Tests: Move the test for action callback representations to the general action tests file.
A separate file in the `actions` directory may have seemed like a good location at the time, but this is the only test left there. For consistency, it is now moved with the other action tests.

Follow-up to [1294/tests], [53806].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53808 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-31 21:35:40 +00:00
Sergey Biryukov
5849d4fafd Tests: Update a transients test to account for terminology changes in MockAction.
Follow-up to [33110], [53805].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53807 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-31 16:49:34 +00:00
Sergey Biryukov
cd7a7924cb Tests: Move the test for actions using closures to the general action tests file.
This was previously moved to a separate file to be excluded when running the tests on PHP 5.2.x.

Now that WordPress supports PHP 5.6.x or later, this can be moved back with the other action tests.

Follow-up to [299/tests], [301/tests], [862/tests], [866/tests], [963/tests].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53806 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-31 16:41:53 +00:00
Sergey Biryukov
ebd66f9aed Tests: Update the terminology used for action or filter names in MockAction class.
This replaces the "tag" wording with "hook name" where appropriate, to match the core function signatures.

Includes:
* Introducing a `::get_hook_names()` method instead of `::get_tags()`, keeping the latter as an alias.
* Adding a `hook_name` key to the `::$events` property, keeping `tag` for backward compatibility for now.
* Adding missing `@since` tags for class methods.

Follow-up to [24/tests], [62/tests], [70/tests], [50807], [53804].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53805 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-31 16:25:27 +00:00
Sergey Biryukov
0ec5fb339b Tests: Update the terminology used for action or filter names in hook tests.
This replaces the `$tag` variables with `$hook_name`, to match the core function signatures.

Follow-up to [24/tests], [62/tests], [866/tests], [1294/tests], [38571], [50807].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53804 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-31 15:03:46 +00:00
Sergey Biryukov
65e266ede6 Plugins: Introduce did_filter() function.
While most of the action functions are aliases for the respective filter functions, using `did_action()` to detect whether a filter has been run is not possible, as it only works specifically for actions.

This is now resolved by introducing a new function, `did_filter()`, which retrieves the number of times a filter has been applied during the current request, bringing parity with `did_action()`.

Follow-up to [4630], [6318], [27294].

Props mordauk, chriscct7, andykeith, nacin, dd32, markparnell, SergeyBiryukov.
Fixes #35357.

git-svn-id: https://develop.svn.wordpress.org/trunk@53803 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-31 14:18:36 +00:00
Sergey Biryukov
95efa62a7d Tests: Correct alignment in has_filter() unit test.
Follow-up to [100/tests].

See #55652, #55647.

git-svn-id: https://develop.svn.wordpress.org/trunk@53802 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-31 13:09:00 +00:00
Sergey Biryukov
968dde1be6 Tests: Simplify some function calls in Tests_Media.
The remaining assertions using `preg_match_all()` do actually pass a regex, but the third parameter `$matches` is never used.

This third parameter became optional in PHP 5.4, so we may as well remove it.

Reference: [https://www.php.net/manual/en/function.preg-match-all.php PHP Manual: preg_match_all()]

Follow-up to [711/tests], [53558], [53790].

Props jrf.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53795 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-29 14:33:15 +00:00
Peter Wilson
a091693f9a Cron API: Modify _get_cron_array() to always return an array.
Change the return type of `_get_cron_array()` to an empty array if the `cron` option is either missing or of an 
unexpected type.

This change ensures the return value for no registered events is consistently an empty array. Previously the return 
value could be either an empty array or `false`.

Props thakkarhardik, jrf, costdev.
Fixes #53940.


git-svn-id: https://develop.svn.wordpress.org/trunk@53791 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-29 03:32:58 +00:00
Sergey Biryukov
7b43b08dd5 Tests: Simplify some assertions in Tests_Media.
A number of assertions are checking for the number of times a hard-coded substring existed in a larger `$haystack`.

These assertions were using `preg_match_all()` to do so, but without actually using a regex.

In these cases, it is more performant (and simpler) to use the PHP native `substr_count()` function, which will yield the same result, without the overhead of regex parsing.

Reference: [https://www.php.net/manual/en/function.substr-count.php PHP Manual: substr_count()]

Follow-up to [711/tests], [38838], [42694], [53558].

Props jrf.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53790 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-28 22:37:00 +00:00
Sergey Biryukov
9f5935c2e8 Tests: Use named data providers in some wp_insert_post() tests.
Follow-up to [42380], [49125], [53521], [53785], [53787], [53788].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53789 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-27 16:27:18 +00:00
Sergey Biryukov
5e2861c92d Tests: Don't unnecessarily randomize the post type in some wp_insert_post() tests.
Follow-up to [33041], [52389], [53785], [53787].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53788 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-27 16:07:20 +00:00
Sergey Biryukov
c52486b995 Tests: Don't unnecessarily set the author in some wp_insert_post() tests.
This aims to make the tests more specific. Setting the author appears to be redundant, as the as the authorship is out of scope for these particular tests.

Follow-up to [66/tests], [84/tests], [167/tests], [296/tests], [412/tests], [496/tests], [1026/tests], [1323/tests], [25554], [33041], [34762], [35183].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53787 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-27 15:41:30 +00:00
Felix Arntz
a9c64ad629 Media: Add information about additional MIME type sources to attachments REST endpoints.
This changeset is a follow-up to [53751] which ensures the additional `sources` information stored in attachment metadata are available under `media_details` for each image size in the REST API responses for attachments.

Props mukesh27, eugenemanuilov, mitogh, flixos90, aaemnnosttv.
See #55443.


git-svn-id: https://develop.svn.wordpress.org/trunk@53786 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-27 15:13:16 +00:00
Sergey Biryukov
09808ef048 Tests: Move wp_insert_post() tests to their own file.
Now that there is a separate test class for `wp_insert_post()` tests, some of the pre-existing tests from the general `Tests_Post` class can be moved there.

Includes:
* Removal of unnecessarily setting the current user to Editor for all tests.
* Removal of unnecessarily setting the cron option to an empty array for all tests.

Follow-up to [496/tests], [36607], [53782], [53783].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53785 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-27 14:59:12 +00:00
Sergey Biryukov
d5fe7bcf45 Tests: Move wp_publish_post() tests to their own file.
Now that there is a separate test class for `wp_publish_post()` tests, some of the pre-existing tests from the general `Tests_Post` class can be moved there.

Follow-up to [1039/tests], [1174/tests], [46969], [49000].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53783 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-26 14:28:57 +00:00
Sergey Biryukov
13e664a412 Tests: Bring some modernization to wp_insert_post() tests.
Includes:
* Using `assertIsInt()` instead of `assertIsNumeric()` for post IDs.
* Using consistent variable names for post data and retrieved posts.
* Removing added filters before performing assertions, not after.
* Removing unused `Tests_Post::$post_ids` property.
* Correcting the order of arguments in some assertions.
* Converting some `foreach()` loops to data providers.
* Wrapping long lines for better readability.

Follow-up to [13/tests], [14/tests], [167/tests], [496/tests], [1174/tests], [1246/tests], [1287/tests], [1307/tests], [1326/tests], [30510], [33261], [33630], [34762], [46279], [50012], [51438].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53782 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-26 13:53:19 +00:00
Jb Audras
4ec275f552 Taxonomy: Allow filtering Ajax term search results in quick edit.
This changeset introduces the `ajax_term_search_results` hook which can be used to filter the term search results returned by the AJAX term query.

Props grandeljay, costdev, ironprogrammer, audrasjb, SergeyBiryukov.
Fixes #55606.


git-svn-id: https://develop.svn.wordpress.org/trunk@53781 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-26 13:21:55 +00:00
Sergey Biryukov
ce154a4b66 Revisions: Rename the function for retrieving the latest revision ID and total count.
The new name is `wp_get_latest_revision_id_and_total_count()`.

This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc.

Follow-up to [53759], [53769].

Props peterwilsoncc.
See #55857.

git-svn-id: https://develop.svn.wordpress.org/trunk@53778 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-25 19:18:41 +00:00
Sergey Biryukov
36fcd57c91 Tests: Declare custom-logo theme support for custom logo tests.
This addresses failures in `has_custom_logo()` and `get_custom_logo()` tests when being run separately:
{{{
1) Tests_General_Template::test_has_custom_logo
Custom logo should not be set after removal.
Failed asserting that true is false.
tests/phpunit/tests/general/template.php:291

2) Tests_General_Template::test_get_custom_logo
Custom logo should not be set after removal.
Failed asserting that a string is empty.
tests/phpunit/tests/general/template.php:336
}}}

Specifically, this ensures that the `site_logo` option gets deleted in `_delete_site_logo_on_remove_theme_mods()`, which in turn prevents the `core/site-logo` block filters from affecting the custom logo tests.

Alternatively, these filters could be removed instead:
{{{
remove_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' );
remove_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
}}}

Follow-up to [36905], [51091], [51421], [52042].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53774 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-25 13:46:23 +00:00
Sergey Biryukov
4ed912c8c3 Tests: Add failure messages for site icon and custom logo tests.
This makes the assertions more helpful, as per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#using-assertions Writing PHP Tests] guidelines:
> All PHPUnit assertions, as well as all WordPress custom assertions, allow for a `$message` parameter to be passed. This message will be displayed when the assertion fails and can help immensely when debugging a test. This parameter should always be used if more than one assertion is used in a test method.

Follow-up to [33181], [36905].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53773 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-25 13:31:24 +00:00
Sergey Biryukov
6cbed78c94 Posts, Post Types: Check if the post type exists in wp_insert_post().
This avoids an `Attempt to read property "cap" on null` PHP warning when checking an unregistered post type's `publish_posts` capability to disallow contributors setting the post slug for pending posts.

Follow-up to [9055], [42380].

Props Chouby, mukesh27, rafiahmedd, SergeyBiryukov.
Fixes #55877.

git-svn-id: https://develop.svn.wordpress.org/trunk@53771 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-24 13:24:44 +00:00
Sergey Biryukov
7e8feefd44 Revisions: Correct the function name for retrieving the last revision ID and total count.
Includes:
* Renaming the function to `wp_get_last_revision_id_and_total_count()`.
* Making the default value for `$post` consistent with `wp_get_post_revisions()`.
* Making `WP_Error` codes more specific and using them in test assertions.
* Adjusting the function description per the documentation standards.

Follow-up to [53759].

Props JustinSainton, SergeyBiryukov.
See #55857.

git-svn-id: https://develop.svn.wordpress.org/trunk@53769 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-23 15:40:10 +00:00
Sergey Biryukov
c937a1a305 Cache API: Make the placement of wp_cache_flush_group() more consistent.
Includes:
* Placing `WP_Object_Cache::flush_group()` next to `::flush()`.
* Placing `wp_cache_supports_group_flush()` next to `wp_cache_flush_group()`.
* Placing the `wp_cache_flush_group()` unit test next to the `::flush()` method test.
* Removing test name from assertion messages, as it is already mentioned directly above in case of failure.
* Adjusting function descriptions per the documentation standards.

Follow-up to [52706], [53763].

See #55647, #4476.

git-svn-id: https://develop.svn.wordpress.org/trunk@53767 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-23 14:56:51 +00:00
Jonny Harris
40768e4ebe Cache API: Add wp_cache_flush_group function.
Add a new plugable function called `wp_cache_flush_group`, that will allow developers to clear whole cache groups with a single call. Developers can detect if their current implementation of an object cache supports flushing by group, by calling `wp_cache_supports_group_flush` which returns true if it is supported. If the developers of the object cache drop-in has not implemented `wp_cache_flush_group` and `wp_cache_supports_group_flush`, these functions are polyfilled and `wp_cache_supports_group_flush` defaults to false.

Props Spacedmonkey, filosofo, ryan, sc0ttkclark, SergeyBiryukov, scribu, Ste_95, dd32, dhilditch, dougal, lucasbustamante, dg12345, tillkruess, peterwilsoncc, flixos90, pbearne.
Fixes #4476.

git-svn-id: https://develop.svn.wordpress.org/trunk@53763 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-22 20:50:31 +00:00
Jonny Harris
b7bae6936a REST API: Avoid unnecessarily preparing item links.
Do not call the `prepare_links` methods in core REST API controllers, unless the `_links` or `_embedded` fields are requested. There is no need to prepare links if they are never returned in the response. This saves resources, as many calls to `prepare_links` methods perform database queries. 

Props Spacedmonkey, timothyblynjacobs, rachelbaker, desrosj, dlh, hellofromTonya.
Fixes #52992.

git-svn-id: https://develop.svn.wordpress.org/trunk@53760 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-22 13:58:46 +00:00
Jonny Harris
3506684f2a REST API: Use wp_get_lastest_revision_id_and_total_count function in WP_REST_Posts_Controller class.
Add new function called `wp_get_lastest_revision_id_and_total_count`, that performs an optimized query to get the last revision and total and use it in `WP_REST_Posts_Controller` class. 

Props Spacedmonkey, timothyblynjacobs, furi3r, peterwilsoncc.
Fixes #55857.

git-svn-id: https://develop.svn.wordpress.org/trunk@53759 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-22 13:22:04 +00:00
Jb Audras
1d5d9e24c4 Formatting: Normalize to Unicode NFC encoding before converting accent characters in remove_accents().
This changeset adds Unicode sequence normalization from NFD to NFC, via the `normalizer_normalize()` PHP function which is available with the recommended `intl` PHP extension.

This fixes an issue where NFD characters were not properly sanitized. It also provides a unit test for NFD sequences (alternate Unicode representations of the same characters).

Props NumidWasNotAvailable, targz, nacin, nunomorgadinho, p_enrique, gitlost, SergeyBiryukov, markoheijnen, mikeschroder, ocean90, pento, helen, rodrigosevero, zodiac1978, ironprogrammer, audrasjb, azaozz, laboiteare, nuryko, virgar, dxd5001, onnimonni, johnbillion.
Fixes #24661, #47763, #35951.
See #30130, #52654.


git-svn-id: https://develop.svn.wordpress.org/trunk@53754 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-21 21:09:56 +00:00
Adam Silverstein
9bbf3985e3 Media: enable generating multiple mime types for image uploads; specifically WebP versions for JPEG images by default.
This changeset adds the capability for core media uploads to generate sub sized images in more than a single mime type. The output formats for each mime type can be controlled through a filter. WebP is used as an additional output format for JPEG images by default to improve front end performance.

When generating additional mime types, only images which are smaller than the respective original are retained. By default, additional mime type images are only generated for the built-in core image sizes and any custom sizes that have opted in.

Image meta is updated with a new 'sources' array containing file details for each mime type. Each image size in the 'sizes' array also gets a new 'sources' array that contains the image file details for each mime type.

This change also increases image upload retries to accommodate additional image sizes. It also adds a `$mime_type` parameter to the `wp_get_missing_image_subsizes` function and filter.

This change adds three new filters to enable full control of secondary mime image generation and output:

* A new filter `wp_image_sizes_with_additional_mime_type_support` that filters the sizes that support secondary mime type output. Developers can use this to control the output of additional mime type sub-sized images on a per size basis.
* A new filter `wp_upload_image_mime_transforms` that filters the output mime types for a given input mime type. Developers can use this to control generation of additional mime types for a given input mime type or even override the original mime type.
* A new filter `wp_content_image_mimes` which controls image mime type output selection and order for frontend content. Developers can use this to control the mime type output preference order for content images. Content images inserted from the media library will use the available image versions based on the order from this filter.

Thanks to the many contributors who helped develop, test and give feedback on this feature.

A haiku to summarize:

Upload a JPEG
Images of all sizes
Output as WebPs

Props flixos90, MatthiasReinholz, studiolxv, markhowellsmead, eatingrules, pbiron, mukesh27, joegrainger, mehulkaklotar, tweetythierry, akshitsethi, peterwilsoncc, eugenemanuilov, mitogh, shetheliving, clarkeemily, codekraft, mikeschroder, clorith, kasparsd, spacedmonkey, trevorpfromsandee, jb510, scofennellgmailcom, seedsca, cagsmith, karinclimber, dainemawer, baxbridge, grapplerulrich, sobatkras, chynnabenton, tonylocalword, barneydavey, kwillmorth, garymatthews919, olliejones, imarkinteractive, jeffpaul, feastdesignco, webbeetle, masteradhoc.

See #55443.



git-svn-id: https://develop.svn.wordpress.org/trunk@53751 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-21 18:01:01 +00:00
Sergey Biryukov
fdb6e13fed Coding Standards: Move wp-includes/wp-db.php to wp-includes/class-wpdb.php.
This renames the file containing the `wpdb` class to conform to the coding standards.

This commit also includes:
* A new `wp-db.php` that loads the new file, for anyone that may have been including the file directly.
* Replacing references to the old filename with the new filename.

Fixes #56268. See #55647.

git-svn-id: https://develop.svn.wordpress.org/trunk@53749 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-21 15:58:51 +00:00
Jb Audras
a925aabc9c Themes: Add a hook to filter theme header image URL.
This changeset introduces the `get_header_image` filter, which can be used to modify header image URL returned by `get_header_image()`, in themes that support the Header Image feature. 

Props hztyfoon, audrasjb, mukesh27, SergeyBiryukov, costdev.
Fixes #56180.


git-svn-id: https://develop.svn.wordpress.org/trunk@53741 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-20 21:11:30 +00:00
Sergey Biryukov
b698f8f475 Posts, Post Types: Correct the check for non-existing post in get_post_permalink().
The function was erroneously calling `is_wp_error()` on the result of a `get_post()` call, which returns `null` on failure, and never returns a `WP_Error` object.

Previously, passing a non-existing post ID to the function would result in a home URL being returned and a few `Attempt to read property "post_type, post_name, hierarchical..." on null` PHP warnings.

This commit ensures `get_post_permalink()` returns `false` on failure, which brings parity with `get_permalink()`.

Includes a unit test to confirm the correct behavior.

Follow-up to [12923], [13023], [32606].

Props renegeuze, manzoorwani.jk.
Fixes #45329.

git-svn-id: https://develop.svn.wordpress.org/trunk@53733 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-20 15:39:18 +00:00
Sergey Biryukov
57f4d6c7b2 Tests: Correct the test for passing all expected parameters to the preprocess_comment filter.
Previously, `assertSame()` was replaced with `assertSameSets()`, which does not preserve the array keys. `assertSameSetsWithIndex()` should have been used instead.

Follow-up to [36038], [48937], [53729], [53730].

See #55647, #56244.

git-svn-id: https://develop.svn.wordpress.org/trunk@53732 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-20 14:47:39 +00:00
SergeyBiryukov
87534545ed Coding Standards: Standardize on user_id when passing data to comment functions.
The `wp_new_comment()`, `wp_update_comment()`, and `wp_filter_comment()` functions already normalize the `user_ID` parameter internally to `user_id`, which matches the database field name.

This commit aims to bring some consistency when passing the parameter in core.

The corresponding `$user_ID` variable is also renamed to `$user_id` to match the other variables when not referring to the `$user_ID` global, which has an exception in the WordPress coding standards.

Follow-up to [8543], [8720], [12267], [12300], [26491], [28915], [28922], [34799], [49303].

See #55647, #56244.

git-svn-id: https://develop.svn.wordpress.org/trunk@53729 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-20 14:12:02 +00:00
Greg Ziółkowski
41475f336e Editor: Fix register_block_type does not recognise ancestor block setting
When registering block through PHP, using `register_block_type` function, newly introduced `ancestor` block setting in `block.json` was not recognised. It worked though, when block is registered from JavaScript.

Props lovor, annezazu.
Fixes #56184.




git-svn-id: https://develop.svn.wordpress.org/trunk@53718 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-19 13:22:31 +00:00
Sergey Biryukov
27cfc58b34 Tests: Use a consistent way of setting the Administrator role in Ajax tests.
This removes some duplicate code in favor of calling the `WP_Ajax_UnitTestCase::_setRole()` method created specifically for this purpose and used in other tests.

Follow-up to [500/tests], [37288].

Props martin.krcho.
See #56203.

git-svn-id: https://develop.svn.wordpress.org/trunk@53701 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-14 14:26:37 +00:00
John Blackbourn
5c041f5777 Users: Allow conditional supression of the email notifications that are sent when a new user account is registered.
This introduces the following new filters:

* `wp_send_new_user_notification_to_admin`
* `wp_send_new_user_notification_to_user`

Props janthiel, costdev, audrasjb, peterwilsoncc

Fixes #54874


git-svn-id: https://develop.svn.wordpress.org/trunk@53698 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-12 21:03:39 +00:00
Greg Ziółkowski
537e5239f9 Tools: Automate backporting core blocks from Gutenberg to Core
Syncing stable blocks from the Gutenberg repository to wordpress-develop was a manual process, but it got automated with the script that runs together with syncing WordPress packages changed in the Gutenberg package.

Props zieladam.
Fixes #56179.




git-svn-id: https://develop.svn.wordpress.org/trunk@53688 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-08 12:32:37 +00:00
Sergey Biryukov
4b22694e76 Tests: Remove @uses tags from the test suite.
* These were not used consistently, with only four instances across all the tests.
* Using this tag in combination with the `beStrictAboutCoversAnnotation="true"` setting will mark a test as "Risky" if code is executed during the test which is not annotated via `@covers` or `@uses` tags. That would make the maintainance of the tags very fiddly, while adding little additional value for the test code base.

Follow-up to [32995], [39914], [42636], [53682].

Props jrf.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53687 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-08 00:11:15 +00:00
Sergey Biryukov
5880ac84cc Tests: Separate the tests in basic.php for clarity.
There were two kinds of tests in this file:

* Tests for content of some files in the root directory:
 * `license.txt`
 * `SECURITY.md`
 * `package.json`
* Tests for some utility functions of the test framework itself:
 * `strip_ws()`
 * `test_mask_input_value()`

The latter are now moved to their own file, `utils.php`.

Follow-up to [22/tests], [81/tests], [103/tests], [25240], [26940], [28064], [28480], [28493], [28523], [28631], [42381], [47403], [53683].

See #39265, #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53686 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 23:55:13 +00:00
Andrew Ozz
1329b0818d Build/Test Tools: Add @covers tags to the taxonomy and category test groups.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53684 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 23:00:07 +00:00
Andrew Ozz
faebeca64b Build/Test Tools: Add @coversNothing tags to the tests for some content in documentation and settings files.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53683 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 22:53:34 +00:00
Andrew Ozz
4790a10b8b Build/Test Tools: Add @covers tags to the url test group.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.


git-svn-id: https://develop.svn.wordpress.org/trunk@53682 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 22:43:37 +00:00
Andrew Ozz
b419dd47f7 Tests: Remove duplicate testcase test_get_privacy_policy_url_should_return_empty_when_privacy_policy_page_not_set() from Tests_Url_GetPrivacyPolicyUrl.
See: #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53681 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 22:20:18 +00:00
Andrew Ozz
599b7146ca Build/Test Tools: Add and fix @covers tags to the attachments and block-supports test groups.
Props pbeane, hellofromTonya, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53680 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-07 21:06:03 +00:00
Peter Wilson
0a17a80bcc Database: Ensure MySQL port numbers are numeric in wpdb.
Ensure the database port number is recorded as an integer or `null` (the default port) when parsing the database host.

This is to prevent PHP/MySQLi throwing an exception caused by ports represented as numeric strings.

Props audrasjb, azouamauriac, chaion07, costdev, johnjamesjacoby, jrf, sergeybiryukov.
Fixes #54877.


git-svn-id: https://develop.svn.wordpress.org/trunk@53670 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-06 05:31:47 +00:00
Peter Wilson
5b5c74b904 Taxonomy: Retain default term option when unregistering taxos.
No longer delete the default term option in `unregister_taxonomy()` to improve database performance.

Since taxonomies are registered at runtime and can't be unregistered unless they're already registered, prior to this 
change the option was created and deleted on each request.

Deleting the option should occur on a one-time opperation such as plugin deactivation.

Follow up to [48480].

Props dlh.
Fixes #54472.


git-svn-id: https://develop.svn.wordpress.org/trunk@53669 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-06 05:09:22 +00:00