Commit Graph

40072 Commits

Author SHA1 Message Date
Sergey Biryukov 051aa3847c Date/Time: Fix race conditions in `current_time()` tests.
* Restore default timezone before performing assertions to avoid affecting other tests in case of failure.
* Use delta comparison for timestamps to avoid race conditions.

Props SergeyBiryukov, desrosj.
Fixes #45821.

git-svn-id: https://develop.svn.wordpress.org/trunk@45857 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-20 01:34:37 +00:00
Sergey Biryukov 91f60afbe5 Date/Time: Use PHP `DateTime` class API in `current_time()`.
Only use the legacy WP timestamp approach (a sum of timestamp and timezone offset) for `timestamp` and `U` formats without the `$gmt` flag.

Otherwise, make sure the function returns correct local time for any format.

Props Rarst, jdgrimes.
Fixes #40653.

git-svn-id: https://develop.svn.wordpress.org/trunk@45856 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 21:05:42 +00:00
Sergey Biryukov f5f2fc379e Coding Standards: Use long array syntax in `Tests_WP_Timezone::timezone_offset_provider()`.
Per https://make.wordpress.org/core/2019/07/12/php-coding-standards-changes/, arrays must be declared using long array syntax for clarity.

See #24730.

git-svn-id: https://develop.svn.wordpress.org/trunk@45855 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 21:05:25 +00:00
Sergey Biryukov c782ad4511 Coding Standards: Use `KB_IN_BYTES` in `get_file_data()`.
See #22405, #47632.

git-svn-id: https://develop.svn.wordpress.org/trunk@45854 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 20:09:11 +00:00
Sergey Biryukov 904b41e01c Date/Time: Introduce `wp_timezone_string()` and `wp_timezone()` for unified timezone retrieval.
* `wp_timezone_string()` retrieves the timezone from current settings as a string. Uses the `timezone_string` option to get a proper timezone if available, otherwise falls back to an offset.
* `wp_timezone()` retrieves the timezone from current settings as a `DateTimeZone` object. Timezone can be based on a PHP timezone string or a `±HH:MM` offset.

Props Rarst, remcotolsma, johnjamesjacoby, rmccue.
Fixes #24730.

git-svn-id: https://develop.svn.wordpress.org/trunk@45853 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 19:07:03 +00:00
Sergey Biryukov f2b6c12ddb Coding Standards: Fix WPCS violations in [45851].
See #25347.

git-svn-id: https://develop.svn.wordpress.org/trunk@45852 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 16:34:57 +00:00
Sergey Biryukov 896da178e0 Date/Time: In `wp_insert_post()`, when checking the post date to set `future` or `publish` status, use string comparison to work around far future dates (year 2038+) on 32-bit systems.
Props Rarst, nofearinc.
Fixes #25347.

git-svn-id: https://develop.svn.wordpress.org/trunk@45851 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 15:49:32 +00:00
Sergey Biryukov 0f8ba2cf2a Date/Time: In `WP_Date_Query::__construct()`, return early if `$date_query` is empty or not an array.
Props vishalkakadiya.
Fixes #47392.

git-svn-id: https://develop.svn.wordpress.org/trunk@45850 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 15:16:18 +00:00
Gary Pendergast 4e0499e5bf Tests: Add an xdebug group for tests that require xdebug.
These tests are now also run as their own part of the Travis build, to ensure performance of other tests isn't affected by the presence of xdebug.

Fixes #40532.



git-svn-id: https://develop.svn.wordpress.org/trunk@45827 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 02:17:50 +00:00
Tammie Lister 9260916964 Multisite: Remove truncation to allow clearers identification of longer site names
Previously the sites were truncated which meant longer names but with ending identifications were unable to be seen as different. This shows the full site name to allow easier understanding.

Props tferry, melinedo, afercia, jeremyfelt
Fixes: 47112


git-svn-id: https://develop.svn.wordpress.org/trunk@45826 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-18 12:29:30 +00:00
Sergey Biryukov 95c36ce5ba Privacy: Add descriptions for sections in a personal data export file.
Props garrett-eclipse, Venutius, karmatosed.
Fixes #45491.

git-svn-id: https://develop.svn.wordpress.org/trunk@45825 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-18 02:07:00 +00:00
Sergey Biryukov 6f30523ce9 Plugins: Adjust margin for plugin headings on "Add Plugins" screen to avoid overlapping with "Network Activate" button.
Props justinahinon, chetan200891.
Fixes #47600.

