Commit Graph

174 Commits

Author SHA1 Message Date
Gary Pendergast
8efcc32fde Help: Update support forum links.
There are a lot of places in Core that link to https://wordpress.org/support/ for the support forums, but that's now the URL for HelpHub. The new forums link is https://wordpress.org/support/forums/.

Props jitendrabanjara1991, dilipbheda, mukesh27, ianbelanger.
Fixes #46790.



git-svn-id: https://develop.svn.wordpress.org/trunk@45140 602fd350-edb4-49c9-b593-d223f7449a82
2019-04-08 22:58:49 +00:00
John Blackbourn
6a3bab9848 Docs: Correct some documentation typos.
See #46543


git-svn-id: https://develop.svn.wordpress.org/trunk@45035 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-27 17:08:04 +00:00
Sergey Biryukov
5e04716bfe Docs: Remove unnecessary @see tag in wpdb::prepare().
The tag is only necessary for hooks. For functions and methods, autolinking is handled automatically on developer.wordpress.org.

Props mbelchev, ocean90, johannadevos.
Fixes #44585. See #45204.

git-svn-id: https://develop.svn.wordpress.org/trunk@44901 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-15 11:17:57 +00:00
Gary Pendergast
6f0487c2f0 Coding Standards: Ignore the violations of Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase.
See #45934.



git-svn-id: https://develop.svn.wordpress.org/trunk@44563 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-11 06:07:50 +00:00
Felix Arntz
4657735ba6 Multisite: Update @since tags for site meta introduction.
Fixes #37923. Fixes #40229.


git-svn-id: https://develop.svn.wordpress.org/trunk@44467 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-08 08:17:34 +00:00
Sergey Biryukov
61ab633727 Docs: Update @since tag for the addition of query start time to logged query data.
Fixes #43315.

git-svn-id: https://develop.svn.wordpress.org/trunk@44345 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-20 00:58:53 +00:00
Drew Jaynes
593bdb87fa Docs: Update an inline @see reference in the DocBlock for wpdb::prepare() to reference wpdb::esc_like() the method instead of esc_like() the nonexistent function.
Props antaltettinger.
Fixes #45204. 


git-svn-id: https://develop.svn.wordpress.org/trunk@44330 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-19 07:29:22 +00:00
Jonathan Desrosiers
5c6cc0f6ce WPDB: Check that $wpdb->last_result is countable before counting with it.
`wpdb::get_col()` iterates over `$wpdb->last_result`, which can be a non-countable value, should the preceding query have failed.

Props spacedmonkey, desrosj, pento.

Merges [43934] into trunk.

See #45299.

git-svn-id: https://develop.svn.wordpress.org/trunk@44272 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-17 18:38:13 +00:00
Gary Pendergast
a75d153eee Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-17 01:50:26 +00:00
John Blackbourn
6eef5a6234 Docs: Correct the possible return types for the wpdb::query() method.
Props isabel104

See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@43017 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-28 14:43:36 +00:00
Felix Arntz
8e4bd924d2 Multisite: Introduce metadata for sites.
A new global multisite table `wp_blogmeta` is added to the database schema, and a set of `*_site_meta()` API functions are introduced.

The implementation fails gracefully when the new table is not yet available, which may happen especially shortly after the core update, before the network has been upgraded to the new database schema. The presence of the table is detected once and stored as a global setting on the main network.

Core does not yet use site metadata, but there are several use-cases to be implemented or explored in the near future, and it allows plugins to extend sites with arbitrary data, which will come in particularly handy with the upcoming REST API endpoint for sites.

Props spacedmonkey, johnjamesjacoby, jeremyfelt, flixos90.
Fixes #37923.


git-svn-id: https://develop.svn.wordpress.org/trunk@42836 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-16 02:14:04 +00:00
Sergey Biryukov
1fddd69163 I18N: Use the actual placeholder instead of a number in translator comments if the corresponding string does not use numbered placeholders.
Add missing translator comments in `WP_Theme_Install_List_Table` and `wp_notify_postauthor()`.
Add missing commas in some translator comments.

Fixes #43523.

git-svn-id: https://develop.svn.wordpress.org/trunk@42827 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-11 16:43:59 +00:00
John Blackbourn
cdcce1b9c6 Database: Add the query start time to logged query data.
This allows debugging plugins to plot the time at which queries were executed.

Props Rarst for initial patch.

Fixes #43315


