Commit Graph

28015 Commits

Author SHA1 Message Date
Sergey Biryukov
d858656023 Bootstrap/Load: Make handling the /favicon.ico requests more flexible.
Previously, `wp_favicon_request()` was introduced in [13205] to avoid a performance hit of serving a full 404 page on every favicon request.

While working as intended, that implementation did not provide a way for theme or plugin authors to manage the behavior of favicon requests.

This changeset implements the following logic (only applied if WordPress is installed in the root directory):

* If there is a Site Icon set in Customizer, redirect `/favicon.ico` requests to that icon.
* Otherwise, use the WordPress logo as a default icon.
* If a physical `/favicon.ico` file exists, do nothing, let the server handle the request.

Handling `/favicon.ico` is now more consistent with handling `/robots.txt` requests.

New functions and hooks:

* Introduce `is_favicon()` conditional tag to complement `is_robots()`.
* Introduce `do_favicon` action to complement `do_robots` and use it in template loader.
* Introduce `do_favicon()` function, hooked to the above action by default, to complement `do_robots()`.
* Introduce `do_faviconico` action to complement `do_robotstxt`, for plugins to override the default behavior.
* Mark `wp_favicon_request()` as deprecated in favor of `do_favicon()`.

Props jonoaldersonwp, birgire, joostdevalk, mukesh27, SergeyBiryukov.
Fixes #47398.
Built from https://develop.svn.wordpress.org/trunk@47018


git-svn-id: http://core.svn.wordpress.org/trunk@46818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-28 21:20:04 +00:00
Sergey Biryukov
c546aa36ec Docs: Improve @return description for wp_update_comment() and WP_UnitTest_Factory_For_Comment::update_object().
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47017


git-svn-id: http://core.svn.wordpress.org/trunk@46817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-27 00:30:02 +00:00
Sergey Biryukov
7970e62c06 Coding Standards: Fix WPCS issue in [47015].
See #49082.
Built from https://develop.svn.wordpress.org/trunk@47016


git-svn-id: http://core.svn.wordpress.org/trunk@46816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-26 15:53:02 +00:00
Sergey Biryukov
7c2275dfe4 Docs: Fix typo in wp_dashboard_cached_rss_widget() documentation.
Props mukesh27.
Fixes #49082.
Built from https://develop.svn.wordpress.org/trunk@47015


git-svn-id: http://core.svn.wordpress.org/trunk@46815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-26 14:42:03 +00:00
Sergey Biryukov
a814d6e363 Tests: Set network_id instead of site_id in WP_UnitTest_Factory_For_Blog defaults.
Follow-up to [47011], [47013].

See #47195.
Built from https://develop.svn.wordpress.org/trunk@47014


git-svn-id: http://core.svn.wordpress.org/trunk@46814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-26 00:27:03 +00:00
Sergey Biryukov
5e236248e4 Tests: Update legacy arguments passed to WP_UnitTest_Factory_For_Blog::create_object().
This converts the arguments originally meant for `wpmu_create_blog()` to the ones used by `wp_insert_site()`.

Follow-up to [47011].

Fixes #47195.
Built from https://develop.svn.wordpress.org/trunk@47013


git-svn-id: http://core.svn.wordpress.org/trunk@46813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-25 21:41:02 +00:00
Sergey Biryukov
cf54349cb7 Tests: Replace most instances of wpmu_delete_blog() not specifically testing that function with wp_delete_site().
Follow-up to [47011].

See #47195.
Built from https://develop.svn.wordpress.org/trunk@47012


git-svn-id: http://core.svn.wordpress.org/trunk@46812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-25 18:17:01 +00:00
Sergey Biryukov
e2231ec703 Tests: Switch WP_UnitTest_Factory_For_Blog::create_object() to use wp_insert_site().
Map some arguments for backward compatibility with `wpmu_create_blog()` previously used there.

Props davidbaumwald, danielbachhuber, jeremyfelt, SergeyBiryukov.
See #47195.
Built from https://develop.svn.wordpress.org/trunk@47011


