45219 Commits

Author SHA1 Message Date
Sergey Biryukov
f764d7381a Docs: Fix typo in TracTickets::isTracTicketClosed() description.
Follow-up to [761/tests], [762/tests], [891/tests].

See #54729.

git-svn-id: https://develop.svn.wordpress.org/trunk@52779 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-20 10:12:37 +00:00
Sergey Biryukov
109953c1fb Tests: Convert _wp_to_kebab_case() tests to use a data provider.
Follow-up to [51198], [51225].

See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52778 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 13:43:53 +00:00
Sergey Biryukov
3d0607f0df Docs: Correct parameter types for data_wp_validate_boolean().
Follow-up to [46159], [46224], [52775], [52776].

See #54725, #54729.

git-svn-id: https://develop.svn.wordpress.org/trunk@52777 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 13:25:05 +00:00
Sergey Biryukov
2836ece22f Docs: Improve some DocBlocks in wp_validate_boolean() tests for consistency.
Follow-up to [46159], [46224], [52775].

See #54725, #54729.

git-svn-id: https://develop.svn.wordpress.org/trunk@52776 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 13:00:04 +00:00
Sergey Biryukov
d0f8d4ff70 Tests: Correct the order of expected and actual values in wp_validate_boolean() tests.
This corrects the order of the parameters when used in assertions so if/when they fail the failure message is correct.

Additionally, this commit moves the test function before the data provider, for consistency with other tests.

Follow-up to [46159], [46224].

See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52775 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 12:40:48 +00:00
Sergey Biryukov
407325eb1a Tests: Correct the order of expected and actual values in wp_array_slice_assoc() tests.
This corrects the order of the parameters when used in assertions so if/when they fail the failure message is correct.

Follow-up to [45371].

See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52774 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 12:37:05 +00:00
Sergey Biryukov
cff706c8f0 Tests: Correct the order of expected and actual values in get_status_header_desc() tests.
This corrects the order of the parameters when used in assertions so if/when they fail the failure message is correct.

Follow-up to [46107].

See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52773 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 12:36:04 +00:00
Jonny Harris
c98f4c04db Cache API: Add wp_cache_flush_runtime function
Add a new function called `wp_cache_flush_runtime` to existing caching functions found in WordPress. This function allows users to flush the runtime (in-memory) cache, without flushing the entire persistent cache. 

Props: Spacedmonkey, tillkruess, flixos90, adamsilverstein, SergeyBiryukov, barryhughes. 
Fixes: #55080.



git-svn-id: https://develop.svn.wordpress.org/trunk@52772 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-18 12:04:52 +00:00
Tonya Mork
a3cbbc419d Editor: Automatically apply global styles duotone filters to render in post editor.
Global styles duotone filters were not rendering in the post editor. This fixes that by adding `wp_global_styles_render_svg_filters` to the `in_admin_header` so it renders in the body before the editor.

Follow-up [52757].

Props ajlende, abhanonstopnewsuk.
Fixes #55190.

git-svn-id: https://develop.svn.wordpress.org/trunk@52768 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 20:43:39 +00:00
Jb Audras
5c845102ac Editor: Update block editor packages for WordPress 5.9.1.
The following packages were updated:

- @wordpress/block-directory@3.0.27
- @wordpress/block-editor@8.0.17
- @wordpress/block-library@6.0.26
- @wordpress/components@19.2.3
- @wordpress/core-data@4.0.10
- @wordpress/customize-widgets@2.0.27
- @wordpress/e2e-tests@2.5.18
- @wordpress/edit-post@5.0.27
- @wordpress/edit-site@3.0.27
- @wordpress/edit-widgets@3.1.22
- @wordpress/editor@12.0.21
- @wordpress/format-library@3.0.23
- @wordpress/interface@4.1.18
- @wordpress/list-reusable-blocks@3.0.20
- @wordpress/nux@5.0.20
- @wordpress/reusable-blocks@3.0.23
- @wordpress/server-side-render@3.0.20
- @wordpress/widgets@2.0.23

Props Mamaduka.
See #55179.


