Commit Graph

40117 Commits

Author SHA1 Message Date
Felix Arntz
4572bb0988 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@45910 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-29 12:41:45 +00:00
Mike Schroder
65f3124283 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45909 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-29 07:52:43 +00:00
Sergey Biryukov
71697aefc0 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45908 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-29 05:06:15 +00:00
Sergey Biryukov
f490fb924d Coding Standards: Fix WPCS issue in [45906].
See #45322.

git-svn-id: https://develop.svn.wordpress.org/trunk@45907 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-29 02:39:21 +00:00
Sergey Biryukov
c3e89c2190 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45906 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-29 02:09:42 +00:00
Sergey Biryukov
5a1e3649c4 Site Health: Merge two similar strings explaining what drop-in plugins are.
Props garrett-eclipse, ramiy, Clorith.
Fixes #47247.

git-svn-id: https://develop.svn.wordpress.org/trunk@45905 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-28 03:12:09 +00:00
Sergey Biryukov
83efbc67e3 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45904 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-28 03:07:59 +00:00
K. Adam White
2d0cb482ed 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@45903 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-28 03:07:03 +00:00
Sergey Biryukov
dfe51f6069 Date/Time: Correct delta comparison in test_should_return_wp_timestamp().
See #25768.

git-svn-id: https://develop.svn.wordpress.org/trunk@45902 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-28 02:19:46 +00:00
Sergey Biryukov
a4723edc50 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45901 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-28 00:51:16 +00:00
Sergey Biryukov
6c8b425d71 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45900 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-27 21:54:58 +00:00
Sergey Biryukov
dea752ab65 Docs: Clarify that $name and $value parameters of set_user_setting() can contain hyphens.
Props tmatsuur.
Fixes #47938.

git-svn-id: https://develop.svn.wordpress.org/trunk@45899 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-27 01:16:20 +00:00
Sergey Biryukov
62a87563d7 Docs: Remove a clarification from do_robots() description that doesn't really clarify anything.
See #47110.

git-svn-id: https://develop.svn.wordpress.org/trunk@45898 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-27 00:16:06 +00:00
Sergey Biryukov
ef69d4ba14 Twenty Nineteen: Make sure center-aligned images in columns do not break beyond the column boundaries.
Props kjellr.
Fixes #47937.

git-svn-id: https://develop.svn.wordpress.org/trunk@45897 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-26 19:00:46 +00:00
Sergey Biryukov
c8bd4cbae4 Twenty Nineteen: Update style-rtl.css after [45773].
See #47850.

git-svn-id: https://develop.svn.wordpress.org/trunk@45896 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-26 18:59:39 +00:00
Sergey Biryukov
144cb531fc 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45895 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-26 16:59:53 +00:00
Boone Gorges
7dac24c681 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45894 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-26 15:23:48 +00:00
Boone Gorges
c2c8a6848d 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45893 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-26 15:18:40 +00:00
Andrew Ozz
152083be8f Docs: Improve and update the description of multi_resize() to explain changes and expected use.
See #40439.

git-svn-id: https://develop.svn.wordpress.org/trunk@45892 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-25 22:20:57 +00:00
Sergey Biryukov
252e14ac27 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45891 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-25 21:31:43 +00:00
Sergey Biryukov
7ef2679ec7 Users: Adjust [45806] to make sure $all_userids is always defined.
Props kbrownkd.
Fixes #47936.

git-svn-id: https://develop.svn.wordpress.org/trunk@45890 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-25 20:02:31 +00:00
Sergey Biryukov
2e1de7309c Site Health: Add timezone to Site Health Info page.
Props justinahinon, sharaz, artisticasad, Rarst.
Fixes #47842.

git-svn-id: https://develop.svn.wordpress.org/trunk@45889 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-24 19:36:33 +00:00
Boone Gorges
3e704473e7 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45888 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-23 16:04:07 +00:00
Sergey Biryukov
ae2b4f9add 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45887 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-23 11:02:51 +00:00
Sergey Biryukov
b975a251ff 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45886 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-23 02:14:07 +00:00
Gary Pendergast
ece257ffd0 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.



git-svn-id: https://develop.svn.wordpress.org/trunk@45885 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-23 01:55:28 +00:00
Sergey Biryukov
ff36b9664f Date/Time: Revert unintended changes from [45882].
Props TimothyBlynJacobs.
See #25768.

git-svn-id: https://develop.svn.wordpress.org/trunk@45884 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-23 01:15:16 +00:00
Sergey Biryukov
1c66cf519b 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45883 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-23 01:11:22 +00:00
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