49374 Commits

Author SHA1 Message Date
Jb Audras
dd7b931317 Docs: Typo corrections in class WP_Meta_Query.
Props truptikanzariya.
Fixes #61051.
See #60699.




git-svn-id: https://develop.svn.wordpress.org/trunk@58032 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-22 20:23:58 +00:00
Tammie Lister
62f70e8630 Twenty Twelve: Fixes typing errors in block pattern.
There were several instances of typo corrections in block patterns. This removes the last sentence for a simpler resolution.

Props sabernhardt.
Fixes #61004.


git-svn-id: https://develop.svn.wordpress.org/trunk@58031 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-22 20:17:21 +00:00
Isabel Brison
4f02bc74e6 Editor: fix spacing in function doc.
Correctly formats spacing in `get_layout_styles` docblock.

Props mukesh27, sabernhardt.
See #60981.


git-svn-id: https://develop.svn.wordpress.org/trunk@58030 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-22 07:18:01 +00:00
Sergey Biryukov
a1a7548a4b Docs: Use correct URL for the Embeds documentation article.
Follow-up to [57793].

Props shailu25, estelaris, audrasjb.
See #60732.

git-svn-id: https://develop.svn.wordpress.org/trunk@58029 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-22 06:23:16 +00:00
Isabel Brison
bce4d573ae Editor: limit layout rules on themes without theme.json.
Removes output of base rules for flow and constrained layout types on themes without theme.json.

Props evanltd, poena, isabel_brison, andrewserong, oandregal.
See #60981.


git-svn-id: https://develop.svn.wordpress.org/trunk@58028 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-22 05:28:50 +00:00
SergeyBiryukov
09254045ed Docs: Remove extra space before @since in WP_Block_Bindings_Registry DocBlock.
Follow-up to [57373].

Props shailu25.
Fixes #61046.

git-svn-id: https://develop.svn.wordpress.org/trunk@58027 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-21 03:50:02 +00:00
Sergey Biryukov
e21aa8a17d Coding Standards: Use strict comparison in wp_add_global_styles_for_blocks().
Follow-up to [57546].

Props immeet94.
Fixes #60964.

git-svn-id: https://develop.svn.wordpress.org/trunk@58026 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-20 03:59:10 +00:00
Joe McGill
22ad614ba5 Themes: Cache block theme patterns in a transient.
This extends the benefits of persistent caching added in [56978] for block theme patterns to sites that are not using a persistent object cache. By default, these caches expire using the value of the `WP_Theme::cache_expiration` property. The transient cache TTL can be overridden using the newly introduced `wp_theme_files_cache_ttl` filter.

Props thekt12, joemcgill, flixos90, peterwilsoncc, spacedmonkey.
See #59600, #59719.


git-svn-id: https://develop.svn.wordpress.org/trunk@58025 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-19 17:57:43 +00:00
Sergey Biryukov
364ea85fac Docs: Fix typo in WP_Block_Type::__construct() DocBlock.
Follow-up to [54155].

Props ixkaito.
Fixes #61035.

git-svn-id: https://develop.svn.wordpress.org/trunk@58024 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-19 03:40:54 +00:00
Sergey Biryukov
80096ddf29 Login and Registration: Check that redirect_to is a string in wp-login.php.
This prevents a fatal error if an array is passed instead.

Follow-up to [2876], [4969], [7524], [8701], [25701], [31417], [49109].

Props TimoTijhof.
Fixes #59373.

git-svn-id: https://develop.svn.wordpress.org/trunk@58023 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-18 06:22:19 +00:00
Peter Wilson
5ae18c46d2 Upgrade/Install: Validate source & destination values in WP_Ugrader.
Adds a missing string and some additional validation of paths in the upgrader class.

Follow up to [56992].

Props costdev, jipmoors, karlijnbok, swissspidy, afragen, mukesh27.
Fixes #59712.