git-svn-id: http://core.svn.wordpress.org/trunk@46811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-25 18:12:02 +00:00
Sergey Biryukov
8990cf9296 Media: Make sure attachment_url_to_postid() performs a case-sensitive search for the uploaded file name.
Previously, the first available match was returned, regardless of the case, which was not always the expected result.

Props archon810, ben.greeley, tristangemus, vsamoletov, SergeyBiryukov.
Fixes #39768.
Built from https://develop.svn.wordpress.org/trunk@47010


git-svn-id: http://core.svn.wordpress.org/trunk@46810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-25 02:26:03 +00:00
Sergey Biryukov
8073fd3ec0 Docs: Use a third-person singular verb for comment template function descriptions, per the documentation standards.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47009


git-svn-id: http://core.svn.wordpress.org/trunk@46809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-24 16:19:01 +00:00
Sergey Biryukov
9c68816a21 Docs: Improve documentation for get_comment_author_url().
Props stevenlinx.
Fixes #49076.
Built from https://develop.svn.wordpress.org/trunk@47008


git-svn-id: http://core.svn.wordpress.org/trunk@46808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-24 16:10:05 +00:00
Sergey Biryukov
bb70f4e530 Docs: Correct the note about the CORE_UPGRADE_SKIP_NEW_BUNDLED constant in $_new_bundled_files global description.
In order to tell WordPress not to install new bundled themes on update, `CORE_UPGRADE_SKIP_NEW_BUNDLED` should be set to `true`, as the name suggests, not `false`.

Follow-up to [39064].

Props tomgreer, knutsp, crdunst.
See #49056.
Built from https://develop.svn.wordpress.org/trunk@47007


git-svn-id: http://core.svn.wordpress.org/trunk@46807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-23 18:00:02 +00:00
Sergey Biryukov
246a035d99 Docs: Improve documentation for admin menu functions:
* `get_admin_page_parent()`
* `get_admin_page_title()`
* `get_plugin_page_hook()`
* `get_plugin_page_hookname()`
* `user_can_access_admin_page()`

Add missing descriptions and `@since` tags.

Props subrataemfluence, kennithnichol, stevenlinx, SergeyBiryukov.
Fixes #44253, #49067.
Built from https://develop.svn.wordpress.org/trunk@47006


git-svn-id: http://core.svn.wordpress.org/trunk@46806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-23 14:36:04 +00:00
Sergey Biryukov
f501814eac Upgrade/Install: When creating the .htaccess file in insert_with_markers(), make sure it has 0644 as a minimum set of permissions.
Props rcutmore, dd32, i3anaan.
Fixes #40572.
Built from https://develop.svn.wordpress.org/trunk@47005


git-svn-id: http://core.svn.wordpress.org/trunk@46805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-22 02:45:03 +00:00
Sergey Biryukov
9b3a895631 Shortcodes: Introduce apply_shortcodes() as an alias for do_shortcode().
This better aligns with the semantics of applying filters to the input and returning a result, rather than performing an action and outputting to the current buffer.

Props ljasinskipl, thefarlilacfield.
Fixes #37422.
Built from https://develop.svn.wordpress.org/trunk@47004


git-svn-id: http://core.svn.wordpress.org/trunk@46804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-21 20:12:03 +00:00
Sergey Biryukov
5e8fe89ef5 Shortcodes: Make sure wp.shortcode.string() accepts the attrs array keys in any order.
Props yale01, georgestephanis, adamsilverstein, zsusag, mircoraffinetti, SergeyBiryukov.
Fixes #36263.
Built from https://develop.svn.wordpress.org/trunk@47003


git-svn-id: http://core.svn.wordpress.org/trunk@46803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-21 18:34:04 +00:00
Sergey Biryukov
27d9bac051 Administration: Add doing_wp_cron to wp_removable_query_args().
It's a single-use URL parameter that does not need to be passed to canonical URLs in the admin.

