Commit Graph

58 Commits

Author SHA1 Message Date
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
Scott Taylor
220fda0095 In $wpdb->update(), prevent explosions when $where is empty.
Adds unit tests.

Props UmeshSingla, wonderboymusic.
Fixes #26106


git-svn-id: https://develop.svn.wordpress.org/trunk@28814 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-24 00:23:09 +00:00
Scott Taylor
2a551f57a4 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@28711 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 00:29:35 +00:00
Drew Jaynes (DrewAPicture)
85961d28df 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@28657 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-04 05:00:00 +00:00
Scott Taylor
02a28ec4e9 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@28526 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 15:35:29 +00:00
Scott Taylor
4bddd84276 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@28339 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-07 03:55:32 +00:00
Drew Jaynes (DrewAPicture)
5ad1751132 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@28243 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-02 12:18:07 +00:00
Andrew Nacin
82bc9c1142 Rename USE_EXT_MYSQL to WP_USE_EXT_MYSQL. see #21663.
git-svn-id: https://develop.svn.wordpress.org/trunk@28022 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-07 22:26:19 +00:00
Drew Jaynes (DrewAPicture)
aba414af7e PHPDoc fixes for functionality in wp-includes/wp-db.php added in 3.9.
See #27700.


git-svn-id: https://develop.svn.wordpress.org/trunk@28016 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-07 22:01:37 +00:00
Andrew Nacin
f9e150c068 wpdb: Don't pass a second argument to mysqli_fetch_field().
props pento.
fixes #27693.


git-svn-id: https://develop.svn.wordpress.org/trunk@28002 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-07 20:21:16 +00:00
Andrew Nacin
ccb4f3714a 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@27935 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-03 21:57:22 +00:00
Andrew Nacin
0faaacc7c8 Database: Add $allow_bail argument to wpdb::check_connection() to match the connect method.
props DrProtocols, pento.
fixes #27240.


git-svn-id: https://develop.svn.wordpress.org/trunk@27925 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-03 04:05:31 +00:00
Sergey Biryukov
28dd458547 Avoid a warning in wpdb::db_connect(). before_needle parameter of strstr() was added in PHP 5.3.
props klihelp, pento.
fixes #27277.

git-svn-id: https://develop.svn.wordpress.org/trunk@27503 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-11 19:26:02 +00:00
Andrew Nacin
79143bfed1 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@27377 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 17:35:12 +00:00
Andrew Nacin
f3a23fb43f Reference https://wordpress.org rather than http://wordpress.org in strings, links, comments, etc.
props Ipstenu, markjaquith.
see #27115.


git-svn-id: https://develop.svn.wordpress.org/trunk@27369 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 02:33:24 +00:00
Andrew Nacin
544b73ec4c 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@27279 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 04:53:21 +00:00
Andrew Nacin
73ad0a310a Add a constant to disable mysqli for testing purposes. see #21663.
git-svn-id: https://develop.svn.wordpress.org/trunk@27278 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 04:19:45 +00:00
Andrew Nacin
b84ed60fa9 wpdb: set dbh to null when the mysqli connection fails. see #21663.
git-svn-id: https://develop.svn.wordpress.org/trunk@27277 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 04:14:54 +00:00
Andrew Nacin
19d7d1dd09 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@27257 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-25 15:52:48 +00:00
Andrew Nacin
f8af178264 Use ext/mysqli in PHP 5.5 or greater. Expect minor explosions.
props aaroncampbell, pento.
see #21663.


git-svn-id: https://develop.svn.wordpress.org/trunk@27250 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-25 00:39:28 +00:00
Andrew Nacin
c61accb146 Declare $wpdb->base_prefix.
props DavidAnderson.
fixes #16762.


git-svn-id: https://develop.svn.wordpress.org/trunk@27249 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-25 00:29:01 +00:00
Drew Jaynes
b013aaf4c9 Fixes for hooks documentation in wp-includes/wp-db.php.
See #26869, #25229 and [25284].


git-svn-id: https://develop.svn.wordpress.org/trunk@27147 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-09 20:50:42 +00:00