Commit Graph

40051 Commits

Author SHA1 Message Date
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
Mike Schroder
ccdc221b32 Administration: Output valid HTML when wp_die() is called.
To better support HTML and string calls to `wp_die()` without
outputting invalid HTML, wraps error messages in `<div>` rather than `<p>`.

Adds `.wp-die-message` CSS class for styling.

Props dinhtungdu, jeremyfelt, audrasjb, SergeyBiryukov, afercia, audrasjb, noisysocks.
Fixes #47580.
Built from https://develop.svn.wordpress.org/trunk@45909


git-svn-id: http://core.svn.wordpress.org/trunk@45720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-29 07:54:01 +00:00
Sergey Biryukov
6057b32e9b Date/Time: Revamp mysql2date() to use wp_date() and handle invalid input in a consistent manner.
Add unit tests, improve documentation.

Props Rarst, pbearne.
Fixes #28992.
Built from https://develop.svn.wordpress.org/trunk@45908


git-svn-id: http://core.svn.wordpress.org/trunk@45719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-29 05:07:56 +00:00
Sergey Biryukov
29a6063f45 Coding Standards: Fix WPCS issue in [45906].
See #45322.
Built from https://develop.svn.wordpress.org/trunk@45907


git-svn-id: http://core.svn.wordpress.org/trunk@45718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-29 02:40:54 +00:00
Sergey Biryukov
e0adbf69ff XML-RPC: Make sure editing a draft post with wp.editPost does not unintentionally cause its published date to be set.
Props redsweater.
Fixes #45322.
Built from https://develop.svn.wordpress.org/trunk@45906


git-svn-id: http://core.svn.wordpress.org/trunk@45717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-29 02:10:56 +00:00
Sergey Biryukov
27a384caa4 Site Health: Merge two similar strings explaining what drop-in plugins are.
Props garrett-eclipse, ramiy, Clorith.
Fixes #47247.
Built from https://develop.svn.wordpress.org/trunk@45905


git-svn-id: http://core.svn.wordpress.org/trunk@45716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-28 03:13:55 +00:00
Sergey Biryukov
6cad27efcd Site Health: Standardize on SELECT VERSION() query for checking the database server version, due to the MariaDB version declaration potentially causing issues in production environments.
Partially reverts [45691].

Props Clorith.
Fixes #47738.
Built from https://develop.svn.wordpress.org/trunk@45904


git-svn-id: http://core.svn.wordpress.org/trunk@45715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-28 03:09:52 +00:00
K. Adam White
181d77f04e REST API: Only cast scalar types to string when comparing new & old meta values.
Newly-supported array and object meta types should not be cast to strings.

Props TimothyBlynJacobs, caercam.
Fixes #47928.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-28 03:08:55 +00:00
Sergey Biryukov
e3d4e81ca0 Date/Time: Correct delta comparison in test_should_return_wp_timestamp().
See #25768.
Built from https://develop.svn.wordpress.org/trunk@45902


git-svn-id: http://core.svn.wordpress.org/trunk@45713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-28 02:20:54 +00:00
Sergey Biryukov
12aa694ee5 Date/Time: Introduce wp_date() to retrieve the date in localized format.
Convert `date_i18n()` into a wrapper for `wp_date()`.

`wp_date()` is intended as a replacement for `date_i18n()` without legacy quirks in it. It accepts a true Unix timestamp (not summed with timezone offset) and an arbitrary timezone.

Props Rarst, mboynes, MikeHansenMe, rmccue, nacin.
Fixes #28636.
Built from https://develop.svn.wordpress.org/trunk@45901


git-svn-id: http://core.svn.wordpress.org/trunk@45712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-28 00:52:56 +00:00
Sergey Biryukov
61d5337aca Date/Time: Remove the last remaining current_time( 'timestamp' ) instance in wp_post_revision_title_expanded().
Timestamps don't carry any timezone information, using `$revision->post_modified_gmt` simplifies the logic.

Props Rarst.
See #40657.
Built from https://develop.svn.wordpress.org/trunk@45900


git-svn-id: http://core.svn.wordpress.org/trunk@45711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-27 21:55:56 +00:00
Sergey Biryukov
6a7baa24a6 Docs: Clarify that $name and $value parameters of set_user_setting() can contain hyphens.
Props tmatsuur.
Fixes #47938.
Built from https://develop.svn.wordpress.org/trunk@45899


