`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.
Built from https://develop.svn.wordpress.org/trunk@52698
git-svn-id: http://core.svn.wordpress.org/trunk@52287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@52697
git-svn-id: http://core.svn.wordpress.org/trunk@52286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`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.
Built from https://develop.svn.wordpress.org/trunk@52696
git-svn-id: http://core.svn.wordpress.org/trunk@52285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevent the transient setters and getters from attempting to use the database table before they exist during the installation process.
During installation transients now use the `wp_cache_*()` functions on all sites, including those without a persistent cache, to prevent database errors. The use of the caching functions stores the data in memory for the duration of the request to account for transient data that is used multiple times during installation.
Props dd32, audrasjb, tnolte, antonvlasenko, noisysocks, peterwilsoncc.
Fixes#54849.
Built from https://develop.svn.wordpress.org/trunk@52694
git-svn-id: http://core.svn.wordpress.org/trunk@52283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This makes it easier to determine in a callback function whether this is an existing post being updated or not.
Follow-up to [8635], [8702], [27130], [27138], [28106], [28788], [47633].
Props nhadsall, mukesh27.
Fixes#46228.
Built from https://develop.svn.wordpress.org/trunk@52691
git-svn-id: http://core.svn.wordpress.org/trunk@52280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit makes the presets provided by the theme via add_theme_support always create CSS Custom Properties, whether or not the theme has a theme.json file. This way, if the overwrites a core preset, the core CSS variables are also overwritten and use the theme value.
Props oandregal, hellofromTonya, desrosj, costdev, pbearne, johnstonphilip, webmandesign.
Fixes#54782.
Built from https://develop.svn.wordpress.org/trunk@52675
git-svn-id: http://core.svn.wordpress.org/trunk@52264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Remove the one day expiry limitation from query caches found in the `WP_Term_Qurery` class. Removing this limitation means that the caches will remain in object caching, as long as possible. Ensure that all term / taxonomy cache clear functions invalidate query caches, by deleting the last_changed value in the terms cache group.
Props spacedmonkey, adamsilverstein, boonebgorges, tillkruess, dlh, flixos90.
Fixes#54511.
Built from https://develop.svn.wordpress.org/trunk@52669
git-svn-id: http://core.svn.wordpress.org/trunk@52258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [52158] the standard post type UI was added back for templates and template parts, because these features had been temporarily removed from the site editor in the rush to get 5.9 ready for December. Since 5.9 these features were properly added back to the site editor, the `show_ui` values for these post types should be returned back to `false`.
Follow-up to [52158].
Props manfcarlo, audrasjb.
Fixes#54908.
Built from https://develop.svn.wordpress.org/trunk@52668
git-svn-id: http://core.svn.wordpress.org/trunk@52257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In `update_post_meta` and `delete_post_meta`, code was added to fetch the parent post if these functions were called for a revision post ID. In [9252], the code was apparently copied from `add_post_meta`, and the inline comment describing the new block of code was not updated to mention either "updated" or "deleted" respectively. This change corrects the comment in both functions to reflect the current action instead of "added".
Props thelovekesh, rehanali.
Fixes#54835.
Built from https://develop.svn.wordpress.org/trunk@52660
git-svn-id: http://core.svn.wordpress.org/trunk@52249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `link_updated` field is unused as of WordPress 3.0 and was never updated via `wp_insert_link()`, only via the `wp-admin/update-links.php` file removed in [13744].
Follow-up to [13744], [49487].
Props dshanske, dharm1025, SergeyBiryukov.
Fixes#54880.
Built from https://develop.svn.wordpress.org/trunk@52659
git-svn-id: http://core.svn.wordpress.org/trunk@52248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The NPM package for jQuery Color was updated in [50543], but a bundled version still existed within core.
This removes that bundled version, in favor of expanding the Grunt build steps to include the package from NPM instead.
Fixes#55016. See #51405.
Built from https://develop.svn.wordpress.org/trunk@52657
git-svn-id: http://core.svn.wordpress.org/trunk@52246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
An unvisited site may have an undefined cron array, resulting in `_get_cron_array()` returning the value `false`. Previously this would trigger warning in `upgrade_590()` as the function assumed `_get_cron_array()` would alway return an array.
No database version change is required as the upgrade routine was successful on sites with a cron array during 5.9.0. On sites without a cron array, the error has already been thrown if they are running db version 51917. This fix is only required for new sites or those upgrading that have skipped 5.9.0.
Follow up to [51917].
Props chrisvanpatten, kapilpaul, SergeyBiryukov.
Fixes#54906.
See #53940.
Built from https://develop.svn.wordpress.org/trunk@52656
git-svn-id: http://core.svn.wordpress.org/trunk@52245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `user_url` database field only allows up to 100 characters, and if the value is longer than that, the function should return a proper error message instead of silently failing.
This complements similar checks for `user_login` and `user_nicename` fields.
Follow-up to [45], [1575], [32299], [34218], [34626].
Props mkox, sabernhardt, tszming, SergeyBiryukov.
Fixes#44107.
Built from https://develop.svn.wordpress.org/trunk@52650
git-svn-id: http://core.svn.wordpress.org/trunk@52239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that the preview ratio remains accurate for the user's screen size when the sidebar is open.
Follow-up to [19995], [20110], [20133], [20138], [28033].
Props shreyasikhar26, costdev, sumitsingh, SergeyBiryukov.
Fixes#54764.
Built from https://develop.svn.wordpress.org/trunk@52647
git-svn-id: http://core.svn.wordpress.org/trunk@52236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Before this changeset, `translation_api` and `translation_api_result` filters were incorrectly marked as taking object as their first argument. The correct type is an array as `json_decode()` is asked to return an associative array.
Props volodymyrkolesnykov.
Fixes#54959.
Built from https://develop.svn.wordpress.org/trunk@52645
git-svn-id: http://core.svn.wordpress.org/trunk@52234 1a063a9b-81f0-0310-95a4-ce76da25c4cd