git-svn-id: https://develop.svn.wordpress.org/trunk@52765 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 19:16:57 +00:00
Tonya Mork
4f18e39896 Editor: Adds an additional check to guard against incompete presets.
Adds an additional guard to ensure the value of `$preset_metadata['value_key']` actually exists as a key in the `$preset` array. Fixes `Warning: Undefined array key` error. 

Intentionally adds the check into the existing `isset()` as it's native to PHP, more efficient, and a good pattern.

Follow-up [52049].

Props jeherve, swissspidy, sergeybiryukov, jrf.
Fixes #55161.



git-svn-id: https://develop.svn.wordpress.org/trunk@52763 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 18:45:35 +00:00
Sergey Biryukov
f92bc1fafc Tests: Correct the @ticket reference in a download_url() test with the Content-Disposition header.
Move the data provider next to the test, for consistency.

Follow-up to [51939], [52734].

Props azouamauriac.
See #55109.

git-svn-id: https://develop.svn.wordpress.org/trunk@52760 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 17:38:23 +00:00
Jb Audras
4ca813d29d Editor: Backport Duotone fixes for 5.9.1.
This changeset is a backport for the following Gutenberg PRs:

- Fix duotone theme cache gutenberg#36236
- Fix duotone render in non-fse themes gutenberg#37954
- Duotone: Allow users to specify custom filters gutenberg#38442

Props oandregal, scruffian, Mamaduka.
See #55179.


git-svn-id: https://develop.svn.wordpress.org/trunk@52757 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 16:16:59 +00:00
Tonya Mork
51531f054e Editor: Grant only admins access to the "Navigation Menus" UI for block and non-block themes.
Restricts and grants access to only admin roles for the Navigation Menu UI screen, i.e. either directly through the URL wp-admin/edit.php?post_type=wp_navigation or via the Navigation block's "Manage menu" option (in the block's toolbar).

It resolves 2 issues:

- For non-block themes, fixes the issue where admins could not access the UI.
- For block themes, restricts access to only admin roles, i.e. non-admins no longer have access to the UI.

Non-admins will receive the "Sorry, you are not allowed to edit posts in this post type" error message.

Follow-up [52069], [52145], [52330], [52400].

Props ironprogrammer, costdev, noisysocks, talldanwp, hellofromTonya, manfcarlo, pyrobd.
Fixes #54889.

git-svn-id: https://develop.svn.wordpress.org/trunk@52755 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 15:09:27 +00:00
Dominik Schilling
fcd5d3b495 Script Loader: Prevent normalizing data URIs in _wp_normalize_relative_css_links().
This prevents making data URIs as in `mask-image:url('data:image/svg+xml;utf8,<svg...` relative to the WordPress installation.

Props staatic.
See #54243.
Fixes #55177.

git-svn-id: https://develop.svn.wordpress.org/trunk@52754 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 14:45:53 +00:00
Jorge Costa
dd60c77928 Global Styles: Load the global styles before the theme styles in the editor.
This commit makes the site editor follow what we do in the front-end, where theme styles are loaded after global styles by default.

Props oandregal, ntsekouras.
Fixes #55188.

git-svn-id: https://develop.svn.wordpress.org/trunk@52752 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 14:12:59 +00:00
Jorge Costa
d2b385b7b8 Global Styles: Fix PHP warning in WP_REST_Global_Styles_Controller if no styles exist.
There is a PHP warning in WP_REST_Global_Styles_Controller because we are assuming that every theme.json has styles property, which is not always the case.

Props ntsekouras.
Fixes #54900.

git-svn-id: https://develop.svn.wordpress.org/trunk@52750 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 13:46:27 +00:00
Sergey Biryukov
9a6179e941 External Libraries: Upgrade PHPMailer to version 6.5.4.
The latest release includes some minor PHP cross-version improvements and a safeguard against hosters disabling security functions. Note to hosting providers: don't disable `escapeshellarg()` and `escapeshellcmd()`; it's not safe!

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.4

For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.5.3...v6.5.4

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252].

Props jrf, Synchro.
Fixes #55187.

git-svn-id: https://develop.svn.wordpress.org/trunk@52749 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 13:21:44 +00:00
Jb Audras
2ab5940420 Themes: Allow extending WP_Theme_JSON and WP_Theme_JSON_Resolver classes.
This change updates methods visibility from `private` to `protected` and adds late static binding.

