Commit Graph

286 Commits

Author SHA1 Message Date
Gary Pendergast
04a0e21734 WPDB: The mysqli_query() call in wpdb::set_charset() had the parameters the wrong way around.
Built from https://develop.svn.wordpress.org/trunk@31374


git-svn-id: http://core.svn.wordpress.org/trunk@31355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 01:26:29 +00:00
Gary Pendergast
55742904c0 WPDB: When we're removing invalid text text from strings with multiple different character sets, wpdb::strip_invalid_text() wasn't correctly switching connection character sets.
Fixes #31262


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


git-svn-id: http://core.svn.wordpress.org/trunk@31352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 00:34:25 +00:00
Gary Pendergast
b2cf823105 WPDB: If a site is using the utf8 charset, and their version of MySQL supports utf8mb4, auto-upgrade them to utf8mb4.
This patch also resizes some indexes, to allow for the 767 byte index size limit in standard MySQL installs.

See #21212


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


git-svn-id: http://core.svn.wordpress.org/trunk@31330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-06 04:51:22 +00:00
Drew Jaynes
d7a51b3fc2 Add missing descriptions to the $blogid and $siteid property DocBlocks in the wpdb class.
Props ipm-frommen.
See #31008.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-29 11:35:22 +00:00
Gary Pendergast
c777f6a29c WPDB: When sanity checking a string, check that it's a string, first - PHP notices can occur if an array or object is handled like a string.
See #21212

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


git-svn-id: http://core.svn.wordpress.org/trunk@31075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 08:45:22 +00:00
Gary Pendergast
83a229084f WPDB: When wpdb::query() needs to sanity check a query string, make sure to run wpdb:flush() afterwards, to ensure the results from sanity check queries aren't mixed up with the results for the user query.
See #21212.

Fixes #30948.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 08:32:22 +00:00
Scott Taylor
60b0cd7943 The keyword elseif should be used instead of else if so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Gary Pendergast
0e806f1695 WPDB: To ensure we're not asking MySQL to read data using queries that it can't handle, make sure that we run all read queries through the character set sanity checks.
See #21212.


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


git-svn-id: http://core.svn.wordpress.org/trunk@31032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-05 04:40:22 +00:00
Gary Pendergast
9704ee2a5c WPDB Docs: Update the @since version from 4.1.0 to 4.2.0, for all the methods/members that were punted from 4.1.
See #21212.


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


git-svn-id: http://core.svn.wordpress.org/trunk@31031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-05 03:51:22 +00:00
Drew Jaynes
7c01a454ce Improve inline documentation for wpdb::has_cap().
Adds a changelog entry for the addition of the 'utf8mb4' feature, accepted values for `$db_cap`, and a return description.

Props kpdesign.
See #21212.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 05:23:22 +00:00
Drew Jaynes
23707b1ada Convert various uses of (optional) in core parameter descriptions to use the style prescribed in the inline documentation standards for PHP.
The style for marking parameters optional in inline PHP docs is: `@param type $var Optional. Description. Accepts. Default.`, where Accepts can be omitted on a case-by-case basis.

Props coffee2code.
Fixes #30591.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-06 21:24:45 +00:00
Gary Pendergast
de6d84935f WPDB: When looking up the character set for a table or column, make sure we send the table name to MySQL in the correct case, as MySQL can be configured with case sensitive table names.
Fixes #30538.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 03:00:23 +00:00
Gary Pendergast
a0c12d0c61 WPDB: Before fetching results, make sure we have a valid result resource to fetch them from.
Fixes #27982.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 00:03:22 +00:00
Scott Taylor
b63c789e88 Improve the @param docs for src/wp-includes/wp-db.php.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 21:55:23 +00:00
Drew Jaynes
9d1a4afda8 4.1 Docs Audit: Improve inline documentation for various wpdb methods.
#30469.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 12:34:25 +00:00
Gary Pendergast
8990b1c1fc WPDB: Remove the addition of STRICT_ALL_TABLES, added in [30400]. This proved to be incompatible with too many plugins, as well as being incompatible with MySQL 5.7.
See #21212.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-27 11:00:23 +00:00
Drew Jaynes
4b6abbaff4 Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Backtick-escape code snippets in the description for `get_object_taxonomies()`
* Backtick-escape inline code in a markdown-formatted unordered list in the description for `get_taxonomy_labels()`
* Remove an HTML tag from the summary for the `Walker_Category_Checklist` class
* Remove an HTML tag from the summary for `wp_category_checklist()`, various formatting
* Remove an HTML tag from the summary for `wp_terms_checklist()`
* Backtick-escape an HTML tag in the description for `wp_popular_terms_checklist()`
* Remove HTML tags from the summaries for `page_template_dropdown()`, `parent_dropdown()`, and `wp_dropdown_roles()`
* Backtick-escape HTML tags in a parameter description for `add_settings_error()`
* Various formatting in the description and summary for `settings_errors()`
* Markdown-indent code snippets in the descriptions for `wpdb::prepare()`, `wpdb::insert()`, `wpdb::replace()`, `wpdb::update()`, and `wpdb::delete()`
* Backtick-escape an HTML tag in a parameter description for `login_header()`
* Remove HTML tags from the summaries for the `lostpassword_form` and `signup_header` hooks