git-svn-id: https://develop.svn.wordpress.org/trunk@45824 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-17 14:33:01 +00:00
Sergey Biryukov e810b32f42 Pings/Trackbacks: In `wp_xmlrpc_server::pingback_ping()`, strip inline JS and CSS while trying to figure out the pingback context.
Props david.binda.
Fixes #47283.

git-svn-id: https://develop.svn.wordpress.org/trunk@45823 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-17 13:58:12 +00:00
Sergey Biryukov c5438c3720 Docs: Improve documentation for `wp_set_auth_cookie()` and related functions.
Props arafat, SergeyBiryukov.
Fixes #47886.

git-svn-id: https://develop.svn.wordpress.org/trunk@45822 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-17 13:22:26 +00:00
John Blackbourn b675f56c4f Docs: Add a missing return type.
See #47110


git-svn-id: https://develop.svn.wordpress.org/trunk@45821 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-16 19:34:31 +00:00
K. Adam White 4bb45c674a Add @ticket annotations for [45812].
Props birgire.
See #43709.



git-svn-id: https://develop.svn.wordpress.org/trunk@45820 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-16 03:32:23 +00:00
Gary Pendergast a100d0cf52 Build Tools: Improve `local-env` start behaviour under Docker Toolbox.
Docker Toolbox requires port forwarding to be configured, but generates error when trying to forward a port that's already been taken.

This change removes clashing port forwarding rules before adding our own.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45819 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-16 01:39:59 +00:00
Sergey Biryukov f3241f4883 Administration: Replace legacy `updated` message type in `add_settings_error()` calls with `success`.
See #44640.

git-svn-id: https://develop.svn.wordpress.org/trunk@45818 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-16 00:38:42 +00:00
Sergey Biryukov e961891e1b Taxonomy: In `feed_links_extra()` and `get_the_archive_title()`, make sure the queried taxonomy term exists before accessing its properties.
Props donmhico, truchot, zaantar.
Fixes #46420.

git-svn-id: https://develop.svn.wordpress.org/trunk@45817 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-16 00:23:40 +00:00
Sergey Biryukov beb1d3a7b5 Coding Standards: In `wlwmanifest_link()`, use concatenation instead of commas for `echo`, for consistency with `rsd_link()` and the rest of core.
See #47632.

git-svn-id: https://develop.svn.wordpress.org/trunk@45816 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-16 00:20:58 +00:00
K. Adam White 5a98103567 REST API: Add @ticket annotation to test from [45813].
Props birgire.
See #42209.


git-svn-id: https://develop.svn.wordpress.org/trunk@45815 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 23:08:31 +00:00
Sergey Biryukov 7113ab1f51 Administration: In `add_settings_error()`, add `warning` and `info` as possible values for message type.
Account for these new values in `settings_errors()`, resulting in `notice-warning` and `notice-info` CSS classes.

Map legacy `error` and `updated` CSS classes to `notice-error` and `notice-success`.

Props donmhico, toddhalfpenny, flixos90, desrosj, javorszky, SergeyBiryukov.
Fixes #44640, #44941.

git-svn-id: https://develop.svn.wordpress.org/trunk@45814 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 23:00:38 +00:00
K. Adam White d65b89c5e4 REST API: Always return post types list in taxonomies endpoint response as an array.
Prevents a non-sequential post type array such as [ 0 => 'post', 2 => 'page' ] from being improperly converted to an object in the taxonomy endpoint's response JSON.

Props TimothyBlynJacobs, birgire, spectacula.
Fixes #42209.


git-svn-id: https://develop.svn.wordpress.org/trunk@45813 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 22:11:07 +00:00
K. Adam White 8f100777e8 REST API: Prevent deletion of post revisions.
Allowing the client to delete revisions breaks the "audit trail" functionality. This is not allowed in WordPress and shouldn't be allowed through the API.
While not recommended, a plugin may opt-in to the previous behavior by setting a custom 'delete_post' capability for the revisions post type.

Props dlh, danielbachhuber, TimothyBlynJacobs, azaozz, kadamwhite.
Fixes #43709.



git-svn-id: https://develop.svn.wordpress.org/trunk@45812 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 22:00:49 +00:00
K. Adam White eb468c4446 REST API: Cache results of get_item_schema on controller instances for performance.
Caches the output of get_item_schema() to avoid redundant recomputation of translatable strings and other computed values. This method is called many times per item in each REST request, and the results of the method should not vary between calls.
Additional schema fields are not cached.

Props kadamwhite, joehoyle, TimothyBlynJacobs.
Fixes #47871.