Props dlh.
Fixes #49017.
Built from https://develop.svn.wordpress.org/trunk@47002


git-svn-id: http://core.svn.wordpress.org/trunk@46802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-21 16:14:04 +00:00
Sergey Biryukov
7b70f584a7 Tests: Don't fail the test in WP_UnitTestCase_Base::skipOnAutomatedBranches() if Travis environment variables are unavailable, it prevents from running the test locally.
Follow-up to [47000].

See #49050.
Built from https://develop.svn.wordpress.org/trunk@47001


git-svn-id: http://core.svn.wordpress.org/trunk@46801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-20 12:15:04 +00:00
Sergey Biryukov
01b91b2a0f Tests: Correct the check for pull requests in WP_UnitTestCase_Base::skipOnAutomatedBranches().
Mark the test as failed if the environment variables are unavailable.

Fixes #49050.
Built from https://develop.svn.wordpress.org/trunk@47000


git-svn-id: http://core.svn.wordpress.org/trunk@46800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-20 01:12:01 +00:00
Sergey Biryukov
a5deda7083 Build/Test Tools: Pass the TRAVIS_BRANCH and TRAVIS_PULL_REQUEST environment variables along to the Docker container.
This ensures that `WP_UnitTestCase::skipOnAutomatedBranches()` has access to these variables.

See #49050, #47767.
Built from https://develop.svn.wordpress.org/trunk@46999


git-svn-id: http://core.svn.wordpress.org/trunk@46799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-20 00:03:01 +00:00
Sergey Biryukov
d391a2633c Tests: Skip external HTTP test for recommended PHP and MySQL versions on 503 errors.
Fixes #49049.
Built from https://develop.svn.wordpress.org/trunk@46998


git-svn-id: http://core.svn.wordpress.org/trunk@46798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-19 20:29:01 +00:00
whyisjake
464615e876 Editor: Add unit tests for v5.3.1 block serialization functions
r46896 was intended to have included unit tests for the block serialization functions added as part of the changeset.

Props: @aduth.
Fixes: #49048 


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


git-svn-id: http://core.svn.wordpress.org/trunk@46797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-19 18:50:01 +00:00
Sergey Biryukov
5d5bf01d12 Tests: In test_readme(), if the HTTP request to secure.php.net or dev.mysql.com failed, include response code in the error message.
See #40533, #44613.
Built from https://develop.svn.wordpress.org/trunk@46996


git-svn-id: http://core.svn.wordpress.org/trunk@46796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-19 15:45:05 +00:00
Sergey Biryukov
c677634788 Tests: Remove unused cache keys from data_get_site_caches().
Follow-up to [46990].

See #40363.
Built from https://develop.svn.wordpress.org/trunk@46991


git-svn-id: http://core.svn.wordpress.org/trunk@46791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 03:22:02 +00:00
Sergey Biryukov
5f6a36ceb6 Networks and Sites: Remove invalidation of unused cache keys in clean_blog_cache().
Props spacedmonkey, flixos90, thamaraiselvam.
Fixes #40363.
Built from https://develop.svn.wordpress.org/trunk@46990


git-svn-id: http://core.svn.wordpress.org/trunk@46790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 02:59:02 +00:00
Sergey Biryukov
4edec193bc Users: When creating the first user on installation, populate the Website profile field with the site URL.
Skip setting the field if the user already exists, which is the case when the user tables are being shared among multiple sites.

Props EFAREM, eclare, darrenlambert, zachflauaus, viralsampat.
Fixes #35778.
Built from https://develop.svn.wordpress.org/trunk@46989


git-svn-id: http://core.svn.wordpress.org/trunk@46789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 02:26:03 +00:00
Sergey Biryukov
694913d65f I18N: Make the minimum input length to start searching posts in the "Insert/edit link" modal localizable.
Props Toro_Unit, birgire, miyauchi, swissspidy, ocean90.
Fixes #44662.
Built from https://develop.svn.wordpress.org/trunk@46988