git-svn-id: https://develop.svn.wordpress.org/trunk@42789 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-05 22:53:40 +00:00
Sergey Biryukov
7948dbf0c1 Database: If both WP_DEBUG and WP_DEBUG_DISPLAY are true, display a more specific error message in wpdb::bail().
Props sivel, Mte90, SergeyBiryukov.
Fixes #13657.

git-svn-id: https://develop.svn.wordpress.org/trunk@42716 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-15 14:28:13 +00:00
Dion Hulse
5110f349a9 WPDB: Use a PCRE syntax which supports PCRE compiled between 2003 and 2006.
This fixes a PHP Warning in `wpdb::parse_db_host()` when WordPress is used with (sometimes a modern) PHP that's compiled against an ancient PCRE version.

Fixes #43109 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@42549 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-23 03:38:42 +00:00
Dion Hulse
f216215864 WPDB: Always use mysqli when available.
This change makes WordPress use `mysqli` on PHP <5.5 when available, instead of only in PHP 5.5+ and development installs.

WPDB includes a fallback to `mysql` in the event that the database connection fails with `mysqli` so incompatibilities should be few and far between.

Fixes #42812 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@42388 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-12 05:42:12 +00:00
Gary Pendergast
8f95800d52 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 23:09:33 +00:00
Gary Pendergast
574821573a General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42228 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-26 23:56:25 +00:00
Dion Hulse
b8c4faff72 WPDB: Fix the parsing of sockets which contain colons within the socket name (used on some cloud providers).
Props natacado.
Fixes #42634 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@42226 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-24 05:51:31 +00:00
Gary Pendergast
000809964a WPDB: Check that AUTH_SALT is not empty.
In `wpdb::placeholder_escape()`, the key for `hash_hmac()` defaults to `AUTH_SALT`, but `hash_hmac()` will return an empty string if the key is empty.

This had the side effect of the string `{}` being incorrectly replaced with a `%` character in queries just about to be run on the database.

Props jsonfry.
Fixes #42431.



git-svn-id: https://develop.svn.wordpress.org/trunk@42120 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-07 01:08:11 +00:00
Gary Pendergast
f7fbbcba0d WPDB: Fix a PHP notice when AUTH_SALT is undefined.
In `wpdb::placeholder_escape()`, the key for `hash_hmac()` falls back to `rand()` when `AUTH_SALT` is undefined. `hash_hmac()` requires the key to be a string, however, so we need to cast it as such.

Props mkomar.
Fixes #42401.



git-svn-id: https://develop.svn.wordpress.org/trunk@42119 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-07 00:29:26 +00:00
Gary Pendergast
a39d599adf Database: Restore numbered placeholders in wpdb::prepare().
[41496] removed support for numbered placeholders in queries send through `wpdb::prepare()`, which, despite being undocumented, were quite commonly used.

This change restores support for numbered placeholders (as well as a subset of placeholder formatting), while also adding extra checks to ensure the correct number of arguments are being passed to `wpdb::prepare()`, given the number of placeholders.

See #41925.



git-svn-id: https://develop.svn.wordpress.org/trunk@42056 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-31 11:59:43 +00:00
Pascal Birchler
4a23f58215 Database: Add translators comment for error message in wpdb::prepare().
Props felipeelia.
Fixes #42142.


git-svn-id: https://develop.svn.wordpress.org/trunk@41828 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-11 08:34:34 +00:00
Gary Pendergast
0e5b75b8be Database: When parsing the host, leave the port and socket as null if they're not defined.
This fixes a change in behaviour introduced by [41629].

The host is set to an empty string when it isn't defined, this continues existing behaviour. In particular, the mysqli library treats a `null` host as being the same as `localhost`, which is not always the intended behaviour.

Props birgire, markjaquith, pento.
Fixes #41722.



git-svn-id: https://develop.svn.wordpress.org/trunk@41820 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-11 00:09:47 +00:00
Pascal Birchler
938d225f96 Database: Use numbered placeholders in error message in wpdb::prepare().
Props tobifjellner.
Fixes #42142.


git-svn-id: https://develop.svn.wordpress.org/trunk@41789 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-08 09:17:57 +00:00
Gary Pendergast
d16b885730 Database: Fix some PHP errors introduced in [41662].
PHP < 5.4 requires a `$matches` parameter to be passed to `preg_match_all()`

`wpdb::prepare()` can be called before translations are loaded, so needs appropriate `wp_load_translations_early()` calls.