git-svn-id: http://core.svn.wordpress.org/trunk@45710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-27 01:17:55 +00:00
Sergey Biryukov
8750097e4b Docs: Remove a clarification from do_robots() description that doesn't really clarify anything.
See #47110.
Built from https://develop.svn.wordpress.org/trunk@45898


git-svn-id: http://core.svn.wordpress.org/trunk@45709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-27 00:17:56 +00:00
Sergey Biryukov
cc21760163 Twenty Nineteen: Make sure center-aligned images in columns do not break beyond the column boundaries.
Props kjellr.
Fixes #47937.
Built from https://develop.svn.wordpress.org/trunk@45897


git-svn-id: http://core.svn.wordpress.org/trunk@45708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-26 19:01:55 +00:00
Sergey Biryukov
9dc2a432b1 Twenty Nineteen: Update style-rtl.css after [45773].
See #47850.
Built from https://develop.svn.wordpress.org/trunk@45896


git-svn-id: http://core.svn.wordpress.org/trunk@45707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-26 19:00:58 +00:00
Sergey Biryukov
baffd21844 Docs: Reference WP_Term_Query::__construct() in wp_list_categories() DocBlock for additional accepted arguments.
Clarify that `wp_dropdown_categories()` always returns a string, regardless of the `echo` parameter.

See #47896, #47110.
Built from https://develop.svn.wordpress.org/trunk@45895


git-svn-id: http://core.svn.wordpress.org/trunk@45706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-26 17:00:55 +00:00
Boone Gorges
d1ac7170dc Taxonomy: Standardize docs for wp_list_categories().
Many of the parameters historically documented on this function are merely
passed through to `get_categories()` and its underlying functions. In order to
avoid unnecessary duplication of function arguments, we remove documentation of
these parameters, and replace it with reference to the wrapped functions.

Parameters that receive special treatment or are otherwise changed before
being passed through continue to be documented as part of `wp_list_categories()`.

Props audrasjb, itowhid06, birgire.
Fixes #47896.
Built from https://develop.svn.wordpress.org/trunk@45894


git-svn-id: http://core.svn.wordpress.org/trunk@45705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-26 15:24:55 +00:00
Boone Gorges
e0c83d76d1 Taxonomy: Fix unique-slug check for terms with parents.
`wp_unique_term_slug()` appends numeric suffixes when the requested slug is
already in use by a sibling term. Changes introduced in [32837] inadvertently
caused this suffixing to be skipped in cases where the requested slug is
suffixed with the parent slug, so that it became possible to have two terms
`childslug-parentslug` underneath to the same `parentslug`. We fix this
regression by ensuring that the numeric-suffix routine runs in all cases.

Props yashar_hv, saskak, dlh.
Fixes #46431.
Built from https://develop.svn.wordpress.org/trunk@45893


git-svn-id: http://core.svn.wordpress.org/trunk@45704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-26 15:19:56 +00:00
Andrew Ozz
c5fed47367 Docs: Improve and update the description of multi_resize() to explain changes and expected use.
See #40439.
Built from https://develop.svn.wordpress.org/trunk@45892


git-svn-id: http://core.svn.wordpress.org/trunk@45703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-25 22:21:58 +00:00
Sergey Biryukov
b1847ef3e2 Menus: In wp_setup_nav_menu_item() and Walker_Nav_Menu_Edit::start_el(), check if the post or term associated with the menu item still exists to avoid a PHP notice.
If the associated post or term no longer exists, mark the menu item as invalid.

Props mehulkaklotar, kamrankhorsandi, cristiano.zanca, SergeyBiryukov.
Fixes #31703.
Built from https://develop.svn.wordpress.org/trunk@45891


git-svn-id: http://core.svn.wordpress.org/trunk@45702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-25 21:32:59 +00:00
Sergey Biryukov
fe0b22cd67 Users: Adjust [45806] to make sure $all_userids is always defined.
Props kbrownkd.
Fixes #47936.
Built from https://develop.svn.wordpress.org/trunk@45890


git-svn-id: http://core.svn.wordpress.org/trunk@45701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-25 20:03:57 +00:00
Sergey Biryukov
c896a0911e Site Health: Add timezone to Site Health Info page.
Props justinahinon, sharaz, artisticasad, Rarst.
Fixes #47842.
Built from https://develop.svn.wordpress.org/trunk@45889