Props rarst.
See #30473.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 06:31:21 +00:00
Gary Pendergast
f17d168a0f WPDB: Force STRICT_ALL_TABLES to be enabled as soon as we connect to the MySQL server.
This improves data integrity when inserting and updating rows in the database, particularly when trying to insert emoji into posts stored with character sets that don't support emoji.

See #21212.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 01:46:24 +00:00
Gary Pendergast
739a20a659 WPDB: When a db.php drop-in is being used, and it doesn't explicitly define itself as connecting to MySQL, skip the character set checks. This ensures that existing drop-ins won't accidentally run checks that they don't support.
See #21212.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-18 03:38:23 +00:00
Gary Pendergast
14bf4939e4 WPDB: When removing invalid characters from utf8 strings in older versions of PHP, the regex was too large to be compiled.
See #21212

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


git-svn-id: http://core.svn.wordpress.org/trunk@30365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-17 11:58:22 +00:00
Gary Pendergast
ecc27d0b27 When creating a post containing emoji, the post can be saved incorrectly if MySQL isn't using a character set that supports emoji.
This change prevents the save from occurring, so it can be handled correctly in the UI.

See #21212.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-14 21:28:22 +00:00
Gary Pendergast
21467af4db wpdb: When flushing results on a mysqli connection, make sure that wpdb::$dbh is a valid mysqli connection handle.
Fixes a unit test failure introduced in [30297].

Fixes #28155.

Props soulseekah.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-11 02:17:28 +00:00
Gary Pendergast
0013150649 wpdb::flush() was not flushing results correctly when using mysqli.
This change also allows stored procedures or queries made with `mysqli_multi_query()` to be flushed.

Includes unit tests.

Fixes #28155.

Props soulseekah.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-10 05:40:23 +00:00
Gary Pendergast
f572927353 WPDB's __get() function should perform strict comparisons against member names
Built from https://develop.svn.wordpress.org/trunk@30292


git-svn-id: http://core.svn.wordpress.org/trunk@30291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-09 12:04:23 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Sergey Biryukov
bf856e3a62 Translate some previously untranslated _doing_it_wrong() messages.
props georgestephanis.
fixes #25614.
Built from https://develop.svn.wordpress.org/trunk@29840


git-svn-id: http://core.svn.wordpress.org/trunk@29604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-05 21:06:15 +00:00
Mark Jaquith
0d3b83551f Use HTTPS URLs for core.trac.wordpress.org
see #27115
Built from https://develop.svn.wordpress.org/trunk@29788


git-svn-id: http://core.svn.wordpress.org/trunk@29560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:28:16 +00:00
Sergey Biryukov
740df917fa Remove unnecessary semicolon.
props ixkaito.
fixes #29784.
Built from https://develop.svn.wordpress.org/trunk@29784


git-svn-id: http://core.svn.wordpress.org/trunk@29556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 10:30:16 +00:00
Andrew Nacin
53f1ba51e4 DB: Revert [28814] and require a WHERE for wpdb::update().
see #26106.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-02 04:56:15 +00:00
Drew Jaynes
3665b5a1a1 Add periods to short descriptions for magic methods added in [28501], [28521], and [28524].
See #22234 and #28885.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:12:14 +00:00
Drew Jaynes
c5a59037f1 Inline documentation cleanup for 4.0 audit.
Various improvements:
* Adds `@see` reference for `wp_list_comments()` in 'wp_list_comments_args' filter docs, added in [28285]
* Various phpDoc tweaks for the 'run_wptexturize' filter docs, added in [28715]
* Sentence and wrapping changes for `is_https_url()`, added in [28894]
* Documents the `$args` parameter for `wp_dropdown_languages()`, added in [29007]
* Adds a period to the parameter description for `_update_posts_count_on_delete()`, added in [28835]
* Documents a global in `is_customize_preview()`, added in [28999]
* phpDoc tweaks, adds an access modifier for `wpdb::esc_like()`, added in [28711]

See #28885.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:02:15 +00:00
Andrew Nacin
b35982cbff Simplify the setup-config.php UI flow and load process.
When no configuration file is detected, we now redirect to setup-config.php. This process now uses the WordPress bootstrap, rather than a set of fragile hacks.