git-svn-id: http://core.svn.wordpress.org/trunk@46788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 01:15:03 +00:00
Sergey Biryukov
6e7080036f Docs: Improve comments in tests/formatting/redirect.php per the documentation standards.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46987


git-svn-id: http://core.svn.wordpress.org/trunk@46787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 00:28:01 +00:00
Sergey Biryukov
8c709ed78c Docs: Add @method notation for WP_UnitTest_Factory_For_Term::create_and_get() for consistency with other factories.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46986


git-svn-id: http://core.svn.wordpress.org/trunk@46786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 00:26:02 +00:00
Sergey Biryukov
396647666f Docs: Various documentation fixes for unit test factories.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46985


git-svn-id: http://core.svn.wordpress.org/trunk@46785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 00:19:02 +00:00
Sergey Biryukov
2cf3fb14ee Tests: Use delta comparison in test_should_fall_back_to_last_post_modified() to avoid race conditions.
See #48957.
Built from https://develop.svn.wordpress.org/trunk@46981


git-svn-id: http://core.svn.wordpress.org/trunk@46781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 21:33:02 +00:00
Andrew Ozz
6403619f92 Upload: Run the final file name collision test in wp_unique_filename() for each existing file + 1.
Props pbiron.
See #48975.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 20:52:03 +00:00
Sergey Biryukov
da041582df Date/Time: Ensure that get_feed_build_date() correctly handles a modified post object with invalid date.
* Clarify in the documentation that the function returns `false` on failure.
* Consistently pass the return value through the `get_feed_build_date` filter.

Props Rarst, dd32, azaozz, tellyworth.
Fixes #48957.
Built from https://develop.svn.wordpress.org/trunk@46974


git-svn-id: http://core.svn.wordpress.org/trunk@46774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 20:43:03 +00:00
Sergey Biryukov
8eb278d19a Docs: Clarify that get_lastpostdate() and get_lastpostmodified() can return false on failure.
The both use `_get_last_post_time()` internally.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 20:26:01 +00:00
Sergey Biryukov
bbd898b1dd Upgrade/Install: Remove unused global in upgrade_430_fix_comments().
Props adnan.limdi.
Fixes #41970.
Built from https://develop.svn.wordpress.org/trunk@46972


git-svn-id: http://core.svn.wordpress.org/trunk@46772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 16:45:03 +00:00
Sergey Biryukov
d273235abd Login/Registration: Pass the error data to the wp_login_failed action.
Props hamedmoodi, rixeo.
Fixes #49007.
Built from https://develop.svn.wordpress.org/trunk@46971


git-svn-id: http://core.svn.wordpress.org/trunk@46771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 15:36:01 +00:00
Sergey Biryukov
a79636f82a Docs: Correct @type for timeout argument in WP_Http::request().
Props georgestephanis, benedictsinger.
Fixes #49005.
Built from https://develop.svn.wordpress.org/trunk@46970


git-svn-id: http://core.svn.wordpress.org/trunk@46770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 15:25:01 +00:00
Sergey Biryukov
18b0cd4f7d Date/Time: Add a unit test for [46968].
See #48145.
Built from https://develop.svn.wordpress.org/trunk@46969


git-svn-id: http://core.svn.wordpress.org/trunk@46769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 14:37:02 +00:00
Sergey Biryukov
c0b6dffffc Date/Time: In wp_insert_post(), when checking the post date to set future or publish status, use a proper delta comparison.
[3525] allowed a difference up to 59 seconds between the post date/time and the current time to consider the post published instead of scheduled, but that didn't take start of a new minute into account.

Rapidly creating post fixtures in unit tests could encounter a one-second discrepancy between `current_time( 'mysql' )` and `gmdate( 'Y-m-d H:i:s' )`, returning values like `2019-12-16 23:43:00` vs. `2019-12-16 23:42:59`, respectively, and setting the post to a `future` status instead of `publish`.

[45851], while working as intended, made the issue somewhat more likely to occur.

This caused all sorts of occasional random failures in various tests on Travis, mostly on PHP 7.1.

