Commit Graph

8141 Commits

Author SHA1 Message Date
joedolson
67779da49f Widgets: Use a text-based button to select location.
The WordPress Events and News widget used an icon-only button to select a location. The Pencil icon alone provided insufficient context and labeling for accessibility. Add text to clearly describe button action and change icon to represent a location marker. 

Props AmethystAnswers, sabernhardt.
Fixes #53311.
Built from https://develop.svn.wordpress.org/trunk@51971


git-svn-id: http://core.svn.wordpress.org/trunk@51560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-01 22:54:57 +00:00
John Blackbourn
c274d3c520 Docs: Miscellaneous docblock improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-30 20:17:01 +00:00
Sergey Biryukov
4459eaf392 Docs: Further update the debug_information filter description per the documentation standards.
Specifically, this ensures that the DocBlock follows the line wrapping recommendations.

Follow-up to [44986], [45156], [45259], [51949].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51956


git-svn-id: http://core.svn.wordpress.org/trunk@51545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-30 13:41:02 +00:00
John Blackbourn
6babc3833b Docs: Miscellaneous docblock improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-29 23:13:05 +00:00
Sergey Biryukov
0e2f9ad5b6 Coding Standards: Correct alignment in WP_Site_Health::get_test_update_temp_backup_writable().
This fixes an `Equals sign not aligned with surrounding assignments; expected 1 space but found 6 spaces` WPCS warning.

Follow-up to [51815].

See #51857, #53359.
Built from https://develop.svn.wordpress.org/trunk@51951


git-svn-id: http://core.svn.wordpress.org/trunk@51540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-29 16:52:57 +00:00
John Blackbourn
a0d8a60547 Site Health: Correct and improve the documentation for the debug_information hook.
This corrects the structure of the documentation so it accurately reflects the array elements contained within.

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-29 15:35:00 +00:00
Pascal Birchler
a225165010 Role/Capability: Add support for capability queries in WP_User_Query.
Similar to the existing `role`/`role__in`/`role__not_in` query arguments, this adds support for three new query arguments in `WP_User_Query`:

* `capability` 
* `capability__in`
* `capability__not_in`

These can be used to fetch users with (or without) a specific set of capabilities, for example to get all users
with the capability to edit a certain post type.

Under the hood, this will check all existing roles on the site and perform a `LIKE` query against the `capabilities` user meta field to find:

* all users with a role that has this capability
* all users with the capability being assigned directly

Note: In WordPress, not all capabilities are stored in the database. Capabilities can also be modified using filters like `map_meta_cap`. These new query arguments do NOT work for such capabilities.

The prime use case for capability queries is to get all "authors", i.e. users with the capability to edit a certain post type.

Until now, `'who' => 'authors'` was used for this, which relies on user levels. However, user levels were deprecated a long time ago and thus never added to custom roles. This led to constant frustration due to users with custom roles missing from places like author dropdowns.

This updates any usage of `'who' => 'authors'` in core to use capability queries instead.

Subsequently, `'who' => 'authors'` queries are being **deprecated** in favor of these new query arguments.

Also adds a new `capabilities` parameter (mapping to `capability__in` in `WP_User_Query`) to the REST API users controller.

Also updates `twentyfourteen_list_authors()` in Twenty Fourteen to make use of this new functionality, adding a new `twentyfourteen_list_authors_query_args` filter to make it easier to override this behavior.