Original PRs from Gutenberg repository:
- https://github.com/WordPress/gutenberg/pull/38625
- https://github.com/WordPress/gutenberg/pull/38671

Props oandregal, Mamaduka, kapilpaul.
Fixes #55178.
See #55179.


git-svn-id: https://develop.svn.wordpress.org/trunk@52744 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-17 09:02:10 +00:00
Jorge Costa
8ec1cb83e3 Script Loader: Improvements to the load block support styles mechanism.
This commit applies feedback given to commit 52741. It changes the new function name, the file where it is located, and improves its documentation and marks.

Follow-up to [52741].
Props hellofromtonya, swissspidy, oandregal.
See #55148.

git-svn-id: https://develop.svn.wordpress.org/trunk@52743 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-16 22:18:33 +00:00
Sergey Biryukov
249b59b40b External Libraries: Update random_compat to version 2.0.21.
The latest release includes improved compatibility with PHP 8.1, as well as some bug fixes for Windows platforms.

Release notes:
https://github.com/paragonie/random_compat/releases/tag/v2.0.21

For a full list of changes in this update, see the random_compat GitHub:
https://github.com/paragonie/random_compat/compare/v2.0.11...v2.0.21

Follow-up to [42130].

Props jrf, paragoninitiativeenterprises.
Fixes #55181.

git-svn-id: https://develop.svn.wordpress.org/trunk@52742 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-16 21:17:04 +00:00
Jorge Costa
43a8631882 Script Loader: Load block support styles in the head for block themes.
The dynamic block styles for layout and elements should be loaded in the head for block themes. While that should also be the case for classic themes, the current mechanism we use (render_block) does not allow us to do that, hence, this PR doesn't change anything for them and will be loaded the body.

Props oandregal, youknowriad, wpsoul.
Fixes #55148.

git-svn-id: https://develop.svn.wordpress.org/trunk@52741 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-16 17:26:46 +00:00
Sergey Biryukov
3bb8f13d6f Twenty Seventeen: Remove bottom border (box-shadow) from linked images.
Props mikachan, sabernhardt, nidhidhandhukiya, mukesh27, scruffian.
Fixes #55141.

git-svn-id: https://develop.svn.wordpress.org/trunk@52740 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-16 13:44:34 +00:00
Jb Audras
6dc1e0ed3b Script Loader: Load block themes styles in the head section.
Previously, some logic was added to load the global stylesheet in the bottom of `<body>` for classic themes that opted-in into loading individual block styles instead of a single stylesheet for them all. At the time, block themes always loaded the global stylesheet in the `<head>`. When block themes landed in core during WordPress 5.9 this logic wasn’t updated to consider them, hence the global stylesheet loaded in the `<body>` for them. This changeset fixes this.

Props oandregal, aristath.
Fixes #55148.


git-svn-id: https://develop.svn.wordpress.org/trunk@52738 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-16 10:34:20 +00:00
Jb Audras
582f4e7da8 Networks and Sites: Remove unnecessary commented code from remove_user_from_blog().
This change removes a call to `wp_revoke_user()` from `remove_user_from_blog()`: this line has been commented out since forever.

Props Faison.
Fixes #55170.


git-svn-id: https://develop.svn.wordpress.org/trunk@52737 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-15 21:19:20 +00:00
Jb Audras
7c37cc1122 Administration: Fix a CSS issue on the Welcome Panel when the "Dashboard" heading is missing.
This change adds a CSS exception for when the "Dashboard" heading is missing or located below the Welcome Panel.

Props critterverse, sabernhardt, rolfsiebers, audrasjb.
Fixes #54977.


git-svn-id: https://develop.svn.wordpress.org/trunk@52735 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-15 18:10:22 +00:00
Marius L. J
d7745c656d Filesystem API: Use a temp folder for Content-Disposition files.
#38231 added support for files fetched remotely to have their filename defined by the host using the `Content-Disposition` header. This would then take priority over the existing temporary file name created with `wp_tempnam()` earlier in the process.

The change unintentionally omitted the temporary directory path used during uploads, since the `wp_tempnam()` function would have added it previously, so that files with this header ended up being stored in the WordPress root folder, or wp-admin folder, when triggered by WP_Cron or user interactions respectively.