Fixes #48145.
Built from https://develop.svn.wordpress.org/trunk@46968


git-svn-id: http://core.svn.wordpress.org/trunk@46768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 02:25:03 +00:00
Andrew Ozz
c67c3ee6a0 Fix the colors in all color schemes for the .active class for buttons.
Props ryelle, audrasjb.
Fixes #49003 for trunk.
Built from https://develop.svn.wordpress.org/trunk@46967


git-svn-id: http://core.svn.wordpress.org/trunk@46767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 00:15:03 +00:00
Andrew Ozz
ef7326129f Upload: Fix the final file name collision test in wp_unique_filename() when uploading a file with upper case extension. Add a unit test to catch that in the future.
Fixes #48975 for trunk.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-16 23:44:04 +00:00
Andrew Ozz
e0ace80488 Upload:
- Fix PHP warnings in `wp_unique_filename()` when the destination directory is unreadable.
- Run the final name collision test only for files that are saved to the uploads directory.
- Update the unit tests to match.

Props eden159, audrasjb, azaozz.
Fixes #48960 for trunk.
Built from https://develop.svn.wordpress.org/trunk@46965


git-svn-id: http://core.svn.wordpress.org/trunk@46765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-16 23:23:06 +00:00
Sergey Biryukov
8894c0f1a2 Coding Standards: Use strict comparison in wp-admin/widgets.php.
Props jenilk.
Fixes #49000.
Built from https://develop.svn.wordpress.org/trunk@46964


git-svn-id: http://core.svn.wordpress.org/trunk@46764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-16 12:55:03 +00:00
Sergey Biryukov
5b9fd2d7e7 Coding Standards: Use strict comparison in wp-admin/includes/network.php.
Props ataurr.
Fixes #48994.
Built from https://develop.svn.wordpress.org/trunk@46963


git-svn-id: http://core.svn.wordpress.org/trunk@46763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-16 12:37:06 +00:00
Sergey Biryukov
6d40400756 Coding Standards: Use strict comparison in wp-admin/edit-tags.php.
Props passoniate.
Fixes #48985.
Built from https://develop.svn.wordpress.org/trunk@46962


git-svn-id: http://core.svn.wordpress.org/trunk@46762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-15 10:46:02 +00:00
Sergey Biryukov
087282e810 Coding Standards: Use strict comparison in wp-admin/term.php.
Props vinita29.
Fixes #48983.
Built from https://develop.svn.wordpress.org/trunk@46961


git-svn-id: http://core.svn.wordpress.org/trunk@46761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-15 09:45:01 +00:00
Sergey Biryukov
35b29f11b3 Coding Standards: Add missing braces to if conditions in js/_enqueues/wp/util.js.
Props ankitmaru.
Fixes #48980.
Built from https://develop.svn.wordpress.org/trunk@46960


git-svn-id: http://core.svn.wordpress.org/trunk@46760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-15 08:45:05 +00:00
Sergey Biryukov
1b675c6e4a Formatting: Return early from wp_kses_attr_check() if the element is not in the list of allowed elements and attributes.
Props krynes, tristanleboss.
Fixes #48549.
Built from https://develop.svn.wordpress.org/trunk@46959


git-svn-id: http://core.svn.wordpress.org/trunk@46759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-14 15:53:06 +00:00
Sergey Biryukov
8260786e64 Docs: Clarify descriptions for get_gmt_from_date() and get_date_from_gmt().
Props johnbillion, Rarst.
Fixes #48650.
Built from https://develop.svn.wordpress.org/trunk@46958


git-svn-id: http://core.svn.wordpress.org/trunk@46757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-13 21:45:02 +00:00
Sergey Biryukov
0b8438a6d2 I18N: Replace file names in translatable strings on Permalink Settings screen with placeholders.
Props ramiy.
Fixes #48863.
Built from https://develop.svn.wordpress.org/trunk@46957


git-svn-id: http://core.svn.wordpress.org/trunk@46756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-13 21:27:05 +00:00