See #42040.



git-svn-id: https://develop.svn.wordpress.org/trunk@41663 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 02:44:48 +00:00
Gary Pendergast
b4a6de9997 Database: Throw a notice if wpdb::prepare() is called with an incorrect number of arguments
`wpdb::prepare()` currently gives no information if the number of arguments passed doesn't match the number of placeholders in the query. This change gives an explicit notice that the call was incorrect.

Also fixes an enrelated term meta test that was triggering this new notice.

Props thekt12 for the initial patch.
Fixes #42040.



git-svn-id: https://develop.svn.wordpress.org/trunk@41662 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 02:10:14 +00:00
Gary Pendergast
ea23ff3422 Docs: Clarify the docs for wpdb::prepare().
Make the usage of the `%` wildcard in queries clearer.

Props jrf.
Fixes #41983.



git-svn-id: https://develop.svn.wordpress.org/trunk@41660 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-02 00:21:06 +00:00
Gary Pendergast
345aac85a6 Docs: Update the documentation for wpdb::prepare()
The inline documentation for `wpdb::prepare()` was kind of confusing, and didn't describe some of the behaviour correctly.

Fixes #41983.



git-svn-id: https://develop.svn.wordpress.org/trunk@41632 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 11:44:30 +00:00
Gary Pendergast
199aa17cda Database: Add support for connecting to IPv6 hosts
IPv4 addresses are scarce, overworked, and underpaid. They're ready to retire, but we just won't let them go. If you care about their wellbeing, switch to IPv6 today.

Props schlessera, birgire.
Fixes #41722.



git-svn-id: https://develop.svn.wordpress.org/trunk@41629 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 05:36:34 +00:00
Gary Pendergast
f5c4c69bf1 Database: Don't quote placeholders in queries going through $wpdb->prepare()
To bring Core into line with the changes to `$wpdb->prepare()` in WordPress 4.8.2, query placeholders shouldn't be quoted.

Props jrf, johnjamesjacoby.
Fixes #41983.



git-svn-id: https://develop.svn.wordpress.org/trunk@41628 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-28 04:31:05 +00:00
Aaron D. Campbell
e95dc5a26f Database: Hardening to bring wpdb::prepare() inline with documentation.
`wpdb::prepare()` supports %s, %d, and %F as placeholders in the query string. Any other non-escaped % will be escaped.