This change makes sure the file path includes the temporary directory location when the header is used.

Follow-up to [51939].

Props antonynz, azouamauriac.
Fixes #55109.

git-svn-id: https://develop.svn.wordpress.org/trunk@52734 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-15 17:47:39 +00:00
Dominik Schilling
fac497a8d1 Editor: Prevent front-end assets of a block from being enqueued in the block editor.
Since WordPress 5.9 you can set a view script for a block which is supposed to be only loaded on the front end. Unfortunately it's currently also loaded in the editor which can cause unexpected behaviour and also performance issues depending on the size of the scripts.
This is caused by the preloading of REST API routes via `block_editor_rest_api_preload()` which doesn't happen in an encapsulated process and so does pollute any global state like the one for scripts and styles.
Similar to the global `$post`, core now backups the globals `$wp_scripts` and `$wp_styles` and restores the backup after the preloading.

Props gziolo, ocean90.
Fixes #55151.

git-svn-id: https://develop.svn.wordpress.org/trunk@52733 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-15 17:28:14 +00:00
Sergey Biryukov
870259d6ec Coding Standards: Rename some variables in iis7_add_rewrite_rule() for consistency.
Follow-up to [52721].

Props azouamauriac.
See #54728.

git-svn-id: https://develop.svn.wordpress.org/trunk@52732 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-15 13:47:53 +00:00
Jb Audras
27a9de78ab Widgets: Missing markup from Widgets Group block.
This change fixes an issue in the Widgets editor: widgets group was missing a `.wp-widget-group__inner-blocks` container.

Props noisysocks, ironprogrammer.
Fixes #55072.


git-svn-id: https://develop.svn.wordpress.org/trunk@52730 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-15 09:56:02 +00:00
Jb Audras
bb68a8b1e4 Twenty Twenty-One: Allow editor styles to control block margins.
This change removes some overrides that prevented site editor updates in 5.9 from controlling vertical margins via `var(--global--spacing-vertical)`.

Props stacimc, Boniu91, aristath, ironprogrammer, nidhidhandhukiya.
Fixes #54250.


git-svn-id: https://develop.svn.wordpress.org/trunk@52726 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-14 21:53:47 +00:00
Sergey Biryukov
eb6ed4faec Media: Display an error message in grid view if the attachment could not be deleted.
Previously, the attachment was silently removed from the grid but reappeared after a page reload.

Follow-up to [22869].

Props kapilpaul, costdev, mukesh27, azouamauriac, SergeyBiryukov.
Fixes #55158.

git-svn-id: https://develop.svn.wordpress.org/trunk@52725 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-14 14:19:10 +00:00
Jb Audras
bc1c4a5eb1 Twenty Fifteen: Add gradient background options using the theme color scheme.
This change implements gradient background options that fit the color scheme used in Twenty Fifteen.

Props ianbelanger, itsamoreh, pls78, audrasjb.
Fixes #49760.


git-svn-id: https://develop.svn.wordpress.org/trunk@52724 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-13 21:45:13 +00:00
Sergey Biryukov
1635b639bd Coding Standards: Fix WPCS issues in wp-admin/includes/misc.php.
* Use strict comparison in various conditions.
* Fix a `Variable "$system_webServer_node" is not in valid snake_case format` WPCS warning.

Includes minor code layout fixes for better readability.

Follow-up to [10607], [11350], [22253], [26137].

Props azouamauriac, SergeyBiryukov.
See #54728.

git-svn-id: https://develop.svn.wordpress.org/trunk@52721 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-13 17:07:09 +00:00
Sergey Biryukov
5ae294022c Docs: Fix typo in a comment in wp_get_image_mime().
Follow-up to [39831].

Props dilipbheda.
Fixes #55154.

git-svn-id: https://develop.svn.wordpress.org/trunk@52719 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-12 14:43:08 +00:00
Sergey Biryukov
6f4bb2fbeb Code Modernization: Use file_get_contents() in wp_get_webp_info().
`file_get_contents()` is faster than `fread()`, because the PHP core can decide how to best read the remaining file; it could decide to issue just one `read()` call or `mmap()` the file first.