git-svn-id: http://core.svn.wordpress.org/trunk@45700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-24 19:37:57 +00:00
Boone Gorges
17d32ebc8f Taxonomy: Ensure consistency of hide_empty in term queries when taxonomy is excluded.
When querying for terms in hierarchical categories using `hide_empty=true`,
results have historically included parent terms which are themselves
unattached to any objects (are "empty") but which have non-empty descendent
terms. Because this process involves walking the descendant tree, we avoid it
when we detect that the queried taxonomies are not hierarchical. (This
behavior was introduced in [5525].)

When the `taxonomy` parameter of `get_terms()` was made optional - see #35495,
[36614] - it affected the mechanism for avoiding unneccessary tree walks,
since there may not be any explicitly declared taxonomies to run through
`is_taxonomy_hierarchical()`. As a result, term queries excluding `taxonomy`
did not check descendants, and empty parents with non-empty children were not
included in `hide_empty` results.

We correct the behavior by crawling term descendants when the `taxonomy`
argument is absent, which means that we're querying for terms in all taxonomies.

Props smerriman.
Fixes #37728.
Built from https://develop.svn.wordpress.org/trunk@45888


git-svn-id: http://core.svn.wordpress.org/trunk@45699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 16:05:56 +00:00
Sergey Biryukov
9672302e04 Date/Time: Rewrite and simplify get_gmt_from_date(), get_date_from_gmt(), and iso8601_to_datetime() using wp_timezone().
Improve unit test coverage.

Props Rarst, goodevilgenius.
Fixes #31809.
Built from https://develop.svn.wordpress.org/trunk@45887


git-svn-id: http://core.svn.wordpress.org/trunk@45698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 11:03:56 +00:00
Sergey Biryukov
1aaf11947e Date/Time: Simplify the date comparing logic in WP_Community_Events::trim_events().
The Events API returns event date without timezone information, so trying to parse it into a timestamp and compare to a WP timestamp is pointless.

Props Rarst.
Fixes #47463.
Built from https://develop.svn.wordpress.org/trunk@45886


git-svn-id: http://core.svn.wordpress.org/trunk@45697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 02:15:55 +00:00
Gary Pendergast
601f5f7376 Build Tools: Pass the LOCAL_DIR environment variable through to the phpunit Docker container.
This allows code running inside the container to know whether it's supposed to be running in `build` or `src`.

See #47767.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 01:56:56 +00:00
Sergey Biryukov
6330f10b7d Date/Time: Revert unintended changes from [45882].
Props TimothyBlynJacobs.
See #25768.
Built from https://develop.svn.wordpress.org/trunk@45884


git-svn-id: http://core.svn.wordpress.org/trunk@45695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 01:16:53 +00:00
Sergey Biryukov
6e555f0c77 Date/Time: Introduce current_datetime() for better time operations.
Returning a `DateTimeImmutable` representation of the current moment in time, this allows for a more flexible and reliable use than `current_time()` provides.

Props Rarst.
Fixes #47464.
Built from https://develop.svn.wordpress.org/trunk@45883


git-svn-id: http://core.svn.wordpress.org/trunk@45694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 01:12:55 +00:00
Sergey Biryukov
6f8e50c7f0 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.
Built from https://develop.svn.wordpress.org/trunk@45882


git-svn-id: http://core.svn.wordpress.org/trunk@45693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 00:57:56 +00:00
desrosj
e7c8b21e71 Coding Standards: Dynamic hooks should be named using interpolation not concatenation.
Props arena, desrosj.
Fixes #47052.
Built from https://develop.svn.wordpress.org/trunk@45881


git-svn-id: http://core.svn.wordpress.org/trunk@45692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-22 19:08:55 +00:00
Sergey Biryukov
d309715a95 Coding Standards: Add missing break for the default case in wp_privacy_anonymize_data().
Props itowhid06.
Fixes #47921.
Built from https://develop.svn.wordpress.org/trunk@45877


git-svn-id: http://core.svn.wordpress.org/trunk@45688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-22 14:50:55 +00:00
Sergey Biryukov
8d919b09d4 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.
Built from https://develop.svn.wordpress.org/trunk@45876


git-svn-id: http://core.svn.wordpress.org/trunk@45687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-22 03:11:55 +00:00
Gary Pendergast
1f8563d8e7 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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-22 02:29:54 +00:00
Sergey Biryukov
ad7b2949ba 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.
Built from https://develop.svn.wordpress.org/trunk@45874


git-svn-id: http://core.svn.wordpress.org/trunk@45685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-22 01:53:55 +00:00
Sergey Biryukov
f6fc8025c4 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.
Built from https://develop.svn.wordpress.org/trunk@45873


