Scott Taylor
6378cb5d60
In wpdb::load_col_info()
, don't fetch the number of fields in the result row on each iteration of the for
loop. It can be stored in a var and referenced.
...
See #32444 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32515 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-19 20:29:30 +00:00
Gary Pendergast
ba24459a63
The UTF-8 regex can occasionally fail on very low memory machines. Reduce the amount of memory it uses.
...
See #32204 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32375 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 06:57:44 +00:00
Gary Pendergast
ed53ad2c53
WPDB: When sanity checking query character sets, there's no need to check queries that don't return user data.
...
See #32104 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32374 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 06:04:50 +00:00
Gary Pendergast
923c6c981b
WPDB: Allow queries to reference tables in the dbname.tablename
format, and allow table names to contain any valid character, rather than just ASCII.
...
Props pento, willstedt for the initial patch.
See #32090 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32368 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 05:00:39 +00:00
Gary Pendergast
2ce97b2984
WPDB: When checking that a string can be sent to MySQL, we shouldn't use mb_convert_encoding()
, as it behaves differently to MySQL's character encoding conversion.
...
Props mdawaffe, pento, nbachiyski, jorbin, johnjamesjacoby, jeremyfelt.
See #32165 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32364 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 02:59:50 +00:00
Gary Pendergast
0152b8f49b
In [32299], we should be using mb_strlen()
for our string size checks.
...
git-svn-id: https://develop.svn.wordpress.org/trunk@32306 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-27 14:41:48 +00:00
Gary Pendergast
45b0abbef1
WPDB: Sanity check that any strings being stored in the DB are not too long to store correctly.
...
git-svn-id: https://develop.svn.wordpress.org/trunk@32299 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-27 14:02:45 +00:00
Gary Pendergast
cc8a9824c5
WPDB: When sanity checking a string by sending it to MySQL for conversion checks, the incorrect data structure was being returned from wpdb::strip_invalid_text()
, causing all write queries to fail for some character sets when the query contained non-ASCII characters.
...
See #32051 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32261 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-22 15:01:25 +00:00
Gary Pendergast
afe046a84c
WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if the query is entirely ASCII characters.
...
See #32029 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32233 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-21 05:23:44 +00:00
Gary Pendergast
0fe5a64e56
WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if it's a query that will never return user data.
...
Fixes #32029 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32232 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-21 05:10:11 +00:00
Gary Pendergast
faa66d8145
WPDB: When sanity checking read queries, there are some collations we can skip, for improved performance.
...
Props pento, nacin.
See #21212 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32162 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 04:45:12 +00:00
Dominik Schilling (ocean90)
b0d6757918
Use HTTPS URLs for codex.wordpress.org.
...
see #27115 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32116 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-12 21:28:58 +00:00
Drew Jaynes
868d12ef38
Remove unnecessary inline @see
tags from a variety of parameter and return descriptions in wp-includes/wp-db.php.
...
See #31888 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32050 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-05 17:16:20 +00:00
Drew Jaynes
131b3d08d2
Remove unnecessary inline @see
tags from the wpdb::process_field_charsets()
DocBlock.
...
See [30345]. See #31888 .
git-svn-id: https://develop.svn.wordpress.org/trunk@32049 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-05 17:14:14 +00:00
Gary Pendergast
55792b59a8
WPDB: When we check the character set of a column, and find that it's utf8mb4
, we should also check that the current connection supports utf8mb4
. It's possible that the environment may have changed since upgrading the DB, so we can fall back to utf8
when that happens.
...
Fixes #31771 .
git-svn-id: https://develop.svn.wordpress.org/trunk@31947 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 02:21:15 +00:00
Gary Pendergast
67ae889160
WPDB: When we're checking to see if the MySQL client library supports utf8mb4
, we need a separate check for mysqlnd
versions, which using different version numbering to libmysqlclient
.
...
Props MattyRob.
Fixes #31644 .
git-svn-id: https://develop.svn.wordpress.org/trunk@31939 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-31 09:17:43 +00:00
Gary Pendergast
0ac085da11
WPDB: HHVM doesn't support passing a DB link to mysqli_get_client_version()
. While we usually pass a DB link to every ext/mysql
and mysqli
function call, we don't really need to do that here, as there's no way for the client library to change mid page load.
...
Another fun fact is that `mysql_get_client_version()` doesn't exist, but `mysql_get_client_info()` (along with `mysqli_get_client_info()') do. So, we're switching to them, in order to add a pleasing symmetry to the client version check.
Fixes #31644
git-svn-id: https://develop.svn.wordpress.org/trunk@31783 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-15 12:19:12 +00:00
Gary Pendergast
350cfba6c8
WPDB: When checking to see if we can use utf8mb4, we also need to make sure PHP's MySQL client library is capable of using utf8mb4.
...
See #21212
git-svn-id: https://develop.svn.wordpress.org/trunk@31391 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-09 22:27:43 +00:00
Gary Pendergast
b136100978
WPDB: The mysqli_query()
call in wpdb::set_charset()
had the parameters the wrong way around.
...
git-svn-id: https://develop.svn.wordpress.org/trunk@31374 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-09 01:25:47 +00:00
Gary Pendergast
afdd7da11b
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
git-svn-id: https://develop.svn.wordpress.org/trunk@31371 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-09 00:33:32 +00:00
Gary Pendergast
9f6ddf8944
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
git-svn-id: https://develop.svn.wordpress.org/trunk@31349 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-06 04:50:19 +00:00
Drew Jaynes (DrewAPicture)
b98c2c0bb3
Add missing descriptions to the $blogid
and $siteid
property DocBlocks in the wpdb
class.
...
Props ipm-frommen.
See #31008 .
git-svn-id: https://develop.svn.wordpress.org/trunk@31294 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-29 11:34:52 +00:00
Gary Pendergast
ceccfa10b4
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
git-svn-id: https://develop.svn.wordpress.org/trunk@31094 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-08 08:44:10 +00:00
Gary Pendergast
befcf4f442
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@31093 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-08 08:31:42 +00:00
Scott Taylor
6fd11624d1
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@31090 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-08 07:04:40 +00:00
Gary Pendergast
aada083f3c
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@31051 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-05 04:39:26 +00:00
Gary Pendergast
ea660736eb
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@31050 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-05 03:50:14 +00:00
Drew Jaynes (DrewAPicture)
a82a0df5f9
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30768 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-07 05:22:42 +00:00
Drew Jaynes (DrewAPicture)
7187da0b32
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30753 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-06 21:23:52 +00:00
Gary Pendergast
34f8e4d433
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30699 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 02:59:36 +00:00
Gary Pendergast
6eebbc5750
WPDB: Before fetching results, make sure we have a valid result resource to fetch them from.
...
Fixes #27982 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30677 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 00:02:55 +00:00
Scott Taylor
35358b0e26
Improve the @param
docs for src/wp-includes/wp-db.php
.
...
See #30224 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30664 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 21:54:08 +00:00
Drew Jaynes (DrewAPicture)
57f295484d
4.1 Docs Audit: Improve inline documentation for various wpdb
methods.
...
#30469 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30624 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-28 12:33:16 +00:00
Gary Pendergast
c00ba04e9c
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30587 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-27 10:59:10 +00:00
Drew Jaynes (DrewAPicture)
a22e8b5354
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30546 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 06:30:19 +00:00
Gary Pendergast
cabcace53c
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30400 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 01:45:10 +00:00
Gary Pendergast
de33d35d1f
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30375 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-18 03:37:23 +00:00
Gary Pendergast
54b2f32180
WPDB: When removing invalid characters from utf8 strings in older versions of PHP, the regex was too large to be compiled.
...
See #21212
git-svn-id: https://develop.svn.wordpress.org/trunk@30366 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-17 11:57:46 +00:00
Gary Pendergast
6df14c1612
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30345 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:27:17 +00:00
Gary Pendergast
c2fb136b47
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@30299 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-11 02:16:19 +00:00
Gary Pendergast
4b1aa89206
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@30297 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-10 05:39:50 +00:00
Gary Pendergast
3b3a33b583
WPDB's __get()
function should perform strict comparisons against member names
...
git-svn-id: https://develop.svn.wordpress.org/trunk@30292 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-09 12:03:31 +00:00
Drew Jaynes (DrewAPicture)
3cc10d77a0
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@30105 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 01:04:55 +00:00
Sergey Biryukov
937d5cdd11
Translate some previously untranslated _doing_it_wrong() messages.
...
props georgestephanis.
fixes #25614 .
git-svn-id: https://develop.svn.wordpress.org/trunk@29840 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-05 21:05:54 +00:00
Mark Jaquith
7063377539
Use HTTPS URLs for core.trac.wordpress.org
...
see #27115
git-svn-id: https://develop.svn.wordpress.org/trunk@29788 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 13:27:55 +00:00
Sergey Biryukov
2a050d1e6f
Remove unnecessary semicolon.
...
props ixkaito.
fixes #29784 .
git-svn-id: https://develop.svn.wordpress.org/trunk@29784 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 10:29:16 +00:00
Andrew Nacin
1cde8312b6
DB: Revert [28814] and require a WHERE for wpdb::update().
...
see #26106 .
git-svn-id: https://develop.svn.wordpress.org/trunk@29664 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-02 04:55:17 +00:00
Drew Jaynes (DrewAPicture)
7ad77d58ee
Add periods to short descriptions for magic methods added in [28501], [28521], and [28524].
...
See #22234 and #28885 .
git-svn-id: https://develop.svn.wordpress.org/trunk@29165 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-14 01:11:55 +00:00
Drew Jaynes (DrewAPicture)
551f829c55
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@29163 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-14 01:01:22 +00:00
Andrew Nacin
a7c3b23f1c
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 .
git-svn-id: https://develop.svn.wordpress.org/trunk@28978 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 19:56:37 +00:00