The call to `flock()` is an exclusive advisory lock, which in my testing only PHP respects (apache continues to read it).
Not all filesystems support locking (remote NFS mounts for example) so this offers minimal benefit to those platforms, but offers much better protection against file corruption on systems which do support it.
The call is blocking, so a second process will wait for the first to complete before writing if supported.
See #31767
Built from https://develop.svn.wordpress.org/trunk@34740
git-svn-id: http://core.svn.wordpress.org/trunk@34704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes issues where SSH2 with chrooted environments runs into a `Unable to locate WordPress Content directory (wp-content).` error.
The workaround is to simply list the contents of the `/./` directory instead of `/`.
Fixes#33919
Built from https://develop.svn.wordpress.org/trunk@34738
git-svn-id: http://core.svn.wordpress.org/trunk@34702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Specifically, `::insert()`, `::replace()`, `::update()`, and `::delete()` can now set a column to `NULL`, or add the `IS NULL` condition to the `WHERE` clause.
This is based on [backpress 279].
Props pento, nbachiyski, sorich87.
Fixes#15158.
Built from https://develop.svn.wordpress.org/trunk@34737
git-svn-id: http://core.svn.wordpress.org/trunk@34701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
After [34561], `wp_list_comments()` no longer passed all of a post's comments
to `Walker_Comments`. As a result, calls to `get_comment_link()` occurring
inside the comment loop had insufficient context to determine the proper
'cpage' value to use when generating comment permalinks. This, in turn, caused
comment permalinks to behave erratically.
The current changeset addresses the problem as follows:
* `get_comment_link()` now accepts a 'cpage' parameter. When present, 'cpage' will be used to build the comment permalink - no automatic calculation will take place.
* When called within the main loop, `wp_list_comments()` calculates the proper 'cpage' value for comments in the loop, and passes it down to `get_comment_link()`.
* `cpage` and `comment-page-x` query vars are generally required in comment permalinks (see #34068), but an exception is made when 'default_comment_page=oldest': the bare post permalink will always be the same as `cpage=1`, so `cpage` is excluded in this case.
Props peterwilsoncc for assiduous spreadsheeting.
Fixes#34073.
Built from https://develop.svn.wordpress.org/trunk@34735
git-svn-id: http://core.svn.wordpress.org/trunk@34699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This change causes it to list the parent directories files, and assets that the node exists within the returned listing, this is a little more compatible than relying upon the FTP server to correctly filter the returned resultset to the specific file/node being requested.
Fixes#28013
Built from https://develop.svn.wordpress.org/trunk@34733
git-svn-id: http://core.svn.wordpress.org/trunk@34697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`WP_Comment_Query::fill_descendants()` queries for a comment tree in a way that
minimizes database overhead, and places the located descendants with their
proper parents. However, it doesn't touch leaf nodes - comments with no
children - so future calls to `get_children()` on those comment objects
result in unnecessary database queries. To prevent this, `fill_descendants()`
now sets a `populated_children` flag on all located `WP_Comment` objects.
See #8071.
Built from https://develop.svn.wordpress.org/trunk@34730
git-svn-id: http://core.svn.wordpress.org/trunk@34694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[34561] "fixed" the problem of newest-first comments showing fewer than
'per_page' comments on the post permalink when the total number of comments
was not divisible by 'per_page'. See #29462. But this fix caused numerous
other problems. First, comment pages reported by `get_page_of_comment()`
(which expects comment pages to be filled oldest-first) were no longer correct.
Second, and more seriously, the new logic caused comments to be shifted
between pages, making their permalinks non-permanent.
The current changeset reverts the changed behavior. In order to preserve the
performance improvements introduced in [34561], an additional query must be
performed when 'default_comments_page=newest' and 'cpage=0' (ie, you're viewing
the post permalink). A nice side effect of this revert is that we no longer
need the hacks required to determine proper comment pagination, introduced in
[34561].
See #8071. See #34073.
Built from https://develop.svn.wordpress.org/trunk@34729
git-svn-id: http://core.svn.wordpress.org/trunk@34693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add 2 methods to `WP_List_Table`, `->get_orderby()` and `->get_order()`. Override the methods in `WP_Posts_List_Table`.
`WP_Posts_List_Table` calls `wp_edit_posts_query()` in `->prepare_items()` which is a wrapper for `wp()`. As such, we can obtain `orderby` and `order` via `get_query_var()`, instead of the URL.
Fixes#25493.
Built from https://develop.svn.wordpress.org/trunk@34728
git-svn-id: http://core.svn.wordpress.org/trunk@34692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, it was necessary to explain in a double-negative that `$richedit` being false would prevent `$content` from being passed through `esc_textarea()`. The updated `$rich_edit` name and documentation now better reflects the intent of the parameter.
Fixes#21613.
Built from https://develop.svn.wordpress.org/trunk@34727
git-svn-id: http://core.svn.wordpress.org/trunk@34691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Using the same `$post_new_file` global variable name in `wp-admin/menu.php` in [33723] was unintentional, but we're already unsetting other variables that are in global scope so we can just unset this one as well. Someday the admin menu won't be a big pile of sad and cryptic globals. Maybe.
props johnjamesjacoby, norcross.
fixes#34045.
Built from https://develop.svn.wordpress.org/trunk@34723
git-svn-id: http://core.svn.wordpress.org/trunk@34687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[34718] introduced a 'db_version' check to term meta functions, to ensure that
they don't run when the term meta schema is not yet in place. This call to
`get_option()` causes a database hit during Multisite tests, due to the
presence of the `WP_INSTALLING` constant. See #31130. The extra database
queries are causing cache tests to fail.
In similar cases, we have `markTestSkipped()` when `is_multisite()`. Because
the term meta API is so extensive - term meta caches can be primed anywhere a
`WP_Query` loop is fired up - we implement a more generous workaround in this
case. To prevent `get_option( 'db_version' )` from hitting the database during
multisite unit tests, we use a 'pre_option_' filter.
Heaven help us.
See #34091.
Built from https://develop.svn.wordpress.org/trunk@34719
git-svn-id: http://core.svn.wordpress.org/trunk@34683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Termmeta cache priming was throwing database errors on installations that had
not yet gone through the database update routine. To avoid errors in all cases,
the check has been added to all termmeta functions. These checks will be
removed in a future version of WordPress. (Hang on to your hats!)
Fixes#34091.
Built from https://develop.svn.wordpress.org/trunk@34718
git-svn-id: http://core.svn.wordpress.org/trunk@34682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The addition of these new arguments brings `get_the_post_navigation()` into argument parity with `get_previous_post_link()` and `get_next_post_link()`, both of which it wraps, and will allow for more flexibility in configuring the next and previous post links for simultaneous display in themes.
Props ChaseWiseman.
Fixes#32618.
Built from https://develop.svn.wordpress.org/trunk@34715
git-svn-id: http://core.svn.wordpress.org/trunk@34679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The tests included in [34669] contained a couple of problems:
* Comments were not always created in the expected order, due to the incorrect use of 'comment_date_gmt'.
* 'asc'/'desc' and 'older'/'newer' were confused.
* 'default_comments_page=newest' ('last') didn't properly account for the cpage=1 offset.
The code itself powering this pagination was correct; it's only the tests that
were wrong.
See #8071.
Built from https://develop.svn.wordpress.org/trunk@34713
git-svn-id: http://core.svn.wordpress.org/trunk@34677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Lazy-loading logic is moved to a method on `WP_Query`. This makes it possible
for comment feeds to take advantage of metadata lazyloading, in addition to
comments loaded via `comments_template()`.
This new technique parallels the termmeta lazyloading technique introduced in
[34704].
Fixes#34047.
Built from https://develop.svn.wordpress.org/trunk@34711
git-svn-id: http://core.svn.wordpress.org/trunk@34675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[34529] introduced lazyloading for the metadata belonging to terms matching
posts in the main `WP_Query`. The current changeset improves this technique
in the following ways:
* Term meta lazyloading is now performed on the results of all `WP_Query` queries, not just the main query.
* Fewer global variable touches and greater encapsulation.
* The logic for looping through posts to identify terms is now only performed once per `WP_Query`.
Props dlh, boonebgorges.
See #34047.
Built from https://develop.svn.wordpress.org/trunk@34704
git-svn-id: http://core.svn.wordpress.org/trunk@34668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The 'exclude_tree' parameter must be compatible with 'hierarchical';
previously, 'hierarchical' canceled it out. This changeset also makes it so
that 'exclude_tree' is compatible with 'exclude'. When both are passed, and
'hierarchical' is true, the descendant trees of terms in both parameters will
be excluded from matched terms.
Props tott, webord, MikeHansenMe.
Fixes#12981.
Built from https://develop.svn.wordpress.org/trunk@34696
git-svn-id: http://core.svn.wordpress.org/trunk@34660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, unattached attachments would have unsightly `/?attachment_id=1` URLs. As we've moved away from attachments being specifically attached to posts, instead being Media items, this has made the unattached URLs a more common occurrence.
We can breath easy once more, knowing that the world is a little bit safer from the horror of unnecessarily ugly URLs.
Props SergeyBiryukov, wonderboymusic, pento.
Fixes#1914.
Built from https://develop.svn.wordpress.org/trunk@34690
git-svn-id: http://core.svn.wordpress.org/trunk@34654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`the_author_posts_link()` has in-turn been converted into a wrapper, with most of its logic moved to the new function.
Adds tests for the new function.
Props chipbennett, zrothauser, wonderboymusic, DrewAPicture.
Fixes#30355.
Built from https://develop.svn.wordpress.org/trunk@34677
git-svn-id: http://core.svn.wordpress.org/trunk@34641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Square brackets must be encoded in the path, path parameters, query parameters, and fragment, but must not be encoded in anything up to the domain and port.
Adds a bunch of tests, including square brackets in query parameters, IPv6 URLs, and several other permutations.
See #16859
Built from https://develop.svn.wordpress.org/trunk@34674
git-svn-id: http://core.svn.wordpress.org/trunk@34638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously there were two persistent "View Post" links on an edit screen: next to the permalink and in the toolbar. This would then become three links after a post was published or updated, as a link is also included in the admin notice. This is a lot of redundancy and visual noise for a flow that is not your primary action upon starting to edit a post. The "View Post" link next to the sample permalink was particularly bad because it is styled like a button, but unlike a button, does not keep you on the current screen.
Because the permalink is now linked, there is no highlighted slug that you can click to edit, but rather just the "Edit" button.
props scribu, lessbloat, sabreuse, SergeyBiryukov, DrewAPicture, helen.
see #18306.
Built from https://develop.svn.wordpress.org/trunk@34670
git-svn-id: http://core.svn.wordpress.org/trunk@34634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The old comment pagination logic had a separate block for comment threads that
appeared on a single page. After the refactoring in [34561], all comment
pagination logic is unified.
This change ensures that 'comment_order' is respected in all scenarios.
Fixes#8071.
Built from https://develop.svn.wordpress.org/trunk@34669
git-svn-id: http://core.svn.wordpress.org/trunk@34633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Historically, `wp_old_slug_redirect()` has only ever redirected the old slug of posts, it hasn't included URL endpoints, or worked with comment feed URLs. By adding support for these, we ensure a greater range of URLs aren't killed when the slug changes.
Props swissspdy.
Fixes#33920.
Built from https://develop.svn.wordpress.org/trunk@34659
git-svn-id: http://core.svn.wordpress.org/trunk@34623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [30298] the unit tests default confirguration was modified to exclude external-http tests. This change was never migrated to the multisite XML configuration. The external HTTP code doesn't follow different logic in multisite, so the logic to exclude the tests then ( The external-http tests are very slow, and Wp_Http functionality is fairly isolated ) holds true here as well.
See #33968
Built from https://develop.svn.wordpress.org/trunk@34656
git-svn-id: http://core.svn.wordpress.org/trunk@34620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, we'd run the sanity checks if `is_mysql` was not set to `false`. This caused problems for DB drop-ins that didn't define `is_mysql` at all. Instead, we can just check if `is_mysql` is `empty()`.
Also fix some unit tests that accidently ran correctly because of the strict `false ===` comparison.
Fixes#33501.
Built from https://develop.svn.wordpress.org/trunk@34655
git-svn-id: http://core.svn.wordpress.org/trunk@34619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Adds a matrix-like data table demonstrating which arguments are available for the different `$action` types
* Adjusts the return types to accommodate an `array` for the 'hot_tags' `$action` choice
Props ocean90.
See #34035.
Built from https://develop.svn.wordpress.org/trunk@34641
git-svn-id: http://core.svn.wordpress.org/trunk@34605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds:
* A hash notation with descriptions for all accepted arguments
* A matrix-like data table demonstrating which arguments are available for the different `$action` types
* A better summary and description with linked hooks
* An improved return description with a link to external information
Props ocean90.
See #34036.
Built from https://develop.svn.wordpress.org/trunk@34640
git-svn-id: http://core.svn.wordpress.org/trunk@34604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Normally when there are multiple comma-separated values in CSS, each one would go on its own indented line. However, Autoprefixer appears to be tripping up on gradients at the moment, so it's going to stay on one line until we investigate upstream.
see #33299.
Built from https://develop.svn.wordpress.org/trunk@34637
git-svn-id: http://core.svn.wordpress.org/trunk@34601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When passing a value of 'slug' to `wp_insert_term()` that contains non-ASCII
characters, WordPress converts accented characters to non-accented versions.
(See `sanitize_title()` and `remove_accents()`.) The same conversion happens
when fetching when fetching a term using a slug. In this way, it's possible to
create a term and fetch it using the same accented string, even though the slug
is actually stored with non-accented characters.
See #16282.
Built from https://develop.svn.wordpress.org/trunk@34628
git-svn-id: http://core.svn.wordpress.org/trunk@34592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Used to filter categories as structured data, before building markup in
`get_the_category_list()`.
We use this filter in addition to upstream filters (such as
'get_the_categories'`) because those upstream filters are used in numerous
contexts, while `'the_category_list'` is always used for generating markup
for display.
Props KevinB, ericlewis, SergeyBiryukov, DrewAPicture.
Fixes#9227.
Built from https://develop.svn.wordpress.org/trunk@34625
git-svn-id: http://core.svn.wordpress.org/trunk@34589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Changing the `show_on_front` option back to "posts" also resets the `page_on_front` and `page_for_posts` options when updating via the Reading settings page. In the Customizer, however, this is not the case as these other options remain unchanged. This change accounts for this difference in behavior.
Fixes#34004.
Built from https://develop.svn.wordpress.org/trunk@34605
git-svn-id: http://core.svn.wordpress.org/trunk@34569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[34583] modified comment queries so that all post fields are no longer loaded
by default. Instead, they are loaded only when requested on individual comment
objects. This changeset improves that flow:
* `WP_Comment` magic methods `__isset()` and `__get()` should only load the post when a post field is being requested.
* The new `update_comment_post_cache` argument for `WP_Comment_Query` allows developers to specify that, when comments are queried, all of the posts matching those comments should be loaded into cache with a single DB hit. This parameter defaults to false, since typical comment queries are linked to a single post.
Fixes#27571.
Built from https://develop.svn.wordpress.org/trunk@34599
git-svn-id: http://core.svn.wordpress.org/trunk@34563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Also fixes up some formatting in the DocBlock summary and description, and adds a link to the function reference, where supplementary information on return object structs and formatting will live.
Props ocean90.
Fixes#34035.
Built from https://develop.svn.wordpress.org/trunk@34596
git-svn-id: http://core.svn.wordpress.org/trunk@34560 1a063a9b-81f0-0310-95a4-ce76da25c4cd