git-svn-id: https://develop.svn.wordpress.org/trunk@41496 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-19 17:55:33 +00:00
Aaron D. Campbell
88464ecd41 Database: Don’t trigger _doing_it_wrong() for null values in wpdb::prepare().
While `wpdb::prepare()` does not support null values (see #12819) they still appear in the wild like in the WordPress Importer and other plugins.



git-svn-id: https://develop.svn.wordpress.org/trunk@41483 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-19 16:05:26 +00:00
aaroncampbell
eb012314d0 Database: Hardening for wpdb::prepare()
Previously if you passed an array of values for placeholders, additional values could be passed as well. Now additional values will be ignored.



git-svn-id: https://develop.svn.wordpress.org/trunk@41470 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-19 14:47:46 +00:00
Felix Arntz
9595e6c38b Multisite: Rename internal $site_id variables referencing networks to $network_id.
This change improves code clarity by using the current naming conventions for networks.

Props lemacarl.
Fixes #41510.


git-svn-id: https://develop.svn.wordpress.org/trunk@41241 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-12 12:47:38 +00:00
Drew Jaynes
b4d81bd654 Docs: Remove @access notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.


git-svn-id: https://develop.svn.wordpress.org/trunk@41162 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-27 00:40:27 +00:00
Drew Jaynes
de79ff87b3 Docs: Remove a few more superfluous @package WordPress and @subpackage notations outside of file headers missed in [40988].
See #41017.


git-svn-id: https://develop.svn.wordpress.org/trunk@40989 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-01 17:10:37 +00:00
John Blackbourn
b20ed14939 Database: Add documentation for the allowed utf8mb4_520 value when detecting features with wpdb::has_cap().
Props rcutmore

Fixes #41044


git-svn-id: https://develop.svn.wordpress.org/trunk@40906 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-15 11:59:19 +00:00
John Blackbourn
f6f0e6098d I18n: Begin introducing translator comments for strings which include placeholders but no accompanying translator comment.
Adds context to one string used in two different contexts for the new user and new site signup email notification.

More to come.

See #38882


git-svn-id: https://develop.svn.wordpress.org/trunk@39323 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-21 01:21:01 +00:00
Gary Pendergast
365241878f Database: Add support for LIKE-escaped tables in ::get_table_from_query().
The `SHOW TABLES LIKE` query can be used to search for tables that match a pattern, `wp\_123\_%`, for example. While this isn't the name of an actual table, the `wp_123_` prefix can be used by database drop-ins to direct the query correctly. This change removes the escaping and `%` modifier, to provide this usable prefix.

Props andy, pento.
Fixes #38751.



git-svn-id: https://develop.svn.wordpress.org/trunk@39275 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-17 04:20:22 +00:00
John Blackbourn
9ac95f7650 Docs: Improve the documentation for parameters which accept OBJECT, ARRAY_A, and ARRAY_N as parameters.
See #37770


git-svn-id: https://develop.svn.wordpress.org/trunk@39188 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-09 22:59:02 +00:00
Gary Pendergast
bafd8c92f2 Database: Fall back to utf8 when utf8mb4 isn't supported.
Sometimes, `DB_CHARSET` will be set to `utf8mb4`, even if the current setup doesn't support `utf8mb4`. After [38442], this can cause significant character set failures, causing the connection to fall back to `latin1`.

Instead of doing this, we now check that the connection supports `utf8mb4` before trying to use it, and fall back to `utf8` when we need to.

Fixes #37982 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@38580 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-08 23:48:05 +00:00
Gary Pendergast
4afafbde25 Database: Find the correct table names in DELETE queries with table aliases
Previously, `wpdb::get_table_from_query()` would not find the correct table name in the query `DELETE a FROM table a`, due to not recognising the table alias immediately after the `DELETE` as correct syntax.

Fixes #37660.



git-svn-id: https://develop.svn.wordpress.org/trunk@38507 602fd350-edb4-49c9-b593-d223f7449a82
2016-09-02 00:18:49 +00:00
Gary Pendergast
7fc579eec9 Database: Don't force an unsupported character set that previously would've silently failed.
[37320] corrected some behaviour in how PHP and MySQL character sets are matched up. This was correct, but had the side effect of causing some incorrectly configured sites to start failing.

Prior to [37320], if `DB_CHARSET` was set to `utf8mb4`, but the PHP version didn't support `utf8mb4`, it would fall back to the default character set - usually `latin1`. After [37320], the `SET NAMES` query would force MySQL to treat the connection character set as `utf8mb4`, even if PHP wasn't able to understand it.

By checking if `mysqli_set_charset()` succeeded, we can simulate the old behaviour, while maintaining the fix in [37320].

Props danielkanchev fo helping to diagnose this issue.
Fixes #37689 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@38441 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 07:37:59 +00:00
Gary Pendergast
fd7979ad63 Database: Ensure that variables are defined correctly.
There were some cases where some local variables in `wpdb::init_charset()` could be undefined when they were used.

Props Frozzare.
Fixes #37683 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@38439 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 07:13:31 +00:00
Scott Taylor
670878cbaa Database: WP_Network, WP_Network_Query, and WP_Site_Query call wpdb::_escape(), thus requiring it to be public. It previously had no access modifier. _ at the beginning of a method, believe it or not, does not enforce visibility constraints.
See #37771.


git-svn-id: https://develop.svn.wordpress.org/trunk@38314 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-22 21:09:03 +00:00
Sergey Biryukov
4bf8693357 Docs: Correct usage examples for wpdb::prepare(), which should not be called statically.
Props TJNowell.
Fixes #37744.

git-svn-id: https://develop.svn.wordpress.org/trunk@38289 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-20 13:16:33 +00:00
Sergey Biryukov
e7bd22f87e Database: Replace incorrect use of E_USER_NOTICE in wpdb::_real_escape() with the version number where the message was added.
Props andizer.
Fixes #36403.

git-svn-id: https://develop.svn.wordpress.org/trunk@38133 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-21 22:44:26 +00:00
Drew Jaynes
7e52b06003 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 2/2.

Fixes #37318.


git-svn-id: https://develop.svn.wordpress.org/trunk@38125 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-20 19:32:05 +00:00
Sergey Biryukov
920f29616a Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.

git-svn-id: https://develop.svn.wordpress.org/trunk@37985 602fd350-edb4-49c9-b593-d223f7449a82
2016-07-06 12:39:01 +00:00