Commit Graph

13 Commits

Author SHA1 Message Date
Gary Pendergast 6774e27ae7 General: Restore usage of `$wpdb`, instead of `$this->db`.
Hiding the `$wpdb` global behind a property decreases the readability of the code, as well as causing irrelevant output when dumping an object.

Reverts [38275], [38278], [38279], [38280], [38387].
See #37699.



git-svn-id: https://develop.svn.wordpress.org/trunk@38768 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-10 06:37:02 +00:00
Scott Taylor 4e55f2248b Query: add a `protected` field, `$db`, (composition, as it were) to `WP_*_Query` classes to hold the value for the database abstraction, instead of importing the `global $wpdb` into every method that uses it. Reduces the number of global imports by 32.
See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38275 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-18 18:20:55 +00:00
Boone Gorges 255aaa471e Fix orderby meta handling for `WP_Term_Query`.
In order to allow meta-related values of `orderby` to be handled properly,
the term query's `meta_query` object must run its `get_sql()` method before
`orderby` parsing.

Fixing this bug required addressing another bug in `WP_Meta_Query`, which
caused the table alias index not to be reset when calling `get_sql()`
multiple times on the same object.

Props littler.chicken.
Fixes #37151.

git-svn-id: https://develop.svn.wordpress.org/trunk@37860 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-25 16:22:55 +00:00
Drew Jaynes 034b6c025d Docs: Improve first-order clause documentation for the `$meta_query` parameter in the constructor for `WP_Meta_Query`.
First-order meta query clauses are defined as clauses that have either a 'key' or 'value' array key. When using named first-order clauses in meta queries to order results in the parent query, `WP_Meta_Query` can additionally accept first-order clauses at the sub-clause level, which was not previous documented.

Fixes #32659.


git-svn-id: https://develop.svn.wordpress.org/trunk@37688 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-12 00:01:54 +00:00
Boone Gorges cb5b8479f0 In `WP_Meta_Query`, don't cast `meta_value` to `CHAR`.
`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
2016-05-30 04:35:16 +00:00
Drew Jaynes c49afe285c Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.


git-svn-id: https://develop.svn.wordpress.org/trunk@37492 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-22 18:14:19 +00:00
Drew Jaynes c7bed4f8c6 Docs: Remove inline `@see` tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@37342 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 03:59:56 +00:00
Drew Jaynes 223b94a039 Docs: Correctly document parameters in the hook doc for the `get_meta_sql` filter as individual parameters rather than an array.
When an array of parameters is passed to `do_action|apply_filters_ref_array`, parameters should be documented as individuals instead of as part of the whole.

Props sudar.
Fixes #35962.


git-svn-id: https://develop.svn.wordpress.org/trunk@36735 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 17:09:23 +00:00
Boone Gorges 969f98ecee Docs: `WP_Meta_Query` accepts 'EXISTS' or 'NOT EXISTS' for `$compare`.
Props apaliku, jdgrimes.
Fixes #35891.

git-svn-id: https://develop.svn.wordpress.org/trunk@36609 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 03:55:09 +00:00
Drew Jaynes 0cb7c0bd9f Docs: Add missing descriptions for the `$wpdb` global in DocBlocks all the places.
See #32246.


git-svn-id: https://develop.svn.wordpress.org/trunk@35170 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-14 23:43:10 +00:00
Drew Jaynes 55cffaf8df Docs: Add a file header to wp-includes/class-wp-meta-query.php, introduced in [33761].
Also clarifies the class DocBlock summary for `WP_Meta_Query`.

See #33413. See #33701.


git-svn-id: https://develop.svn.wordpress.org/trunk@34405 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 13:25:37 +00:00
Boone Gorges 4fdfdb6078 Use stricter sanitization for meta query clause keys.
By forcing all clause keys to be strings, we make it possible to use strict
comparison when validating values of 'orderby' as passed to `WP_Query`. This
eliminates situations where the presence of numeric clause keys could result
in an improperly validated 'orderby' value.

Props nikolov.tmw.
Fixes #32937.

git-svn-id: https://develop.svn.wordpress.org/trunk@34090 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-12 21:05:14 +00:00
Scott Taylor 46d0feea46 Meta: move `WP_Meta_Query` into its own file. `meta.php` loads the new files, so this is 100% BC if someone is loading `meta.php` directly. New files created using `svn cp`.
Creates: 
`class-wp-meta-query.php` 
`meta-functions.php` 

`meta.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.


git-svn-id: https://develop.svn.wordpress.org/trunk@33761 602fd350-edb4-49c9-b593-d223f7449a82
2015-08-26 13:01:22 +00:00