git-svn-id: http://core.svn.wordpress.org/trunk@45684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-22 00:22:56 +00:00
Sergey Biryukov
36b4debdb4 Docs: Correct type for the $deprecated argument of get_terms().
Props itowhid06.
Fixes #47915.
Built from https://develop.svn.wordpress.org/trunk@45872


git-svn-id: http://core.svn.wordpress.org/trunk@45683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-21 16:27:55 +00:00
Sergey Biryukov
3d12c4b6d8 Docs: Fix typo in _wp_make_subsizes() DocBlock.
Props itowhid06.
Fixes #47913. See #40439.
Built from https://develop.svn.wordpress.org/trunk@45871


git-svn-id: http://core.svn.wordpress.org/trunk@45682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-21 16:23:56 +00:00
Sergey Biryukov
f8fb93cd0d 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.
Built from https://develop.svn.wordpress.org/trunk@45869


git-svn-id: http://core.svn.wordpress.org/trunk@45680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-21 00:27:57 +00:00
Sergey Biryukov
6b9ab1c5c5 Docs: Update @since tag for new JS functions and variables introduced in [45572].
Props garrett-eclipse.
See #47145.
Built from https://develop.svn.wordpress.org/trunk@45867


git-svn-id: http://core.svn.wordpress.org/trunk@45678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 22:54:55 +00:00
Sergey Biryukov
40d4037fa6 Twenty Seventeen: Fix tabs vs. spaces in [45764].
See #47414.
Built from https://develop.svn.wordpress.org/trunk@45863


git-svn-id: http://core.svn.wordpress.org/trunk@45674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 19:12:50 +00:00
Sergey Biryukov
18d991bfc0 Twenty Eleven: Fix tabs vs. spaces in [45763].
See #47414.
Built from https://develop.svn.wordpress.org/trunk@45862


git-svn-id: http://core.svn.wordpress.org/trunk@45673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 19:11:55 +00:00
Sergey Biryukov
561e17c1a4 Twenty Seventeen: Adjust [45764] to conform to CSS Coding Standards.
See #47414.
Built from https://develop.svn.wordpress.org/trunk@45861


git-svn-id: http://core.svn.wordpress.org/trunk@45672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 19:07:49 +00:00
Sergey Biryukov
4a8c0b1498 Twenty Eleven: Adjust [45763] to conform to CSS Coding Standards.
See #47414.
Built from https://develop.svn.wordpress.org/trunk@45860


git-svn-id: http://core.svn.wordpress.org/trunk@45671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 19:06:54 +00:00
Sergey Biryukov
9793494a2c Tests: Remove $wpdb global reference from test_wp_insert_user_with_empty_data().
See #47902.
Built from https://develop.svn.wordpress.org/trunk@45859


git-svn-id: http://core.svn.wordpress.org/trunk@45670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 17:28:56 +00:00
Sergey Biryukov
022de7321e Users: In wp_insert_user(), account for the wp_pre_insert_user_data filter returning empty data.
Props juliobox, SergeyBiryukov.
Fixes #47902.
Built from https://develop.svn.wordpress.org/trunk@45858


git-svn-id: http://core.svn.wordpress.org/trunk@45669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 17:26:55 +00:00
Sergey Biryukov
bdb1811935 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.
Built from https://develop.svn.wordpress.org/trunk@45857


git-svn-id: http://core.svn.wordpress.org/trunk@45668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 01:35:56 +00:00
Sergey Biryukov
349e9f56c1 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.
Built from https://develop.svn.wordpress.org/trunk@45856


git-svn-id: http://core.svn.wordpress.org/trunk@45667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-19 21:07:50 +00:00
Sergey Biryukov
26f8b67e35 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.
Built from https://develop.svn.wordpress.org/trunk@45855


git-svn-id: http://core.svn.wordpress.org/trunk@45666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-19 21:06:55 +00:00
Sergey Biryukov
46ca606114 Coding Standards: Use KB_IN_BYTES in get_file_data().
See #22405, #47632.
Built from https://develop.svn.wordpress.org/trunk@45854


git-svn-id: http://core.svn.wordpress.org/trunk@45665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-19 20:10:55 +00:00
Sergey Biryukov
4896dc64ee 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.
Built from https://develop.svn.wordpress.org/trunk@45853


git-svn-id: http://core.svn.wordpress.org/trunk@45664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-19 19:08:59 +00:00