Props scribu, lgladdly, boonebgorges, spacedmonkey, peterwilsoncc, SergeyBiryukov, swissspidy.
Fixes #16841.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-27 18:43:57 +00:00
johnjamesjacoby
7a0a07d691 Admin/HTTP API: add suggested filename support to download_url().
This change allows for external clients to supply a suggested filename via a `Content-Disposition` response header. This filename is processed through `sanitize_file_name()` to ensure it is allowable (on the server, MIME's, etc...) and `validate_file()` to prevent directory traversal.

If the suggested filename fails the above processing/checks, that suggestion is discarded and the standard temporary filename (generated by WordPress) is used.

If no `Content-Disposition` header is found in the response headers, the standard temporary filename continues to be used as per normal.

Included in this change are 6 additional PHPUnit tests with 9 assertions. These tests confirm that valid filename values are correctly saved, and invalid filename values are correctly rejected.

Props cklosows, costdev, dd32, johnjamesjacoby, ocean90, psrpinto.

Fixes #38231.
Built from https://develop.svn.wordpress.org/trunk@51939


git-svn-id: http://core.svn.wordpress.org/trunk@51528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-27 15:00:01 +00:00
Sergey Biryukov
2c84d63322 Help/About: Don't output empty <span> tags on Credits screen.
If the contributor does not have a title, the empty tags are not necessary.

Follow-up to [17877], [17909], [17942], [18162], [19143], [46709].

Props sayedulsayem, audrasjb, mukesh27.
Fixes #54275.
Built from https://develop.svn.wordpress.org/trunk@51920


git-svn-id: http://core.svn.wordpress.org/trunk@51513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-19 23:09:00 +00:00
hellofromTonya
234877c9c3 Coding Standards: Add public visibility to methods in src directory.
This commit adds the `public` visibility keyword to each method which did not have an explicit visibility keyword.

Why `public`?

With no visibility previously declared, these methods are implicitly `public` and available for use. Changing them to anything else would be a backwards-compatibility break.

Props costdev, jrf.
See #54177.
Built from https://develop.svn.wordpress.org/trunk@51919


git-svn-id: http://core.svn.wordpress.org/trunk@51512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-18 17:52:58 +00:00
hellofromTonya
db3a05178b Cron: Remove errant false values in cron array when upgrading to 5.9+.
[51916] fixed a bug where `array( `false` )` was added to the cron array when `_get_cron_array()` returned `false`. 

This commit:
* Removes any `false` values from the cron array when upgrading to 5.9+.
* Bumps the database version.

Follow-up to [44917], [51916].

Props peterwilsoncc, jrf.
See #53950.
Built from https://develop.svn.wordpress.org/trunk@51917


git-svn-id: http://core.svn.wordpress.org/trunk@51510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-18 13:30:57 +00:00
Sergey Biryukov
1020306fe9 I18N: Add context for some Media Library filter strings:
* Audio
* Video
* Unattached

This allows for more homogeneous translations in languages where keeping a plural form is important.

Follow-up to [6910], [7397], [8901], [9556], [11749], [13100], [12110], [15491], [15578], [22743], [29426], [29625], [34256], [45651], [46437].

Props jdy68, audrasjb, SergeyBiryukov.
Fixes #54238.
Built from https://develop.svn.wordpress.org/trunk@51903


git-svn-id: http://core.svn.wordpress.org/trunk@51496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-12 16:44:01 +00:00
Sergey Biryukov
2030b6e313 Upgrade/Install: Restore or clean up the temporary plugin or theme backup on shutdown.
This allows these actions to run ''after'' the main process, without affecting the update. Actions running on `shutdown` are immune to PHP timeouts, so in case the failure was due to a PHP timeout, we'll still be able to properly restore the previous version.

Follow-up to [51815], [51898], [51899].

Props aristath, peterwilsoncc.
See #54166.
Built from https://develop.svn.wordpress.org/trunk@51902


git-svn-id: http://core.svn.wordpress.org/trunk@51495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-11 15:09:05 +00:00
Sergey Biryukov
d5887aeec3 Upgrade/Install: Introduce a move_dir() function.
This replaces the `copy_dir()` usage in `WP_Upgrader::install_package()` and aims to avoid PHP timeout issues when installing or updating large plugins on slower systems like Vagrant or the WP Docker test environment.

The new function attempts a native PHP `rename()` function first and falls back to the previous `copy_dir()`.

Follow-up to [51815], [51898].

Props afragen, aristath, peterwilsoncc, galbaras, noisysocks, pbiron.
Fixes #54166. See #51857.
Built from https://develop.svn.wordpress.org/trunk@51899


git-svn-id: http://core.svn.wordpress.org/trunk@51492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-09 03:38:57 +00:00
Sergey Biryukov
0f2d2264b5 Site Health: Use an integer value as a fallback in the available disk space check.
This avoids a few type problems further in the code: boolean divided by a number, or passing `false` to `size_format()` which is documented to accept integers or strings only.

Follow-up to [51815].

Props TobiasBg.
See #51857.
Built from https://develop.svn.wordpress.org/trunk@51898


git-svn-id: http://core.svn.wordpress.org/trunk@51491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-09 02:50:56 +00:00
Sergey Biryukov
c477dcda88 Taxonomy: Populate the WP_Terms_List_Table::$items property in ::prepare_items().
This allows the parent `WP_List_Table::has_items()` method to work as expected, and the override in the child class can now be removed. It also makes the class more consistent with other list table classes.

As a result of this change, the "Bulk actions" dropdown is no longer unnecessarily displayed if there are no terms.

Follow-up to [15491], [17025], [17026].

Props mattoakley, swissspidy, audrasjb, SergeyBiryukov.
Fixes #54181.
Built from https://develop.svn.wordpress.org/trunk@51896


git-svn-id: http://core.svn.wordpress.org/trunk@51489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-08 00:38:00 +00:00
hellofromTonya
b3c6ad3a6b Administration: Enable first and last page buttons in WP_List_Table::pagination().
Previously the first and last page pagination buttons were disabled when on their next or previous page respectively. This commit removes that unnecessary logic to keep these buttons enabled and avoid confusion in the user's navigation workflow. 

New behavior:
- When on page 2, the go to first page `«` button is enabled
- When on the page before the last page, the go to last page `»` button is enabled

Follow-up to [32948], [47219].

Props wp_kc, ronakganatra, knutsp, sabernhardt, Hareesh Pillai, audrasjb, hellofromTonya.
Fixes #42763.
Built from https://develop.svn.wordpress.org/trunk@51880


git-svn-id: http://core.svn.wordpress.org/trunk@51473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-01 18:39:58 +00:00
Sergey Biryukov
8c52bfe712 Coding Standards: Remove duplicate assignment from a ternary operator in WP_MS_Sites_List_Table::site_states().
Adjust similar code in `_post_states()` and `_media_states()` for consistency.

Follow-up to:
* [12897], [15491], [32755], [46153], [48424] for `WP_MS_Sites_List_Table::site_states()`.
* [17793], [47775], [49223] for `_media_states()`.
* [9153], [46309] for `_post_states()`.

Props joelcj91, audrasjb, desrosj.
Fixes #38296.
Built from https://develop.svn.wordpress.org/trunk@51873


git-svn-id: http://core.svn.wordpress.org/trunk@51466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-27 00:37:01 +00:00
whyisjake
f2d1e16f50 Posts, Post Types: Don't add a trailing number when there is a unique post parent.
WordPress tries to avoid an issue where slugs might match an existing slug of a page/post. 
If we are in a hierarchical post type, there will be a level, and we can leave it the same.

Props stormrockwell, SergeyBiryukov, terriann, tubys, jeremyfelt, Daschmi, MaximeCulea, knutsp, whyisjake.
Fixes #51147.
See also #44112 and #45260.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-23 20:27:58 +00:00
Sergey Biryukov
052b00b0c4 Docs: Fix typo in the $clear_working parameter description in WP_Upgrader methods.
Follow-up to [30758], [51527].

Props zenithcity, aezazshekh, pbiron, mukesh27.
Fixes #54163.
Built from https://develop.svn.wordpress.org/trunk@51854


git-svn-id: http://core.svn.wordpress.org/trunk@51453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-23 14:23:01 +00:00
John Blackbourn
07f3c35467 General: Fix code quality issues which were identified by static analysis.
This fixes minor issues that could cause PHP notices under the right conditions, and fixes some general incorrectness.

Props jrf, hellofromTonya for review

See #52217

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


git-svn-id: http://core.svn.wordpress.org/trunk@51449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-22 21:01:00 +00:00
John Blackbourn
ae9eae8f64 Docs: Document some more common names for dynamic hooks and standardise the phrasing used.
Fixes #53581

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


git-svn-id: http://core.svn.wordpress.org/trunk@51444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-21 18:21:00 +00:00
johnjamesjacoby
79c59fa78c Docs: Remove deprecated option groups from register_setting() and add_option_update_handler().
* `misc` was deprecated in version 3.0.0.
* `privacy` was deprecated in version 3.5.0.

See #53399.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-20 16:20:00 +00:00
Sergey Biryukov
dcca93232b Upgrade/Install: Create a temporary backup of plugins and themes before updating.
This aims to make the update process more reliable and ensures that if a plugin or theme update fails, the previous version can be safely restored.

* When updating a plugin or theme, the old version is moved to a temporary backup directory:
 * `wp-content/upgrade/temp-backup/plugins/[plugin-slug]` for plugins
 * `wp-content/upgrade/temp-backup/themes/[theme-slug]` for themes.

* If the update fails, then the temporary backup kept in the `upgrade/temp-backup` directory is restored to its original location.
* If the update succeeds, the temporary backup is deleted.

To further help troubleshoot plugin and theme updates, two new checks were added to the Site Health screen:
* A check to make sure that the `temp-backup` directory is writable.
* A check that there is enough disk space available to safely perform updates.

To avoid confusion: The `temp-backup` directory will NOT be used to "roll back" a plugin to a previous version after a completed update. This directory will simply contain a transient backup of the previous version of a plugin or theme being updated, and as soon as the update process finishes, the directory will be empty.

Props aristath, afragen, pbiron, dd32, poena, TimothyBlynJacobs, audrasjb, mikeschroder, a2hosting, hellofromTonya, KZeni, galbaras, richards1052, Boniu91, mai21, francina, SergeyBiryukov.
See #51857.
Built from https://develop.svn.wordpress.org/trunk@51815


git-svn-id: http://core.svn.wordpress.org/trunk@51422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-15 18:41:00 +00:00
Sergey Biryukov
65ff35bb75 Site Health: Move the Imagick entry higher in the list of recommended PHP extensions.
This better matches its position in the [https://make.wordpress.org/hosting/handbook/server-environment/#php-extensions Hosting Team's handbook] recommendations.

Follow-up to [44986], [46268], [51804].

See #52654.
Built from https://develop.svn.wordpress.org/trunk@51805


git-svn-id: http://core.svn.wordpress.org/trunk@51412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-12 10:09:57 +00:00
Sergey Biryukov
e76b896881 Site Health: Add Intl to the list of recommended PHP extensions.
**Why is the PHP Intl extension important?**

WordPress is a global, international software, with support for a multitude of languages and with infinite combinations. Approximately half of the installations are in a language that is not the default (English), and this leads us to think about localization, transliteration, encoding conversions, calendar operations, collation… in short, everything you have with the different languages and formats that are around the planet. And this is what the [https://www.php.net/manual/en/intro.intl.php PHP Intl extension] provides.

**What do we as the WordPress Community gain from this extension?**

This extension provides a lot of functions for better internationalization support, including but not limited to:
* [https://www.php.net/manual/en/collator.compare.php collator_compare()] to compare Unicode text strings
* [https://www.php.net/manual/en/numberformatter.format.php numfmt_format()] to format a number according to the selected locale
* the [https://www.php.net/manual/en/normalizer.normalize.php normalization] of characters
* the [https://www.php.net/manual/en/messageformatter.formatmessage.php formatting] of messages
* getting the [https://www.php.net/manual/en/intlcalendar.getfirstdayofweek.php first day of the week] according to the locale.


In addition to functionality and ease of development, the extension can also help improve security, with classes like `Spoofchecker` that can tell you [https://www.php.net/manual/en/spoofchecker.areconfusable.php if ‘google.com’, ‘goog1e.com’ can confuse the user], or functions related to Internet domains, both to convert an [https://www.php.net/manual/en/function.idn-to-ascii.php IDN domain to text] and [https://www.php.net/manual/en/function.idn-to-utf8.php text to IDN].

**Hosting Team Recommendation**

Taking into account that WordPress continues to grow, the Hosting Team has considered a good recommendation, but not an obligation, for all hosts that work with WordPress to offer this extension, by default, to all users.

Reference: [https://make.wordpress.org/hosting/2021/05/20/why-hosters-should-install-the-php-intl-extension/ Why hosters should install the PHP-intl extension].

Follow-up to [44986], [46268].

Props zodiac1978, JavierCasares, jrf, Clorith, josklever.
Fixes #52654.
Built from https://develop.svn.wordpress.org/trunk@51804


git-svn-id: http://core.svn.wordpress.org/trunk@51411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-11 18:20:59 +00:00
Sergey Biryukov
018ad6098c Accessibility: Administration: Improve aria-label on network admin Themes screen.
This ensures that the beginning of the label matches the visible link text.

Add a similar label for the plugin URI link on the Plugins screen when the plugin is outside of the directory.

Follow-up to [28673], [28706], [35924].

Props sabernhardt, zeo, audrasjb.
Fixes #24442.
Built from https://develop.svn.wordpress.org/trunk@51795


git-svn-id: http://core.svn.wordpress.org/trunk@51402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-10 14:49:00 +00:00
hellofromTonya
07139653b9 Widgets: Revert [51705].
While the new name is much better, it doesn't fully tell what will happen when invoked nor does it fully solve the root problems. 

Why? The function is doing too much. And naming is hard.

Props azaozz, desrosj, andraganescu, zieladam, hellofromTonya.
See #53811.
Built from https://develop.svn.wordpress.org/trunk@51791


git-svn-id: http://core.svn.wordpress.org/trunk@51398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 21:40:57 +00:00
hellofromTonya
5887edee86 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Upgrader_Skin::error().
In each child class: renames the parameter to match the parent's method signature.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

Follow-up to [11005], [25806], [32655], [38199].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51782


git-svn-id: http://core.svn.wordpress.org/trunk@51389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 13:59:56 +00:00
hellofromTonya
03331f52ff Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in WP_Upgrader_Skin::feedback().
In the parent class, renames the parameter `$string` to `$feedback`.
Why? `string` is a PHP reserved keyword.

In each child class: renames the parameter to match the parent's method signature.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

Follow-up to [11005], [25228], [30680], [32655], [38199], [49596].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51781


git-svn-id: http://core.svn.wordpress.org/trunk@51388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 13:48:56 +00:00
hellofromTonya
a395d4c50e Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in Walker::end_el().
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword. The parameter name is selected for consistency with `Walker::start_el()`.

In each child class: renames the parameter to match the parent's method signature.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

Follow-up to [7737], [8900], [8970], [14248], [16100], [25642], [25644], [37051], [37056].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51780


git-svn-id: http://core.svn.wordpress.org/trunk@51387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 13:03:55 +00:00
hellofromTonya
7abc752329 Code Modernization: Fix last parameter name mismatches for parent/child classes in Walker::start_el().
The parent class uses `$current_object_id` while most of the child classes use `$id`. As the parent class' is more descriptive, renaming the last parameter in each of child class.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

- In cases where the original parameter name was too generic or misleading, renamed (when reassigning) to a more descriptive name for use within the method.

Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189], [51739].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51779


git-svn-id: http://core.svn.wordpress.org/trunk@51386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 12:39:59 +00:00
hellofromTonya
1105ddf965 Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in Walker::start_el().
In the parent class, renames the parameter `$object` to `$data_object`.

Why? `object` is a PHP reserved keyword.

In each child class: renames the corresponding parameter to match the parent's method signature.

Why? 

PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.

- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.

Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739


git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 15:36:59 +00:00
hellofromTonya
aebe05f6f4 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_List_Table::handle_row_actions().
Matches the method signatures of the parent class and each child class.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

For readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened

- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [32644], [32664], [32798], [38489], [49183], [49197].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51737


git-svn-id: http://core.svn.wordpress.org/trunk@51345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 19:24:53 +00:00
hellofromTonya
7d6a70107a Code Modernization: Fix parameter name mismatches for parent/child classes in WP_List_Table::column_cb().
Matches the method signatures of the parent class and each child class.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

For readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened

- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [15632], [30679], [31210], [32740], [32753], [32754], [32755], [32756], [32757].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51735


git-svn-id: http://core.svn.wordpress.org/trunk@51343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 18:19:56 +00:00
hellofromTonya
213ce0c7ea Code Modernization: Improve @since message in WP_List_Table::column_default().
Improves the `@since` message to more clearly specify the reason for this change" for PHP 8 named parameter support.

Follow-up to [51728].

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


git-svn-id: http://core.svn.wordpress.org/trunk@51342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 16:57:58 +00:00
Sergey Biryukov
5a7eca9a0e Docs: Correct documentation for the in_plugin_update_message-{$file} filter.
The `$response` parameter is an object, not an array.

This is a minor inconsistency with the corresponding `in_theme_update_message-{$theme_key}` action for themes, where the `$response` parameter is an array.

For backward compatibility, it is safer not to change the parameter type at this point, but to make sure the documentation is correct.

Follow-up to [11193], [16141], [26540].

Props davidmosterd, audrasjb, SergeyBiryukov.
See #40006.
Built from https://develop.svn.wordpress.org/trunk@51733


git-svn-id: http://core.svn.wordpress.org/trunk@51341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-07 12:55:00 +00:00
Sergey Biryukov
de70e2c68b Docs: Correct the post_submitbox_minor_actions hook description.
The action fires after the Save Draft (or Save as Pending) and Preview (or Preview Changes) buttons in the Publish meta box.

The previous description stated that the action fires before the post date/time setting, which was not quite correct, as there are also post status and visibility settings between the action and the date/time setting.

Follow-up to [34895].

Props bedas, audrasjb.
Fixes #54045.
Built from https://develop.svn.wordpress.org/trunk@51732


git-svn-id: http://core.svn.wordpress.org/trunk@51338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-06 13:36:01 +00:00
hellofromTonya
2c91899724 Code Modernization: Fix parameter name mismatches for parent/child classes in WP_List_Table::column_default().
Matches the method signatures of the parent class and each child class.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

For readability:

- `@since` clearly specifies the original parameter name and its new name as well as why the change happened

- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [15632], [30679], [31210], [32740], [32753], [32754], [32755], [32756], [32757].

Props jrf, hellofromTonya, @sergeybiryukov, @azaozz, @desrosj, @johnbillion
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51728


git-svn-id: http://core.svn.wordpress.org/trunk@51334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-02 22:26:56 +00:00
Sergey Biryukov
049bbe8356 Site Health: Remove MySQL query cache size from the Site Health Info screen.
The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0.

Reference: [https://dev.mysql.com/doc/refman/5.7/en/query-cache-configuration.html MySQL 5.7 Reference Manual: Query Cache Configuration].

Follow-up to [51522], [51523].

Props johnbillion, zodiac1978.
Fixes #53845.
Built from https://develop.svn.wordpress.org/trunk@51715


git-svn-id: http://core.svn.wordpress.org/trunk@51321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-01 07:01:56 +00:00
hellofromTonya
71977c215d Widgets: Rename and soft deprecate retrieve_widgets().
The original name `retrieve_widgets()` was unclear as it suggested it was a getter, i.e. getting the widgets. This function does more than get: finds orphaned widgets, assigns them to the inactive sidebar, and updates the database.

The new name is `sync_registered_widgets()` which better represents what happens when this function is invoked.

The original `retrieve_widgets()` function is soft deprecated to avoid unnecessary code churn downstream for developers that support more than the latest version of WordPress.

Follow-up to [18630].

Props zieladam, timothyblynjacobs, andraganescu, hellofromTonya.
See #53811.
Built from https://develop.svn.wordpress.org/trunk@51705


git-svn-id: http://core.svn.wordpress.org/trunk@51311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-31 19:58:58 +00:00
Sergey Biryukov
26a276db6f Filesystem API: Make sure to only call fread() on non-empty files in PclZip::privAddFile().
This avoids a fatal error on PHP 8 caused by passing a zero value to `fread()` as the `$length` argument, which must be greater than zero.

This commit also amends the previous solution for similar issues elsewhere in the file to ensure consistent type for string values, instead of changing the type from `string` to `bool` when trying to read from an empty file.

Follow-up to [50355].

Props DavidAnderson, jrf, SergeyBiryukov.
Fixes #54036.
Built from https://develop.svn.wordpress.org/trunk@51686


git-svn-id: http://core.svn.wordpress.org/trunk@51292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-29 01:33:58 +00:00
Sergey Biryukov
0ae0fbedce Plugins: Display a message on Plugins list table if a plugin requires a higher version of PHP or WordPress.
Installation and activation of incompatible plugins was previously disallowed in [43436] and [44978], but if such a plugin was installed manually, there was nothing on the Plugins screen that would show its compatibility status.

Showing an appropriate notice with a documentation link makes the UI more consistent and improves user experience.

Follow-up to [43436], [44937], [44939], [44978], [45043], [45165], [45546], [47573], [47816], [47819], [48172], [48636], [48637], [48638], [48640], [48652], [48653], [48654], [48660].

Props TacoVerdo, SergeyBiryukov.
Fixes #53990.
Built from https://develop.svn.wordpress.org/trunk@51678


git-svn-id: http://core.svn.wordpress.org/trunk@51284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-27 15:43:57 +00:00
hellofromTonya
ab252fb910 Coding Standards: Fix indentation and remove ignore annotation in wp_privacy_send_personal_data_export_email().
Follow-up to [51129], [51410].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51662


git-svn-id: http://core.svn.wordpress.org/trunk@51268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 14:05:58 +00:00
hellofromTonya
2e9fe3c986 Coding Standards: Make ignore annotation more specific in WP_Site_Health_Auto_Updates::test_vcs_abspath().
Follow-up to [44986].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51661


git-svn-id: http://core.svn.wordpress.org/trunk@51267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:59:59 +00:00
hellofromTonya
a91fc400a0 Coding Standards: Remove redundant ignore annotation in populate_options().
Follow-up to [43627], [43628].

Props jrf, hellofromTonya.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51660


git-svn-id: http://core.svn.wordpress.org/trunk@51266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 13:50:59 +00:00
hellofromTonya
c7d3e267b8 Coding Standards: Use static closures when not using $this.
When a closure does not use `$this`, it can be made `static` for improved performance.

Static closures are supported in PHP since PHP 5.4. ​

Props jrf, hellofromTonya, swissspidy, SergeyBiryukov.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51657


git-svn-id: http://core.svn.wordpress.org/trunk@51263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-26 12:59:02 +00:00
Sergey Biryukov
622985b69c Docs: Add missing @since tag for the $check_signatures parameter of WP_Upgrader::run().
This matches the `WP_Upgrader::download_package()` documentation more closely.

Follow-up to [44954], [45262].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51655


git-svn-id: http://core.svn.wordpress.org/trunk@51261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-25 14:39:59 +00:00
Sergey Biryukov
d529999e5b Docs: Clarify a comment in WP_Upgrader::run().
This matches the `WP_Upgrader::download_package()` documentation more closely.

Follow-up to [11005], [30758], [33685].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51654


git-svn-id: http://core.svn.wordpress.org/trunk@51260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-24 23:10:06 +00:00
Sergey Biryukov
ccbd16fef1 Media: Check the return type of _get_cron_array() in WP_Media_List_Table::prepare_items().
The following warnings could, in very select circumstances, be shown:
{{{
// PHP 8.0 and higher:
Warning: foreach() argument must be of type array|object, bool given

// PHP 5.6 – 7.4
Warning: Invalid argument supplied for foreach()
}}}

In `WP_Media_List_Table::prepare_items()`, the cron info array is retrieved via a call to `_get_cron_array()`, but as the documentation (correctly) states, the return type of that function is `array|false`, where `false` is returned for a virgin site, with no cron jobs scheduled yet.

However, no type check is done on the return value, and the method just blindly continues by using it in a `foreach`.

Fixed by adding validation for the returned value from `_get_cron_array()` and only running the `foreach` when the returned value is an array.

Reference: [https://developer.wordpress.org/reference/functions/_get_cron_array/ WordPress Developer Resources: _get_cron_array()]

Follow-up to [48417].

Props jrf, hellofromTonya, mukesh27.
Fixes #53949.
Built from https://develop.svn.wordpress.org/trunk@51638


git-svn-id: http://core.svn.wordpress.org/trunk@51244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-19 12:44:57 +00:00