git-svn-id: https://develop.svn.wordpress.org/trunk@58022 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-18 03:15:50 +00:00
Joe Dolson
a1370583cc Help/About: Accessibility: Remove target="_blank" from data eraser links.
Remove `target="_blank"` from two links to developer resources on adding the personal data eraser to plugins in the Help info for the privacy screens. Also rectifies differences between the export and erase text for consistency and changes the order of paragraphs. 

Props sabernhardt, joedolson.
Fixes #60097.

git-svn-id: https://develop.svn.wordpress.org/trunk@58021 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-17 20:19:59 +00:00
Sergey Biryukov
a26c655f85 Docs: Correct @since version for COOKIE_DOMAIN default value change.
Follow-up to [58011].

Props mukesh27.
See #46550.

git-svn-id: https://develop.svn.wordpress.org/trunk@58017 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-17 09:44:08 +00:00
Sergey Biryukov
ca0260b5be Users: Set the default value of COOKIE_DOMAIN to an empty string.
This matches the type expected by the `setcookie()` function for the `$domain` parameter, and resolves a fatal error if `strict_types` is enabled.

Reference: [https://www.php.net/setcookie PHP Manual: setcookie()].

Follow-up to [2725], [6434], [12732], [13062].

Props kmvan, rajinsharwar, jrf, desrosj, Cybr, nicolefurlan, oglekler, hellofromTonya, kirasong, chaion07, mukesh27.
Fixes #46550.

git-svn-id: https://develop.svn.wordpress.org/trunk@58011 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-16 16:50:43 +00:00
Dennis Snell
3b9aefb06c HTML API: Validate HTML Processor against external test suite from html5lib.
In this patch, the test suite from html5lib validates the tree-construction
steps in the HTML Processor to ensure that they are behaving according to the
HTML specification. This suite of tests is also used by the servo project to
test its html5ever package.

A new test module in the HTML API transforms HTML Processor output to match
the expected tree shape from the external tests. For cases where there are
tests validating behaviors of unsupported HTML tags and constructs, the tests
are marked as skipped. As the HTML API continues to expand its own support,
the number of skipped tests will automatically shrink down towards zero.

Additional tests are skipped through the `SKIP_TEST` array in the test runner.

Fixes #60227.
See #58517.
Props azaozz, costdev, dmsnell, hellofromtonya, jonsurrell, jorbin, swisspidy.



git-svn-id: https://develop.svn.wordpress.org/trunk@58010 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-16 12:06:46 +00:00
Sergey Biryukov
b39b75c7fe Code Modernization: Fix implicit nullable parameter type deprecation on PHP 8.4.
In PHP 8.4, declaring function or method parameters with a default value of `null` is deprecated if the type is not nullable.

PHP applications are recommended to ''explicitly'' declare the type as nullable. All type declarations that have a default value of `null`, but without declaring `null` in the type declaration, will emit a deprecation notice:
{{{
function test( array $value = null ) {}
}}}
`Deprecated: Implicitly marking parameter $value as nullable is deprecated, the explicit nullable type must be used instead`

**Recommended Changes**

Change the implicit nullable type declaration to a nullable type declaration, available since PHP 7.1:
{{{#!diff
- function test( string $test = null ) {}
+ function test( ?string $test = null ) {}
}}}

This commit updates the affected instances in core to use a nullable type declaration.

References:
* [https://wiki.php.net/rfc/deprecate-implicitly-nullable-types PHP RFC: Deprecate implicitly nullable parameter types]
* [https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated PHP.Watch: PHP 8.4: Implicitly nullable parameter declarations deprecated]

Follow-up to [28731], [50552], [57337], [57985].

Props ayeshrajans, jrf, audrasjb, jorbin.
Fixes #60786.

git-svn-id: https://develop.svn.wordpress.org/trunk@58009 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-15 20:01:03 +00:00
Tammie Lister
e77536e97b Twenty Eleven: Removes Negative values for padding.
This fixes the issue where negative values aren't allows in older versions of IE. There is more discussion in another ticket on a wider approach, but for now the decision to commit this was made as an interim solution.

Props mukesh27, SergeyBiryukov, sabernhardt, poena.
Fixes #46771.


git-svn-id: https://develop.svn.wordpress.org/trunk@58005 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-15 16:38:45 +00:00
Tammie Lister
067ba8c584 Twenty Twenty Two: Wraps Navigation block in row.
Now that the Blocks Hooks API is released in 6.4, you might want to insert blocks into header of the theme after the Navigation block. This wraps to allow this.

Props tomjcafferkey, poena, shailu25.
Fixes #60724.


git-svn-id: https://develop.svn.wordpress.org/trunk@58004 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-15 16:24:15 +00:00
Sergey Biryukov
f6747a384f Twenty Twenty-One: Check for WP_Error before outputting get_the_tag_list().
This prevents a fatal error on PHP 8 and brings consistency with the other bundled themes.

Follow-up to [47886].

Props josephscott, sabernhardt, poena, nirav7707, devsahadat.
Fixes #60800.

git-svn-id: https://develop.svn.wordpress.org/trunk@57991 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-14 21:55:32 +00:00
Sergey Biryukov
d898ee77c9 Users: Account for returning false from the authenticate filter.
While technically only `null`, `WP_User`, or `WP_Error` should be returned from the `authenticate` filter, a plugin might return boolean `false` instead, which would trigger the `authentication_failed` error prior to [57882].

This commit aims to preserve that behavior in case `false` is returned.

Follow-up to [57882].

Props johnbillion.
See #60700.

git-svn-id: https://develop.svn.wordpress.org/trunk@57990 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-13 16:31:55 +00:00
Tammie Lister
a584c4ea0d Twenty Fourteen: Fixes pullquote block issues with font sizing.
The pullquote block was not showing increase in sizes within the editor. This solves that and allows you to see the change both in the editor and front.

Props nidhidhandhukiya, huzaifaalmesbah.
Fixes #59800.


git-svn-id: https://develop.svn.wordpress.org/trunk@57989 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-12 19:53:05 +00:00
Pascal Birchler
bcf58a34ef Docs: Revert unintended svn:ignore change after [57987].
See #60699.

git-svn-id: https://develop.svn.wordpress.org/trunk@57988 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-12 17:48:08 +00:00
Pascal Birchler
11bc9c9e8c Docs: Fix various typos and spelling mistakes.
Props swissspidy, jucaduca, sergeybiryukov.
See #60699.

git-svn-id: https://develop.svn.wordpress.org/trunk@57987 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-12 17:45:23 +00:00
Sergey Biryukov
6366755a31 Coding Standards: Upgrade WPCS to version 3.1.0.
The impact on existing WordPress core code is expected to be minimal, but the release does provide more safeguards for the future.

References:
* [https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.1.0 WPCS 3.1.0 release notes]
* [https://github.com/WordPress/WordPress-Coding-Standards/compare/3.0.1...3.1.0 Full list of changes in WPCS 3.1.0]

Follow-up to [56695], [56799], [57378].

Props jrf, garyj, dingo_d, rodrigosprimo, Chouby, westonruter, bjorsch.
Fixes #60840.

git-svn-id: https://develop.svn.wordpress.org/trunk@57986 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-12 12:15:58 +00:00
John Blackbourn
d952352987 General: Increase the minimum supported version of PHP to 7.2.24.
Props justlevine, masteradhoc, samiamnot, hellofromTonya, azaozz, jrf, dd32, desrosj, jorbin

Fixes #58719


git-svn-id: https://develop.svn.wordpress.org/trunk@57985 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-11 21:09:49 +00:00
Sergey Biryukov
0d730aaf4e Docs: Update @since version for wp_zip_file_is_valid().
Follow-up to [57537], [57916], [57929].

Props TobiasBg.
See #60398.

git-svn-id: https://develop.svn.wordpress.org/trunk@57984 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-11 14:26:56 +00:00
Pascal Birchler
f525e665b6 Script Loader: stop enqueueing some now obsolete polyfills.
Stop enqueueing polyfills such as `wp-polyfill-inert` (for the `inert` attribute) and `regenerator-runtime` (for generator functions), as they are no longer needed, considering the WordPress project's [https://make.wordpress.org/core/handbook/best-practices/browser-support/ browser support policy].

In addition to that, `wp-polyfill` (essentially `core-js`) is no longer enqueued as a dependency of `react`. This was added in [43903] to ensure compatibility with IE 11, which is no longer supported by WordPress. Developers requiring `wp-polyfill` need to manually add it as a dependency for their scripts.

Props swissspidy, flixos90, adamsilverstein, youknowriad, gziolo.
Fixes #60962.

git-svn-id: https://develop.svn.wordpress.org/trunk@57981 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-10 14:40:05 +00:00
John Blackbourn
5afdac7e05 Editor: Update npm packages.
Updates the editor npm packages to the latest patch versions for 6.5.1.

See https://github.com/WordPress/gutenberg/pull/60577.


git-svn-id: https://develop.svn.wordpress.org/trunk@57949 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-09 10:55:09 +00:00
Isabel Brison
bf19f16adc Editor: skip outputting base layout rules if content and wide size values don’t exist.
Skip outputting layout rules that reference content and wide sizes CSS variables, if no layout sizes exist in the current `theme.json`.

Props andrewserong.
Fixes #60936.


git-svn-id: https://develop.svn.wordpress.org/trunk@57948 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-09 07:18:41 +00:00
Jorge Costa
1393dc25b5 Coding Standards: Fix missing strict in_array on block-template-utils.php.
Props swissspidy.

git-svn-id: https://develop.svn.wordpress.org/trunk@57946 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-08 21:40:02 +00:00
Sergey Biryukov
6ef8cf9bf8 Twenty Twenty-Four: Remove pattern from home template to improve performance.
Creating the Home Business pattern was needed to show it on the template replacement flows, but there's no need to use it in the template, and the minor code repetition is better than having to do a an extra pattern replacement.

Follow-up to [https://github.com/WordPress/twentytwentyfour/pull/486 PR #486].

Props onemaggie, youknowriad, poena, afercia.
Fixes #60620.

git-svn-id: https://develop.svn.wordpress.org/trunk@57945 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-08 19:19:08 +00:00
Jorge Costa
f18c917f6d Honor template_hierarchy filters when creating a template in the Site Editor.
Currently, in blocks themes it's possible to use the ${type}_template_hierarchy filter to alter the template hierarchy. However, those filters are not taken into consideration by the Choose a pattern popup screen that appears when creating a new template in the Site Editor, causing a mismatch between the editor and the frontend.

Props aljullu, mukesh27, ntsekouras, jorgefilipecosta, gziolo.
Fixes #60846.

git-svn-id: https://develop.svn.wordpress.org/trunk@57944 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-08 16:45:22 +00:00
Peter Wilson
18db904c29 Script Loader: Improve asset concatenation Etags.
Include the asset version of JavaScript and CSS files when generating the ETag for concatenated assets in `load-scripts.php` and `load-styles.php`. This ensures the ETag is updated as script versions change (for example editor package updates) rather than only when the WordPress version changes.

The `W\` prefix is added to the generated ETag to allow for CDNs and proxy servers modifying the script to add or improve the compression algorithm.

Props azaozz, dav4, ironprogrammer, johnbillion, kkmuffme, monzuralam, peterwilsoncc, sergeybiryukov.
Fixes #58433.


git-svn-id: https://develop.svn.wordpress.org/trunk@57943 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-07 23:51:57 +00:00
Sergey Biryukov
9b70a33d7e Docs: Correct @since version for status code 425 in get_status_header_desc().
Follow-up to [57936].

See #60942.

git-svn-id: https://develop.svn.wordpress.org/trunk@57937 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-07 11:20:57 +00:00
Sergey Biryukov
3d2063c8f1 HTTP API: Add support for a description for HTTP status code 425 (Too Early).
Reference: [https://datatracker.ietf.org/doc/rfc8470/ RFC 8470: Using Early Data in HTTP].

Follow-up to [5446], [6104], [10740], [27422], [36274], [36294], [42207].

Props kkmuffme, mukesh27, joemcgill.
Fixes #60942.

git-svn-id: https://develop.svn.wordpress.org/trunk@57936 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-07 11:16:06 +00:00
Sergey Biryukov
f216440146 Coding Standards: Use strict comparison in wp-includes/class-wp-image-editor-imagick.php.
Follow-up to [22094].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.

git-svn-id: https://develop.svn.wordpress.org/trunk@57934 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-06 13:35:33 +00:00
Aaron Jorbin
50b31d95d7 Media: Use flex-start for full browser support.
The value of `start` is not fully supported by Opera Mini which has 1.01% usage. There is no material change in functionality with this change.

Follow-up to [55919].

Props davidbaumwald, sabernhardt, khokansardar, devsahadat.
Fixes #60876.


git-svn-id: https://develop.svn.wordpress.org/trunk@57933 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-05 21:45:55 +00:00
Tammie Lister
242f50f4d9 Twenty Twenty-Four: Fixes typo in testimonial pattern.
There was a small typo which was in a string context only visible to translators for the testimonial pattern. This fixes that.

Props shailu25, SergeyBiryukov.
Fixes #60924.


git-svn-id: https://develop.svn.wordpress.org/trunk@57932 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-05 20:44:05 +00:00
Sergey Biryukov
13fd2f829b Tests: Use an image on WordPress.org CDN in external HTTP tests.
Due to some changes on the WP.com side to compress the requested images on the fly, the exact image size in the response could be different between platforms.

This commit aims to make the affected tests more reliable.

Follow-up to [139/tests], [31258], [34568], [47142], [57903], [57904], [57924].

Props peterwilsoncc, jorbin.
See #60865.

git-svn-id: https://develop.svn.wordpress.org/trunk@57931 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-05 12:10:13 +00:00
Joe McGill
ea7888f114 Themes: Avoid errors in some environments from _get_block_templates_paths.
This adds an `is_dir()` check in `_get_block_templates_paths` before trying to run a `RecursiveDirectoryIterator` to avoid errors being reported in New Relic even thought the errors should be handled by a try/catch block.

Follow-up to [57215].

Props iCaleb, sean212, mukesh27, joemcgill.
Fixes #60915.



git-svn-id: https://develop.svn.wordpress.org/trunk@57928 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 18:53:39 +00:00
John Blackbourn
fa16bb37b2 Database: Remove back-compat for database servers that don't support utf8mb4.
Since WordPress 6.5, the minimum supported version of MySQL and MariaDB is 5.5.5. This means all supported database servers now support the `utf8mb4` character set and therefore the conditional logic for this is no longer necessary.

Props l1nuxjedi, craigfrancis, OllieJones, johnbillion

Fixes #60096


git-svn-id: https://develop.svn.wordpress.org/trunk@57926 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 15:11:37 +00:00
Pascal Birchler
c67ceb0d32 I18N: Bail early if an invalid text domain is passed to load_textdomain() et al.
Some plugins pass invalid values such as `null` instead of a string, which has never been supported by WordPress (no translations are loaded) and was technically undefined behavior. With the introduction of the new l10n library in #59656, which has stricter type hints, this could end up causing warnings or even fatal errors.

This change adds a deliberate short-circuit to `load_textdomain()` & co. to better handle such a case and document that it is not supported.

Props verygoode, swissspidy.
Fixes #60888.

git-svn-id: https://develop.svn.wordpress.org/trunk@57925 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 13:54:12 +00:00
Pascal Birchler
90ea883871 Build/Test Tools: Update a few image URLs in HTTP and image cropping tests.
Follow-up to #60865 / [57903] where similar instances were recently updated due to an upstream change.

Particularly the `test_wp_crop_image_with_url()` test recently began to fail on some environments, likely because of the same change.

This updates the image URLs with the aim to bring more consistency and to get the test passing again more broadly.

Fixes #60907.

git-svn-id: https://develop.svn.wordpress.org/trunk@57924 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 13:43:49 +00:00
Pascal Birchler
554f5b5723 Permalinks: Detect FrankenPHP web server support.
Support pretty permalinks when FrankenPHP server is detected, which is built on top of Caddy. Caddy detection was added in [57612].

Props swissspidy, stephenmiracle.
Fixes #60884.

git-svn-id: https://develop.svn.wordpress.org/trunk@57923 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 13:37:56 +00:00
Pascal Birchler
89bd74fea1 I18N: Always search for script translations in wp-content/languages/plugins.
Previously, when `WP_PLUGIN_DIR` was set to something other than `wp-content/plugins`, e.g. `wp-content/mods`, `load_script_textdomain` was searching for script translations in `wp-content/languages/mods`. However, that is incorrect, as `WP_PLUGIN_DIR` does not affect where translations are stored. The location is always `wp-content/languages/plugins`.

Props coreymckrill, swissspidy.
Fixes #60891.

git-svn-id: https://develop.svn.wordpress.org/trunk@57922 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 13:36:25 +00:00
Sergey Biryukov
06bbc9afde Docs: Fix typo in wp_mediaelement_fallback filter description.
Follow-up to [23729], [28128].

Props dilipbheda, mukesh27.
Fixes #60917.

git-svn-id: https://develop.svn.wordpress.org/trunk@57921 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-04 11:17:16 +00:00
Felix Arntz
7d606a30e2 Options, Meta APIs: Use more sensible default for autoloading options which allows WordPress core to make a decision.
An excessive amount of autoloaded options is a common cause for slow database responses, sometimes caused by very large individual autoloaded options. As it is not mandatory to provide an autoload value when adding an option to the database, it tends to be ignored, which in combination with a default value of "yes" and lack of documentation can lead to the aforementioned problem.

This changeset enhances the option autoloading behavior in several ways:
* Update the function documentation to encourage the use of boolean `true` or `false` to explicitly provide an autoload value for an option.
* Use new string values `on` and `off` for explicitly provided values stored in the database, to distinguish them from `yes` and `no`, since `yes` does not allow determining whether it was set intentionally by the developer or only as a default.
* Effectively deprecate the values `yes` and `no`. They are still supported for backward compatibility, but now discouraged.
* Use `null` as new default autoload value for `add_option()`. If the developer does not provide an explicit value, this will now trigger WordPress logic to determine an autoload value to use:
    * If WordPress determines that the option should not be autoloaded, it is stored in the database as `auto-off`. As part of this changeset, the single heuristic introduced for that is to check whether the option size is larger than a threshold of 150k bytes. This threshold is filterable via a new `wp_max_autoloaded_option_size` filter.
    * If WordPress determines that the option should be autoloaded, it is stored in the database as `auto-on`. No logic to make such a decision is introduced as part of this changeset, but a new filter `wp_default_autoload_value` can be used to define such heuristics, e.g. by optimization plugins.
    * If WordPress cannot determine whether or not to autoload the option, it is stored in the database as `auto`.
    * This effectively means that any option without an explicit autoload value provided by the developer will be stored with an autoload value of `auto`, unless the option's size exceeds the aforementioned threshold. Options with a value of `auto` are still autoloaded as of today, most importantly for backward compatibility. A new function `wp_autoload_values_to_autoload()` returns the list of autolaod values that dictate for an option to be autoloaded, and a new filter `wp_autoload_values_to_autoload` can be used to alter that list.

These behavioral changes encourage developers to be more mindful of autoloading, while providing WordPress core and optimization plugins with additional control over heuristics for autoloading options where no explicit autoload value was provided.

At the same time, the changes are fully backward compatible from a functionality perspective, with the only exception being that very large options will now no longer be autoloaded if the developer did not explicitly request for them to be autoloaded. Neither WordPress core nor plugins are able to override an explicitly provided value, which is intentional to continue giving developers full control over their own options.

Props pbearne, flixos90, joemcgill, azaozz, spacedmonkey, swissspidy, mukesh27, markjaquith.
Fixes #42441.


git-svn-id: https://develop.svn.wordpress.org/trunk@57920 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-03 21:29:13 +00:00
bernhard-reiter
aa0440882a Block Hooks: Pass correct context to filters.
The `$context` argument passed to filters such as `hooked_block_types`, `hooked_block`, and `hooked_block_{$hooked_block_type}` allows them to conditionally insert a hooked block. If the anchor block is contained in a template or template part, `$context` will be set to a `WP_Block_Template` object reflecting that template or part.

The aforementioned filters are applied when hooked block insertion is run upon reading a template (or part) from the DB (and before sending the template/part content with hooked blocks inserted over the REST API to the client), but also upon writing to the DB, as that's when the `ignoredHookedBlocks` metadata attribute is set.

Prior to this changeset, the `$context` passed to Block Hooks related filters in the latter case reflected the template/part that was already stored in the database (if any), which is a bug; instead, it needs to reflect the template/part that will result from the incoming `POST` network request that will trigger a database update.

Those incoming changes are encapsulated in the `$changes` argument passed to the `reset_pre_insert_template` and  `reset_pre_insert_template_part` filters, respectively, and thus to the `inject_ignored_hooked_blocks_metadata_attributes` function that is hooked to them. `$changes` is of type `stdClass` and only contains the fields that need to be updated. That means that in order to create a `WP_Block_Template` object, a two-step process is needed:

- Emulate what the updated `wp_template` or `wp_template_part` post object in the database will look like by merging `$changes` on top of the existing `$post` object fetched from the DB, or from the theme's block template (part) file, if any.
- Create a `WP_Block_Template` from the resulting object.

To achieve the latter, a new helper method (`_build_block_template_object_from_post_object`) is extracted from the existing `_build_block_template_result_from_post` function. (The latter cannot be used directly as it includes a few database calls that will fail if no post object for the template has existed yet in the database.)

While somewhat complicated to implement, the overall change allows for better separation of concerns and isolation of entities. This is visible e.g. in the fact that `inject_ignored_hooked_blocks_metadata_attributes` no longer requires a `$request` argument, which is reflected by unit tests no longer needing to create a `$request` object to pass to it, thus decoupling the function from the templates endpoint controller.

Unit tests for `inject_ignored_hooked_blocks_metadata_attributes` have been moved to a new, separate file. Test coverage has been added such that now, all three relevant scenarios are covered:

- The template doesn't exist in the DB, nor is there a block theme template file for it.
- The template doesn't exist in the DB, but there is a block theme template file for it.
- The template already exists in the DB.

Those scenarios also correspond to the logical branching inside `WP_REST_Templates_Controller::prepare_item_for_database`, which is where `inject_ignored_hooked_blocks_metadata_attributes` gets its data from.

Props tomjcafferkey, bernhard-reiter, gziolo, swissspidy.
Fixes #60754.

git-svn-id: https://develop.svn.wordpress.org/trunk@57919 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-03 15:09:38 +00:00
Pascal Birchler
f158f6d3f2 Build/Test Tools: Migrate to Docker Compose V2.
Compose V2, which was first released in 2020, is included with all currently supported versions of Docker Desktop. Compose V1 stopped receiving updates in July 2023.

The biggest difference is that the command to interact with Compose changed from `docker-compose` to `docker compose`.

GitHub has now started removing V1 from Ubuntu & Windows images, which caused all Docker-based GitHub Actions workflows to fail.

This change migrates to the new `docker compose` command to address these failures.

Props swissspidy, thelovekesh.
Fixes #60901.

git-svn-id: https://develop.svn.wordpress.org/trunk@57918 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-03 11:31:43 +00:00
Sergey Biryukov
6fda95a1e8 Coding Standards: Use strict comparison in wp-includes/class-wp-image-editor-gd.php.
Follow-up to [22094], [22817], [50810], [57524].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.

git-svn-id: https://develop.svn.wordpress.org/trunk@57917 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-03 10:31:53 +00:00