Per the PHP manual, `file_get_contents()` or `stream_get_contents()` is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by the OS to enhance performance.

Reference: [https://www.php.net/manual/en/function.file-get-contents.php PHP Manual: file_get_contents()].

Follow-up to [50810], [52696], [52698], [52701].

Props maxkellermann.
See #55069.

git-svn-id: https://develop.svn.wordpress.org/trunk@52718 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-12 13:12:22 +00:00
Sergey Biryukov
81ed194ef0 Coding Standards: Remove unnecessary try/catch block in wp_get_webp_info().
This appears to be redundant, as none of the functions used inside the block throw an exception.

Follow-up to [50810].

See #54728.

git-svn-id: https://develop.svn.wordpress.org/trunk@52717 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-12 13:06:17 +00:00
Sergey Biryukov
d3851cd248 Docs: Improve @return tags for wp_cache_*_multiple() functions:
* `wp_cache_add_multiple()`
* `wp_cache_set_multiple()`
* `wp_cache_get_multiple()`
* `wp_cache_delete_multiple()`

This aims to provide more details about the returned value types.

Follow-up to [52700], [52702], [52703].

See #54729, #54574.

git-svn-id: https://develop.svn.wordpress.org/trunk@52708 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 19:19:57 +00:00
Jonny Harris
deafd1193c Cache: Use wp_cache_*_multiple() in core functions.
Implement the `wp_cache_add_multiple`, `wp_cache_set_multiple` and `wp_cache_delete_multiple` in a number of core functions after they were introduced in [52700]

Props: spacedmonkey, adamsilverstein, flixos90, mitogh.
Fixes: #55029.


git-svn-id: https://develop.svn.wordpress.org/trunk@52707 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 18:50:08 +00:00
Sergey Biryukov
5d7297d031 Cache API: Reorder object cache functions and methods for consistency.
The original order was alphabetical, which became less obvious as newer functions got added, resulting in a somewhat random order.

This commits aims to organize the functions and related `WP_Object_Cache` methods in a more predictable order:

* `wp_cache_init()`
* `wp_cache_add()`
* `wp_cache_add_multiple()`
* `wp_cache_replace()`
* `wp_cache_set()`
* `wp_cache_set_multiple()`
* `wp_cache_get()`
* `wp_cache_get_multiple()`
* `wp_cache_delete()`
* `wp_cache_delete_multiple()`
* `wp_cache_incr()`
* `wp_cache_decr()`
* `wp_cache_flush()`
* `wp_cache_close()`
* `wp_cache_add_global_groups()`
* `wp_cache_add_non_persistent_groups()`
* `wp_cache_switch_to_blog()`
* `wp_cache_reset()`

Follow-up to [3011], [6543], [7986], [13066], [18580], [21403], [47938], [52700], [52703-52705].

See #54728, #54574.

git-svn-id: https://develop.svn.wordpress.org/trunk@52706 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 18:47:38 +00:00
Sergey Biryukov
72cf1aa905 Docs: Correct the suggested alternative for the deprecated wp_cache_reset() function.
While this was previously added and reverted more than once as part of various documentation cleanup efforts, `wp_cache_switch_to_blog()` appears to be the correct alternative for `wp_cache_reset()`, per the latter's DocBlock.

This commit also corrects the `@deprecated` tag for `WP_Object_Cache::reset()` to link to the `::switch_to_blog()` method of the class, instead of the function of the same name.

Follow-up to [13066], [21403], [22111], [33678], [34225], [34226], [40929].

See #54729.

git-svn-id: https://develop.svn.wordpress.org/trunk@52705 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 18:31:48 +00:00
Sergey Biryukov
a9437a6aff Docs: Correct @since tag for wp_cache_reset().
The function was added in WordPress 3.0, not 2.6.

Follow-up to [13066].

See #54729.

git-svn-id: https://develop.svn.wordpress.org/trunk@52704 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 18:03:15 +00:00
Sergey Biryukov
81cd3d58dc Docs: Update DocBlocks for some object cache functions per the documentation standards.
Follow-up to [47060], [47938], [47944], [52700].

See #54729, #54574.

git-svn-id: https://develop.svn.wordpress.org/trunk@52703 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 17:42:51 +00:00
Sergey Biryukov
65f52bf921 Tests: Remove some extra wp_cache_set() calls from wp_cache_set_multiple() test.
These appear to be a copy/paste from the `wp_cache_get_multiple()` test and are not required here.

Follow-up to [47938], [52700].

See #54574.

git-svn-id: https://develop.svn.wordpress.org/trunk@52702 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 17:39:48 +00:00
Sergey Biryukov
13485e11c5 Code Modernization: Use file_get_contents() in wp_get_image_mime().
`file_get_contents()` is faster than `fread()`, because the PHP core can decide how to best read the remaining file; it could decide to issue just one `read()` call or `mmap()` the file first.

Per the PHP manual, `file_get_contents()` or `stream_get_contents()` is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by the OS to enhance performance.

Reference: [https://www.php.net/manual/en/function.file-get-contents.php PHP Manual: file_get_contents()].

Follow-up to [50810], [52696], [52698].

Props maxkellermann.
See #55069.

git-svn-id: https://develop.svn.wordpress.org/trunk@52701 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 15:48:44 +00:00
Jonny Harris
4689322d44 Cache: Add wp_cache_*_multiple functions.
Add new caching functions named `wp_cache_add_multiple`, `wp_cache_set_multiple` and `wp_cache_delete_multiple`. All of these functions allow for an array of data to be passed, so that multiple cache objects can be created / edited / deleted in a single function call. This follows on from [47938] where the `wp_cache_get_multiple` function was introduced and allowed for multiple cache objects to be received in one call. 

Props: spacedmonkey, tillkruess, adamsilverstein, flixos90, mitogh, pbearne. 
Fixes: #54574.


git-svn-id: https://develop.svn.wordpress.org/trunk@52700 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 12:50:54 +00:00
Greg Ziółkowski
af07f6af4b I18n: Standardize the script paths for blocks
When providing file paths to scripts (editorScript, script or viewScript), when there is a trailing ./ included then there was a different md5 generated for the file that didn't match the one used with the file generated in the translations folder.

Props Rahe.
See #54797.



git-svn-id: https://develop.svn.wordpress.org/trunk@52699 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-11 12:12:56 +00:00
Sergey Biryukov
968b3fc5a4 Code Modernization: Use file_get_contents() in get_file_data().
`file_get_contents()` is faster than `fread()`, because the PHP core can decide how to best read the remaining file; it could decide to issue just one `read()` call or `mmap()` the file first.

Per the PHP manual, `file_get_contents()` or `stream_get_contents()` is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by the OS to enhance performance.

Reference: [https://www.php.net/manual/en/function.file-get-contents.php PHP Manual: file_get_contents()].

Follow-up to [12044], [49073], [52696].

Props maxkellermann.
See #55069.

git-svn-id: https://develop.svn.wordpress.org/trunk@52698 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-10 15:01:06 +00:00
Jb Audras
96a1687b91 Query: Check if the theme supports block-templates before calling locate_block_template() in get_query_template().
This change improves performance for classic themes by removing an unnecessary query and fixes an issue where a classic theme would show "Empty template: Index" on the frontend when an empty `(block-)templates/index.html` file exists.

Props johnbillion, ianatkins, Mamaduka, costdev, manfcarlo, dolphingg, audrasjb, madeinua, kapilpaul, rafiahmedd, SergeyBiryukov.
Fixes #54844.


git-svn-id: https://develop.svn.wordpress.org/trunk@52697 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-09 13:20:49 +00:00
Sergey Biryukov
89bcc4843a Code Modernization: Use stream_get_contents() in POMO_FileReader::read_all().
`stream_get_contents()` is faster than `fread()`, because the PHP core can decide how to best read the remaining file; it could decide to issue just one `read()` call or `mmap()` the file first.

Per the PHP manual, `file_get_contents()` or `stream_get_contents()` is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by the OS to enhance performance.

Reference: [https://www.php.net/manual/en/function.file-get-contents.php PHP Manual: file_get_contents()].

Follow-up to [12174].

Props maxkellermann.
See #55069.

git-svn-id: https://develop.svn.wordpress.org/trunk@52696 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-09 12:31:27 +00:00