Commit Graph

36 Commits

Author SHA1 Message Date
Sergey Biryukov
53e90faeeb Code Modernization: Rename parameters that use reserved keywords in wp-includes/ms-site.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$public` parameter to `$is_public` in `wp_update_blog_public_option_on_site_update()`.
* Amends the `$value` parameter of the `update_blog_public` filter for consistency.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@54947


git-svn-id: http://core.svn.wordpress.org/trunk@54499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-07 21:19:19 +00:00
Peter Wilson
ba9dd1d7d7 Cache API, Docs: Remove private delegation from cache priming functions.
Remove the private delegation from the following cache priming functions for various object types:

- `_prime_post_caches()`
- `_prime_term_caches()`
- `_prime_comment_caches()`
- `_prime_network_caches()`
- `_prime_site_caches()`
- `_get_non_cached_ids() `

Plugins and themes are now encouraged to use these functions to improve the performance of their code by reducing the number of database queries.

Props robinwpdeveloper, desrosj, SergeyBiryukov, mukesh27, costdev.
Fixes #56386.


Built from https://develop.svn.wordpress.org/trunk@53944


git-svn-id: http://core.svn.wordpress.org/trunk@53503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-26 01:03:14 +00:00
desrosj
a81704ed5f Docs: Correct typo in wp_maybe_clean_new_site_cache_on_update() parameter description.
Props kebbet.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53939


git-svn-id: http://core.svn.wordpress.org/trunk@53498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-24 15:26:12 +00:00
Sergey Biryukov
d71c435a82 Docs: Update the DocBlock for the wpmu_new_blog action to suggest wp_initialize_site as an alternative.
Follow-up to [43654], [52816].

See #49612.
Built from https://develop.svn.wordpress.org/trunk@52817


git-svn-id: http://core.svn.wordpress.org/trunk@52406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-03 16:13:03 +00:00
Sergey Biryukov
b009374817 Networks and Sites: Suggest wp_initialize_site as an alternative for the deprecated wpmu_new_blog action.
The previously suggested alternative, `wp_insert_site`, does not get passed enough arguments and runs before the new site initialization routine is actually executed.

Follow-up to [43654].

Props asaquzzaman, henry.wright, MadtownLems.
Fixes #49612.
Built from https://develop.svn.wordpress.org/trunk@52816


git-svn-id: http://core.svn.wordpress.org/trunk@52405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-03 15:58:03 +00:00
spacedmonkey
a4026420cc 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.

Built from https://develop.svn.wordpress.org/trunk@52707


git-svn-id: http://core.svn.wordpress.org/trunk@52296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 18:51:59 +00:00
John Blackbourn
40626108d0 Docs: Corrections relating to types used in inline documentation for comment ID and site ID proprties.
Includes a correction for a typo introduced in [52204].

See #53399

Built from https://develop.svn.wordpress.org/trunk@52205


git-svn-id: http://core.svn.wordpress.org/trunk@51797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-18 13:57:01 +00:00
Sergey Biryukov
6c01c2a864 Docs: Add a reference to WP_Site_Query::__construct() for information on accepted arguments in get_sites().
Synchronize the documentation between two places, use `WP_Site_Query::__construct()` as the canonical source.

Follow-up to [37616].

Props birgire, felipeelia, audrasjb.
Fixes #42156.
Built from https://develop.svn.wordpress.org/trunk@51184


git-svn-id: http://core.svn.wordpress.org/trunk@50793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-19 20:57:01 +00:00
davidbaumwald
133c4e2e50 Docs: Clarify return results for a non-existing ID in metadata functions.
[48658] documented that various metadata functions return false for an invalid ID. However, that does not clarify what an invalid ID is: a non-numeric, zero, or negative value. This change adds the clarification in all relevant metadata function docblocks.

Props icopydoc, SergeyBiryukov, davidkryzaniak, audrasjb.
Fixes #51797.
Built from https://develop.svn.wordpress.org/trunk@50641


git-svn-id: http://core.svn.wordpress.org/trunk@50253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-02 15:49:05 +00:00
John Blackbourn
dfe1f9b322 Docs: Promote many bool types to true or false where only that value is used.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49927


git-svn-id: http://core.svn.wordpress.org/trunk@49626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 22:04:04 +00:00
John Blackbourn
f4cda1b62f Docs: Upgrade more parameters in docblocks to used typed array notation.
See #51800, #41756

Built from https://develop.svn.wordpress.org/trunk@49693


git-svn-id: http://core.svn.wordpress.org/trunk@49416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-24 21:27:05 +00:00
John Blackbourn
35f6c356c1 Docs: Document parameters that accept an array of integers using typed array notation.
While many of these parameters also technically accept an array of numerical strings, they are all ultimately cast to an array of integers. Documenting them as such assists developers in understanding the expected types.

See #51800, #41756

Built from https://develop.svn.wordpress.org/trunk@49672


git-svn-id: http://core.svn.wordpress.org/trunk@49395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-19 18:24:09 +00:00
John Blackbourn
170ca32007 Docs: Various docblock corrections and improvements.
See #50768

Built from https://develop.svn.wordpress.org/trunk@49597


git-svn-id: http://core.svn.wordpress.org/trunk@49335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-14 16:35:06 +00:00
Sergey Biryukov
0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
Sergey Biryukov
5f6d6a79e8 Docs: Document that various metadata functions return false for an invalid ID.
Props salcode.
See #40519.
Built from https://develop.svn.wordpress.org/trunk@48658


git-svn-id: http://core.svn.wordpress.org/trunk@48420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-28 10:15:04 +00:00
Sergey Biryukov
347e831768 Docs: Improve documentation for the $prev_value parameter and return result of various metadata update functions.
Props stevenlinx.
Fixes #50502. See #49572.
Built from https://develop.svn.wordpress.org/trunk@48214


git-svn-id: http://core.svn.wordpress.org/trunk@47983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-29 21:22:09 +00:00
Sergey Biryukov
d38a32bfac Coding Standards: Reformat some long apply_filters_deprecated() and do_action_deprecated() calls for better readability.
See #49542.
Built from https://develop.svn.wordpress.org/trunk@48167


git-svn-id: http://core.svn.wordpress.org/trunk@47936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-25 12:06:07 +00:00
desrosj
4b60af1a6a General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).

Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.

Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.

Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.
Built from https://develop.svn.wordpress.org/trunk@48121


git-svn-id: http://core.svn.wordpress.org/trunk@47890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-22 17:26:13 +00:00
Sergey Biryukov
e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
Sergey Biryukov
bbdfffdaa1 Networks and Sites: Ensure the site ID in wp_insert_site() is still correct after calling clean_blog_cache().
By saving `$wpdb->insert_id` to a variable, we make sure the ID does not change if another database insert is performed on the `clean_site_cache` action.

Props trepmal.
Fixes #50324.
Built from https://develop.svn.wordpress.org/trunk@47932


git-svn-id: http://core.svn.wordpress.org/trunk@47705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-09 12:41:09 +00:00
Sergey Biryukov
427405535f Docs: Synchronize parameter documentation for various metadata functions, update per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@47611


git-svn-id: http://core.svn.wordpress.org/trunk@47386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-22 10:31:09 +00:00
Sergey Biryukov
9aa0fff80e Docs: Document the default value of $single and $prev_value parameters in various metadata functions.
Props denisco.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@47610


git-svn-id: http://core.svn.wordpress.org/trunk@47385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-22 09:40:10 +00:00
Sergey Biryukov
47ed56f38f Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.
Built from https://develop.svn.wordpress.org/trunk@47198


git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 06:33:11 +00:00
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov
c3f9af4f00 Docs: Adjust documentation for some pre_* filters for consistency.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47101


git-svn-id: http://core.svn.wordpress.org/trunk@46901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-22 00:25:04 +00:00
Sergey Biryukov
5f6a36ceb6 Networks and Sites: Remove invalidation of unused cache keys in clean_blog_cache().
Props spacedmonkey, flixos90, thamaraiselvam.
Fixes #40363.
Built from https://develop.svn.wordpress.org/trunk@46990


git-svn-id: http://core.svn.wordpress.org/trunk@46790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 02:59:02 +00:00
Sergey Biryukov
1f816ad18d Docs: Use the {@see ...} tag for the replacement in @deprecated tags, so that Developer Reference could automatically link to the replacement.
Props jrf.
See #48255.
Built from https://develop.svn.wordpress.org/trunk@46685


git-svn-id: http://core.svn.wordpress.org/trunk@46485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-09 13:05:02 +00:00
Sergey Biryukov
e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Felix Arntz
90c424f73b Multisite: Improve performance by caching not found lookups for sites and networks.
With this change, the result of a site or network lookup by ID will be cached even if the ID does not exist. When a new site or network is created, the cache for the respective new ID is cleared.

Props mnelson4, nielsdeblaauw.
Fixes #42251.

Built from https://develop.svn.wordpress.org/trunk@45910


git-svn-id: http://core.svn.wordpress.org/trunk@45721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-29 12:42:56 +00:00
Jeremy Felt
7ec74901d3 Docs: Add arguments passed by wp_insert_site() to wp_initialize_site().
Props codemascot.
Fixes #45061.

Built from https://develop.svn.wordpress.org/trunk@45236


git-svn-id: http://core.svn.wordpress.org/trunk@45045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-17 20:57:52 +00:00
Felix Arntz
0607371f84 Multisite: Ensure site meta caches are not primed unless the wp_blogmeta table is available.
Prior to this change, querying sites early in the bootstrap process could potentially cause a fatal error, since at that stage the filter to bail on updating site meta cache if the respective database table has not been installed yet is not hooked in yet. This changeset forces the filter to be added if that is not already the case.

Props spacedmonkey.
Fixes #46167.

Built from https://develop.svn.wordpress.org/trunk@44925


git-svn-id: http://core.svn.wordpress.org/trunk@44756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-18 15:49:00 +00:00
Jeremy Felt
6969fb8001 Multisite: Fix code formatting errors from r44805
See #46351.

Built from https://develop.svn.wordpress.org/trunk@44806


git-svn-id: http://core.svn.wordpress.org/trunk@44638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-07 03:46:50 +00:00
Jeremy Felt
446f60d2d0 Multisite: Ensure wpmu_new_blog hook receives expected data in $meta.
Restores `public`, `archived`, `mature`, `spam`, `deleted`, `lang_id`, and `WPLANG` to the `$meta` data passed to `wpmu_new_blog`. This hook was deprecated in 5.1.0, but code using it still relies on this data.

Props david.binda, pbiron.
Fixes #46351.

Built from https://develop.svn.wordpress.org/trunk@44805


git-svn-id: http://core.svn.wordpress.org/trunk@44637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-07 03:34:51 +00:00
Sergey Biryukov
41ef077491 Networks and Sites: Check the result of get_site() in wp_insert_site().
Props davidbinda, vanyukov, lukecarbis.
Fixes #46300.
Built from https://develop.svn.wordpress.org/trunk@44799


git-svn-id: http://core.svn.wordpress.org/trunk@44631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-05 20:35:52 +00:00
Gary Pendergast
c2c021baf1 Multisite: After creating a new blog, ensure the blog cache is correctly cleaned up.
Props david.binda, spacedmonkey.
Fixes #46125.


Built from https://develop.svn.wordpress.org/trunk@44727


git-svn-id: http://core.svn.wordpress.org/trunk@44558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-02-07 06:04:51 +00:00
Felix Arntz
ea9286844f Multisite: Introduce ms-site.php and ms-network.php files.
By providing distinct files for the site and network APIs, a better overview is provided. Prior to this change, the `ms-blogs.php` file had grown too big, mixing site APIs, network APIs and related legacy APIs that need to be maintained. Since multisite is often used in unexpected ways, backward-compatibility is ensured by including the two new files from `ms-blogs.php`, which previously contained all functions that have been moved to the new files.

This changeset does not contain any functional changes.

Fixes #40647.

Built from https://develop.svn.wordpress.org/trunk@44472


git-svn-id: http://core.svn.wordpress.org/trunk@44303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 09:15:49 +00:00