The logic for determining the appropriate character set and collation to use is becoming more complex, particularly with the recent additions of [37522] and [37523]. As `init_charset()` has side effects, and makes use of constants instead of parameters, it's not possible to unit test this logic.
This commit splits the logic part of `init_charset()` out into a new method, `wpdb::determine_charset()`, along with appropriate unit tests.
See #32105, #37522.
Fixes#36917.
git-svn-id: https://develop.svn.wordpress.org/trunk@37601 602fd350-edb4-49c9-b593-d223f7449a82
Prior to [37572], arguments passed to `get_terms()` were passed immediately
through `wp_parse_args()`, which made it possible to pass arguments as a
querystring (`hide_empty=0`) rather than an array
(`array( 'hide_empty' => false )`). [37572] moved default argument parsing
into `WP_Term_Query`, while assuming that arguments passed to `get_terms()`
would be formatted as an array.
To provide compatibility, we now parse all args passed to `get_terms()` into
an array before processing.
See #35381.
git-svn-id: https://develop.svn.wordpress.org/trunk@37599 602fd350-edb4-49c9-b593-d223f7449a82
* Use `scrollHeight` to resize the text editor.
* Don't scroll the cursor into view when under the text editor's toolbar, it
involves cloning the content which is quite slow.
Props iseulde, azaozz.
See #36482.
git-svn-id: https://develop.svn.wordpress.org/trunk@37596 602fd350-edb4-49c9-b593-d223f7449a82
`CHAR` is redundant, since the `meta_value` column is `LONGTEXT`. Meanwhile,
use of `CAST()` causes MySQL to ignore any index that the administrator may
have added to the column.
A number of automated tests were doing searches for `CAST` in the SQL strings
generated by `WP_Meta_Query` (for reasons unrelated to the `CAST()` behavior).
These tests have been updated to expect the new query format.
Props ericlewis.
Fixes#36625.
git-svn-id: https://develop.svn.wordpress.org/trunk@37594 602fd350-edb4-49c9-b593-d223f7449a82
Since [37573], object relationship caches (`{$taxonomy}_relationships`)
contain term IDs rather than term objects. See #36814. As such, it's no longer
necessary to clear these caches when a term is updated; none of the data that's
changed on update (name, description, count, etc) is stored in the relationship
cache.
Fixes#36251.
git-svn-id: https://develop.svn.wordpress.org/trunk@37593 602fd350-edb4-49c9-b593-d223f7449a82
Hook docs must directly precede hooks in order for the Code Reference parser to correctly identify them as such.
Fixes#36968.
git-svn-id: https://develop.svn.wordpress.org/trunk@37592 602fd350-edb4-49c9-b593-d223f7449a82
The process of lazy-loading can be resource intensive for object that have
terms in large numbers of taxonomies and are running a persistent object cache.
This new parameter allows the feature to be disabled in these cases.
Props DBrumbaugh10Up.
See #36953.
git-svn-id: https://develop.svn.wordpress.org/trunk@37589 602fd350-edb4-49c9-b593-d223f7449a82
In order to allow non-web initializations of WordPress (such as through wp-cli) to modify things like the check for maintenance mode, plugins.php and the associated functions must be available much earlier. The use of these functions earlier than the loading of plugins is not recommended in most use cases.
Fixes#36819. See #34936.
Props jorbin, danielbachhuber for documentation.
git-svn-id: https://develop.svn.wordpress.org/trunk@37588 602fd350-edb4-49c9-b593-d223f7449a82
Matches logic in `wp_dashboard_recent_comments()` where we display approved comments regardless of the edit permission.
Props jfarthing84 for initial patch.
Fixes#24648.
git-svn-id: https://develop.svn.wordpress.org/trunk@37584 602fd350-edb4-49c9-b593-d223f7449a82
`dbDelta()` compares the index definitions against the result of `SHOW INDEX FROM $table_name`. This requires a specific format so indices are not unnecessarily re-created. This format wasn't ensured, until now.
* Parse the raw index definition to extract the type, name and columns so a normalized definition can be built (#20263, #34873).
* Standardize on uppercase types (#34871) and on 'KEY'. 'INDEX' is only a synonym for 'KEY'.
* Escape index names with backticks (#20263).
* Normalize columns: Ignore ASC and DESC definitions (#34959), remove whitespaces (#34869) and escape column names with backticks (#20263).
* Add backticks to all index change queries (#20263).
Props ocean90, pento, kurtpayne.
Fixes#20263, #34869, #34871, #34873, #34959.
git-svn-id: https://develop.svn.wordpress.org/trunk@37583 602fd350-edb4-49c9-b593-d223f7449a82
There are some table prefixes (for example, `7e1_`), which MySQL will try and parse as values when they're note quoted in backticks. Because not everything remembers to quote their table names, it's best if we just discourage their use during setup.
Fixes#36422.
git-svn-id: https://develop.svn.wordpress.org/trunk@37581 602fd350-edb4-49c9-b593-d223f7449a82
Known classes, methods, and functions are now auto-linked and formatted in the Code Reference. :-)
See [37573]. See #36814.
git-svn-id: https://develop.svn.wordpress.org/trunk@37578 602fd350-edb4-49c9-b593-d223f7449a82
* `$term_query` should be passed.
* Second and third params should come from the `$term_query->query_vars` array, so that they're fully parsed.
These changes were missed in [37572].
Props flixos90, sebastian.pisula.
See #35381.
Fixes#36951.
git-svn-id: https://develop.svn.wordpress.org/trunk@37576 602fd350-edb4-49c9-b593-d223f7449a82
`dbDelta()` already supported spatial fields (by virtue of not checking field types), so it's nice to round that out with spatial key support, too.
Fixes#36948.
git-svn-id: https://develop.svn.wordpress.org/trunk@37574 602fd350-edb4-49c9-b593-d223f7449a82
Previously, objects containing all data about a term were stored in each
object's term cache. Besides being wasteful, this approach caused invalidation
issues, as when a modified term count required a flush for all objects
belonging to the term.
Backward compatibility is maintained for plugins that continue to put object
data directly into the `{$taxonomy}_relationships` cache bucket.
Fixes#36814.
git-svn-id: https://develop.svn.wordpress.org/trunk@37573 602fd350-edb4-49c9-b593-d223f7449a82
`WP_Term_Query` is modeled on existing query classes, such as those used
for comments and users. It provides a more consistent structure for generating
term queries, and should make it easier to add new functionality in the future.
Props flixos90, boonebgorges.
See #35381.
git-svn-id: https://develop.svn.wordpress.org/trunk@37572 602fd350-edb4-49c9-b593-d223f7449a82
[34529] introduced logic intended to prime the termmeta cache for certain
values of the `fields` parameter. There were a few bugs:
* The `all_with_object_id` param was misspelled.
* `term_id` was used instead of `ids`.
* The values being passed to `update_termmeta_cache()` in the case where `fields=ids` was not correct.
All of these would result in a failure to pre-fetch termmeta in some cases.
Props dlh.
Fixes#36932.
git-svn-id: https://develop.svn.wordpress.org/trunk@37567 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds a unit test factory so that bookmark/link fixtures can be
created during tests.
Why are we writing tests for functionality that has been deprecated for years?
Because it's the Right Thing to Do.
See #18356.
git-svn-id: https://develop.svn.wordpress.org/trunk@37563 602fd350-edb4-49c9-b593-d223f7449a82
* `$before` falls before the link markup starts
* `$after` falls after the link markup ends
* `$link_before` falls before the link text
* `$link_after` falls after the link text
Props wp_smith for the initial patch.
See #32246.
git-svn-id: https://develop.svn.wordpress.org/trunk@37561 602fd350-edb4-49c9-b593-d223f7449a82
Also, move planet URL to a separate string to match the URL which is used for the feed.
Props ramiy for initial patch.
Fixes#35681.
git-svn-id: https://develop.svn.wordpress.org/trunk@37553 602fd350-edb4-49c9-b593-d223f7449a82