git-svn-id: https://develop.svn.wordpress.org/trunk@45811 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 21:08:05 +00:00
K. Adam White 94b8a122c4 REST API: Clarify arguments passed to rest route get & update callbacks.
Update doc block argument definitions to clarify that the REST API always passes an array to the `get_callback` and always passes an entity object to the `update_callback`.

Props TimothyBlynJacobs, salzano.
Fixes #44432.



git-svn-id: https://develop.svn.wordpress.org/trunk@45810 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 20:03:18 +00:00
K. Adam White 80e44e49e2 REST API: Do not send response body if status is 204 or body is null.
Status code 204 should indicate no response body is sent. Previously, a "null" string was sent, which MacOS Safari would try to parse as JSON and thereby fail to complete the request.

Props TimothyBlynJacobs, andizer, matthias.thiel.
Fixes #43691.



git-svn-id: https://develop.svn.wordpress.org/trunk@45809 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 19:55:13 +00:00
K. Adam White 22480c035b REST API: Add test class file incorrectly omitted from [45807].
Props @TimothyBlynJacobs.
See #43392.


git-svn-id: https://develop.svn.wordpress.org/trunk@45808 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 17:20:02 +00:00
K. Adam White c92ef7c441 REST API: Support 'object' and 'array' types in register_meta() schemas.
Extends meta registration to support complex schema values, mirroring the functionality in the settings controller.
Error when trying to modify a meta key containing schema-nonconformant data.

Props @TimothyBlynJacobs, @birgire, @mnelson4, @flixos90.
Fixes #43392.



git-svn-id: https://develop.svn.wordpress.org/trunk@45807 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 17:16:21 +00:00
Sergey Biryukov a636529b7c Users: When deleting users, exclude the current user from the content existence check.
The current user cannot be deleted, so the check is redundant in that context and should only be done for other users.

Props mt8.biz, SergeyBiryukov.
Fixes #47851.

git-svn-id: https://develop.svn.wordpress.org/trunk@45806 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 13:05:39 +00:00
Gary Pendergast 9c3fb72719 Schema: Add an index to `wp_options.autoload`.
Most sites will be unaffected by this change, but those with a large number of rows in `wp_options`, only a small number of which have `autoload` set, will see a significant performance improvement.

Sites with a large number of rows in `wp_options`, with many of them having `autoload` set will unfortunately see a performance penalty on top of the already very slow queries they're running, but this should be the minority of cases.

Props DanBUK.
Fixes #24044.


git-svn-id: https://develop.svn.wordpress.org/trunk@45805 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 07:12:04 +00:00
Sergey Biryukov e982455e44 Networks and Sites: Trim site domain when creating a new site on Add New Site screen before further validation.
Props dharmin16, jeremyfelt, aubreypwd.
Fixes #44808.

git-svn-id: https://develop.svn.wordpress.org/trunk@45804 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 01:20:52 +00:00
Sergey Biryukov 4f86944a09 Docs: Add missing `@since` tag for `WP_Site_Health::has_late_cron()`.
See #47223.

git-svn-id: https://develop.svn.wordpress.org/trunk@45803 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 00:41:25 +00:00
Peter Wilson 0d2b94a44a Site Health Check: New tests file missed in [45801].
git-svn-id: https://develop.svn.wordpress.org/trunk@45802 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 00:36:38 +00:00
Peter Wilson f29952ab74 Site Health Check: Increase time allowance for cron checks.
Introduces `WP_Site_Health::has_late_cron()` for late wp-cron jobs and extends the time allowance before a job is considered missed.

In a standard configuration using loopback requests, a job is considered late once past due and missed over five minutes past due.

Late and missed time frames are extended if `DISABLE_WP_CRON` is defined as `true` to allow for crontab tasks running less frequently. A job is considered late once it's 15 minutes past due and missed over one hour past due.

A file for site health unit tests has been introduced with tests for cron in critical, late and missed states.

Props rockfire, afragen, peterwilsoncc.
Fixes #47223.


git-svn-id: https://develop.svn.wordpress.org/trunk@45801 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 00:34:53 +00:00
Gary Pendergast f756d801d8 Build Tools: Change the PHPUnit Docker image's working directory to match the other images.
Also, pass the `WP_MULTISITE` environment variable along to the container.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45800 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 00:33:32 +00:00
Gary Pendergast da411cd17a Build Tools: Run `composer` commands in a Docker container on Travis.
This tidies up the `.travis.yml` file a little more.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45799 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 23:11:39 +00:00
Sergey Biryukov a2a28e4608 Widgets: Allow for short-circuiting widget output in `the_widget()` using the `widget_display_callback` filter, for consistency with output via a registered sidebar.
Props MarcGuay, donmhico.
Fixes #34226.

