Sergey Biryukov
aaffa2bcff
General: Remove file_exists() checks after calling realpath().
...
`realpath()` already checks if the file exists, and returns `false` on failure. The additional `file_exists()` check is not necessary and can be removed, improving the performance.
This commit simplifies the checks in two functions:
* `register_block_type_from_metadata()`
* `wp_json_file_decode()`
Note: In both of these cases, the values are passed through `wp_normalize_path()` after `realpath()`, so if the file does not exist, the `false` value gets converted to an empty string. The updated checks work both for `false` and `''` values.
Though this is a small tweak, it saves a lot of checks since one of the places we do this is when registering block styles, so it runs quite a few times on each page load.
Reference: [https://www.php.net/manual/en/function.realpath.php PHP Manual: realpath()].
Follow-up to [51599], [54132], [54290], [54291].
Props aristath.
Fixes #56654 .
Built from https://develop.svn.wordpress.org/trunk@54309
git-svn-id: http://core.svn.wordpress.org/trunk@53868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 13:07:14 +00:00
..
2022-09-23 20:04:13 +00:00
2022-09-26 10:17:11 +00:00
2022-09-21 20:57:12 +00:00
2022-09-20 15:43:29 +00:00
2022-09-12 15:47:14 +00:00
2022-09-23 20:04:13 +00:00
2022-08-22 12:26:12 +00:00
2022-09-12 17:52:08 +00:00
2022-09-22 11:33:13 +00:00
2022-09-12 15:47:14 +00:00
2022-09-14 00:13:14 +00:00
2022-09-14 12:48:16 +00:00
2022-09-20 10:31:14 +00:00
2022-08-13 22:44:09 +00:00
2022-09-20 16:26:10 +00:00
2022-09-23 14:00:09 +00:00
2022-09-20 16:29:12 +00:00
2022-09-21 15:45:12 +00:00
2022-09-20 10:31:14 +00:00
2022-09-26 13:07:14 +00:00
2022-06-23 22:57:12 +00:00
2022-08-30 15:17:08 +00:00
2022-07-23 14:58:12 +00:00
2022-07-23 14:58:12 +00:00
2022-09-20 15:45:49 +00:00
2022-08-19 23:06:09 +00:00
2022-08-04 14:52:11 +00:00
2022-06-17 11:20:13 +00:00
2022-08-31 13:41:08 +00:00
2022-06-17 11:20:13 +00:00
2022-09-15 12:32:08 +00:00
2022-05-01 22:01:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 15:43:29 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-19 19:51:09 +00:00
2022-09-14 10:52:08 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 21:50:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 14:17:12 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 10:31:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-19 22:53:10 +00:00
2022-09-19 22:53:10 +00:00
2022-09-20 16:59:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 14:26:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 11:57:20 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-19 20:49:10 +00:00
2022-09-20 14:17:12 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 14:17:12 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 13:13:21 +00:00
2022-09-23 21:31:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-26 10:17:11 +00:00
2022-09-20 01:36:09 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 13:12:10 +00:00
2022-09-20 02:51:09 +00:00
2022-09-20 14:17:12 +00:00
2022-09-20 14:17:12 +00:00
2022-09-20 14:17:12 +00:00
2022-09-12 17:52:08 +00:00
2022-08-26 01:03:14 +00:00
2022-05-08 00:29:14 +00:00
2022-09-20 20:32:09 +00:00
2022-06-17 11:20:13 +00:00
2022-09-20 01:36:09 +00:00
2022-09-21 15:06:12 +00:00
2022-09-21 19:48:13 +00:00
2022-06-17 11:20:13 +00:00
2022-08-19 22:06:09 +00:00
2022-04-29 19:17:11 +00:00
2022-06-20 21:46:16 +00:00
2022-09-20 14:17:12 +00:00
2022-09-26 13:07:14 +00:00
2022-09-22 09:26:15 +00:00
2022-09-14 18:44:09 +00:00
2022-09-14 13:08:14 +00:00
2022-08-11 14:11:08 +00:00
2022-09-15 13:29:13 +00:00
2022-09-19 19:51:09 +00:00
2022-09-13 18:05:09 +00:00
2022-09-20 15:45:49 +00:00
2022-09-20 04:02:10 +00:00
2022-09-20 10:31:14 +00:00
2022-08-11 14:03:09 +00:00
2022-09-06 11:28:13 +00:00
2022-07-14 13:35:13 +00:00
2022-09-20 02:51:09 +00:00
2022-09-21 19:48:13 +00:00
2022-09-20 02:51:09 +00:00
2022-05-13 12:21:13 +00:00
2022-09-06 11:28:13 +00:00
2022-08-26 01:03:14 +00:00
2022-06-15 13:37:10 +00:00
2022-09-20 20:32:09 +00:00
2022-09-21 20:24:12 +00:00
2022-08-01 11:15:14 +00:00
2022-09-21 20:24:12 +00:00
2022-09-21 20:24:12 +00:00
2022-06-21 13:34:13 +00:00
2022-08-11 14:03:09 +00:00
2022-08-11 14:03:09 +00:00
2022-08-07 23:05:10 +00:00
2022-09-23 08:27:12 +00:00
2022-09-20 10:31:14 +00:00
2022-09-14 12:48:16 +00:00
2022-09-20 18:53:09 +00:00
2022-09-21 01:09:10 +00:00
2022-09-21 11:43:13 +00:00
2022-05-02 13:13:08 +00:00
2022-09-14 18:44:09 +00:00
2022-09-15 12:20:09 +00:00
2022-09-22 11:13:14 +00:00
2022-09-20 16:26:10 +00:00
2022-09-26 13:07:14 +00:00
2022-06-01 18:14:10 +00:00
2022-07-21 22:45:11 +00:00