Commit Graph

40289 Commits

Author SHA1 Message Date
Sergey Biryukov
67f7d1f4c7 Date/Time: Rewrite and simplify date_i18n() using wp_timezone() to address multiple issues with certain date formats and timezones, while preserving some extra handling for legacy use cases.
Improve unit test coverage.

Props Rarst, remcotolsma, raubvogel.
Fixes #25768.

git-svn-id: https://develop.svn.wordpress.org/trunk@45882 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-23 00:56:21 +00:00
Jonathan Desrosiers
0847b67b13 Coding Standards: Dynamic hooks should be named using interpolation not concatenation.
Props arena, desrosj.
Fixes #47052.

git-svn-id: https://develop.svn.wordpress.org/trunk@45881 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-22 19:07:57 +00:00
Sergey Biryukov
5a47302c35 Coding Standards: Add missing break for the default case in wp_privacy_anonymize_data().
Props itowhid06.
Fixes #47921.

git-svn-id: https://develop.svn.wordpress.org/trunk@45877 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-22 14:49:05 +00:00
Sergey Biryukov
4e129d1506 Date/Time: Use wp_timezone() in WP_Date_Query::build_mysql_datetime() to address timezone issues.
Improve unit test coverage.

Props Rarst, Biranit, birgire, jave.web, SergeyBiryukov.
Fixes #41782.

git-svn-id: https://develop.svn.wordpress.org/trunk@45876 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-22 03:10:05 +00:00
Gary Pendergast
8d5e4fed4d Build Tools: Don't use git for package installs.
While NPM supports installing packages from git locations, this requires `git` to be in the path, which won't necessarily be true, particularly on Windows.

We can download the release versions for these packages, instead.

Fixes #47916.



git-svn-id: https://develop.svn.wordpress.org/trunk@45875 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-22 02:28:50 +00:00
Sergey Biryukov
1ba44554be Users: Adjust [45708] to make sure wp_update_user() does not issue a WP_Error if a single site was previously set up as Multisite and there's still a spam field in the user table.
Add a unit test.

Props azaozz, SergeyBiryukov.
Fixes #45747.

git-svn-id: https://develop.svn.wordpress.org/trunk@45874 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-22 01:52:16 +00:00
Sergey Biryukov
7fbabd505d Administration: Adjust [45814] to address a backward compatibility issue for plugins passing multiple CSS classes to add_settings_error().
Only add the `notice-` prefix for `error`, `success`, `warning`, `info` CSS classes, keep other classes as is.

Add unit tests for `settings_errors()`.

Props afercia, SergeyBiryukov.
Fixes #44941.

git-svn-id: https://develop.svn.wordpress.org/trunk@45873 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-22 00:21:49 +00:00
Sergey Biryukov
6ea6591114 Docs: Correct type for the $deprecated argument of get_terms().
Props itowhid06.
Fixes #47915.

git-svn-id: https://develop.svn.wordpress.org/trunk@45872 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-21 16:26:47 +00:00
Sergey Biryukov
7b14e0c349 Docs: Fix typo in _wp_make_subsizes() DocBlock.
Props itowhid06.
Fixes #47913. See #40439.

git-svn-id: https://develop.svn.wordpress.org/trunk@45871 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-21 16:22:49 +00:00
Sergey Biryukov
fb189a6d5c Customizer: Trim whitespace from custom link URLs.
This complements a similar fix for the Menus screen in [45655].

Props donmhico, audrasjb.
Fixes #47888. See #47723.

git-svn-id: https://develop.svn.wordpress.org/trunk@45869 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-21 00:26:45 +00:00
Sergey Biryukov
2fb748bd1c Docs: Update @since tag for new JS functions and variables introduced in [45572].
Props garrett-eclipse.
See #47145.

git-svn-id: https://develop.svn.wordpress.org/trunk@45867 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-20 22:53:50 +00:00
Sergey Biryukov
23769b62c1 Twenty Seventeen: Fix tabs vs. spaces in [45764].
See #47414.

git-svn-id: https://develop.svn.wordpress.org/trunk@45863 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-20 19:10:15 +00:00
Sergey Biryukov
92ba7258b0 Twenty Eleven: Fix tabs vs. spaces in [45763].
See #47414.

git-svn-id: https://develop.svn.wordpress.org/trunk@45862 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-20 19:10:12 +00:00
Sergey Biryukov
c277879ad0 Twenty Seventeen: Adjust [45764] to conform to CSS Coding Standards.
See #47414.

git-svn-id: https://develop.svn.wordpress.org/trunk@45861 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-20 19:05:30 +00:00
Sergey Biryukov
13f064a1c3 Twenty Eleven: Adjust [45763] to conform to CSS Coding Standards.
See #47414.

git-svn-id: https://develop.svn.wordpress.org/trunk@45860 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-20 19:05:24 +00:00
Sergey Biryukov
d471151f45 Tests: Remove $wpdb global reference from test_wp_insert_user_with_empty_data().
See #47902.

git-svn-id: https://develop.svn.wordpress.org/trunk@45859 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-20 17:27:17 +00:00
Sergey Biryukov
31a6309902 Users: In wp_insert_user(), account for the wp_pre_insert_user_data filter returning empty data.
Props juliobox, SergeyBiryukov.
Fixes #47902.

git-svn-id: https://develop.svn.wordpress.org/trunk@45858 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-20 17:25:02 +00:00
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