git-svn-id: https://develop.svn.wordpress.org/trunk@45798 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 23:02:25 +00:00
Sergey Biryukov 1177e1212f Docs: Correct type for `query_var` argument of `register_taxonomy()`.
Props juiiee8487, audrasjb.
Fixes #47877.

git-svn-id: https://develop.svn.wordpress.org/trunk@45797 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 17:46:20 +00:00
Sergey Biryukov a58eb86d5e Posts, Post Types: In `wp_trim_words()` make sure the `$num_words` parameter is always an integer, as documented, to avoid a PHP warning.
Props donmhico, pikamander2.
Fixes #47867.

git-svn-id: https://develop.svn.wordpress.org/trunk@45796 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 17:17:51 +00:00
Sergey Biryukov d4a305292f Users: Make `wp_list_authors()` unit tests more readable.
See #23498.

git-svn-id: https://develop.svn.wordpress.org/trunk@45795 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 15:35:19 +00:00
Sergey Biryukov 5bcd25ac0a Networks and Sites: Improve documentation and variable naming in `switch_to_blog()` and `restore_current_blog()`.
In `switch_to_blog()`:

* Rename `$blog_id` to `$prev_blog_id` for clarity.
* Rename `$new_blog` to `$new_blog_id` for consistency.
* Pass `$prev_blog_id` as a second parameter to `switch_blog` action, instead of the duplicated `$new_blog_id`. This only clarifies documentation and does not affect functionality, since the values are equal in the context where the DocBlock is located.

In `restore_current_blog()`:

* Rename `$blog` to `$new_blog_id` for clarity.
* Rename `$blog_id` to `$prev_blog_id` for clarity.

Props ChriCo, jeremyfelt, SergeyBiryukov.
Fixes #45594.

git-svn-id: https://develop.svn.wordpress.org/trunk@45794 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 14:28:52 +00:00
Sergey Biryukov 94f4dcd15a Plugins: Adjust the pause before running plugin search AJAX request on "Add Plugins" screen to allow more time for using browser's autocomplete.
Props donmhico, apermo.
Fixes #46021.

git-svn-id: https://develop.svn.wordpress.org/trunk@45793 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 02:01:26 +00:00
Sergey Biryukov e196360f8c Coding Standards: Fix JSHint error in [45790].
See #41545.

git-svn-id: https://develop.svn.wordpress.org/trunk@45792 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 00:01:40 +00:00
Sergey Biryukov ee1159c4fe Site Health: Simplify the language in Status Health Info page introduction, add a link to Status page.
Props birgire, mukesh27, subrataemfluence, leogermani.
Fixes #46946.

git-svn-id: https://develop.svn.wordpress.org/trunk@45791 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-13 23:34:53 +00:00
Adam Silverstein 98255d4720 Comments: enable typing cmd/ctrl-enter to submit comment forms.
Add a key handler on the comment form that detects the cmd/ctrl-enter key press and submits the comment form. 

Props xyfi, Lindstromer, helen, splitti.
Fixes #41545.



git-svn-id: https://develop.svn.wordpress.org/trunk@45790 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-13 21:25:57 +00:00
Andrew Ozz 9a20a07304 Remove trailing white space in upgrade.php.
See #46349.

git-svn-id: https://develop.svn.wordpress.org/trunk@45789 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-13 19:52:50 +00:00
Andrew Ozz 6dad32d2ae Admin email verification:
- Add the `admin_email_lifespan` option when installing. Fixes a bug where the verification screen is shown right after installation.
- Reset the same option when upgrading and the user doing the DB upgrade is not an admin. This will ensure the email verification is shown next time an admin logs in.
- Use `site_url()` instead of `network_site_url()` for the form action. The latter seems needed only for password reset.

See #46349.

git-svn-id: https://develop.svn.wordpress.org/trunk@45788 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-13 17:39:06 +00:00
Peter Wilson feb0830c79 Comments: Include post permalink in comment reply link.
Include the post's permalink when generating reply links in `get_comment_reply_link()` to account for comments displayed on index and archive pages.

This reapplies [32786] which was inadvertently reverted in [42360].

Props justinahinon, donmhico.
See #33383.
Fixes #47174.


git-svn-id: https://develop.svn.wordpress.org/trunk@45787 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-13 05:08:14 +00:00
K. Adam White 3d53fdba73 Docs: Clarify custom-fields support requirement for viewing custom post meta in REST API.
Fixes #47866.


git-svn-id: https://develop.svn.wordpress.org/trunk@45786 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-13 01:51:00 +00:00