fixes #28740.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-03 19:57:14 +00:00
Scott Taylor
3ebd519a3e In $wpdb->update(), prevent explosions when $where is empty.
Adds unit tests.

Props UmeshSingla, wonderboymusic.
Fixes #26106

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


git-svn-id: http://core.svn.wordpress.org/trunk@28621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-24 00:24:14 +00:00
Scott Taylor
82bdc78500 LIKE escape sanity:
* Deprecate `like_escape()`
* Add a method to `$wpdb`, `->esc_like()`, and add unit tests

`$wpdb::esc_like()` is not used yet. As such, many unit tests will throw `Unexpected deprecated notice for like_escape`. Subsequent commits will alleviate this.

Props miqrogroove.
See #10041.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 00:30:15 +00:00
Drew Jaynes
290b377a31 Mark the MYSQL_NEW_LINK constant as deprecated in 3.9+ as no equivalent to the $new_link parameter exists in mysqli_* functions.
Fixes #27933.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-04 05:00:15 +00:00
Scott Taylor
fd5e6b5f6b In wpdb, make some things explicitly public. Do not set anything to private. This would instantly blow up hyperdb in the wild.
See #27881, #22234.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 15:36:13 +00:00
Scott Taylor
361e3e1ee6 In wpdb, remove dead code:
* In `->tables()`, `break` is unreachable after `return`
* In `->query()`, `$return` is always set, so doesn't need an initial value of `0`
* In `->delete()`, `$bits` is unused

See #27882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-07 03:56:14 +00:00
Drew Jaynes
a5366db845 Improve inline documentation for the wpdb::$show_errors property.
Note that SQL/DB errors are displayed by default if both WP_DEBUG and WP_DEBUG_DISPLAY evaluate to true.

Props ericlewis.
Fixes #16615.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-02 12:19:15 +00:00
Andrew Nacin
1860b6a007 Rename USE_EXT_MYSQL to WP_USE_EXT_MYSQL. see #21663.
Built from https://develop.svn.wordpress.org/trunk@28022


git-svn-id: http://core.svn.wordpress.org/trunk@27852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 22:27:15 +00:00
Drew Jaynes
b5ecc00b32 PHPDoc fixes for functionality in wp-includes/wp-db.php added in 3.9.
See #27700.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 22:02:15 +00:00
Andrew Nacin
10b8c92b1e wpdb: Don't pass a second argument to mysqli_fetch_field().
props pento.
fixes #27693.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 20:22:28 +00:00
Andrew Nacin
ac60fcb315 Database: Fall back from ext/mysqli to ext/mysql if the connection fails.
This allows us to avoid breaking a site that works under ext/mysql but is misconfigured for ext/mysqli.

props pento.
see #21663.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-03 21:58:16 +00:00
Andrew Nacin
34700cd7fb Database: Add $allow_bail argument to wpdb::check_connection() to match the connect method.
props DrProtocols, pento.
fixes #27240.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-03 04:06:14 +00:00
Sergey Biryukov
c099c5a031 Avoid a warning in wpdb::db_connect(). before_needle parameter of strstr() was added in PHP 5.3.
props klihelp, pento.
fixes #27277.
Built from https://develop.svn.wordpress.org/trunk@27503


git-svn-id: http://core.svn.wordpress.org/trunk@27346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-11 19:27:15 +00:00
Andrew Nacin
291b1a8f83 Make OBJECT a case sensitive constant, for HHVM compatibility and general sanity.
Support `object` explicitly, and other forms using a fallback in wpdb.

fixes #27231.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-03 17:36:13 +00:00
Andrew Nacin
0c16c0477b Reference https://wordpress.org rather than http://wordpress.org in strings, links, comments, etc.
props Ipstenu, markjaquith.
see #27115.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-03 02:34:27 +00:00
Andrew Nacin
4d9bf200d7 When failing to reconnect to a server that has gone away, simply fail the query once we've passed template_redirect, rather than wp_die().
props pento.
see #5932.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 04:54:14 +00:00
Andrew Nacin
cb52ddbf08 Add a constant to disable mysqli for testing purposes. see #21663.
Built from https://develop.svn.wordpress.org/trunk@27278


git-svn-id: http://core.svn.wordpress.org/trunk@27134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 04:20:14 +00:00
Andrew Nacin
4c9e7f81e1 wpdb: set dbh to null when the mysqli connection fails. see #21663.
Built from https://develop.svn.wordpress.org/trunk@27277


git-svn-id: http://core.svn.wordpress.org/trunk@27133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 04:15:18 +00:00
Andrew Nacin
c51ce41c59 Use mysqli for WordPress development versions, regardless of PHP version, to increase testing footprint.
Allow the lack of ext/mysql to pass wp_check_php_mysql_versions().

see #21663.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 15:53:13 +00:00