Commit Graph

262 Commits

Author SHA1 Message Date
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
Andrew Nacin
768db95280 Use ext/mysqli in PHP 5.5 or greater. Expect minor explosions.
props aaroncampbell, pento.
see #21663.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 00:40:13 +00:00
Andrew Nacin
1b9dda7d75 Declare $wpdb->base_prefix.
props DavidAnderson.
fixes #16762.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 00:30:13 +00:00
Drew Jaynes
aa8b462a95 Fixes for hooks documentation in wp-includes/wp-db.php.
See #26869, #25229 and [25284].

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


git-svn-id: http://core.svn.wordpress.org/trunk@27014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-09 20:51:13 +00:00
Andrew Nacin
43c7993c1a When the MySQL server has "gone away," attempt to reconnect and retry the query.
props pento.
see #5932.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-02 22:07:12 +00:00
Andrew Nacin
17828876fa Add a comment for [27073] as someone will inevitably complain it is tricked by % in a string. see #25604.
Built from https://develop.svn.wordpress.org/trunk@27074


git-svn-id: http://core.svn.wordpress.org/trunk@26947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-02 21:48:13 +00:00
Andrew Nacin
9c4a97c676 Throw an incorrect usage notice when the query argument of wpdb::prepare() does not include a placeholder.
props ounziw.
fixes #25604.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-02 21:47:11 +00:00
Andrew Nacin
9f250b2ef7 Ensure compatibility with MySQL 5.6 which has stricter SQL modes by default.
Disables NO_ZERO_DATE, ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, STRICT_ALL_TABLES, TRADITIONAL. Introduces wpdb::set_sql_mode() with an incompatible_sql_modes filter so a plugin can alter the set mode after the fact.

props pento.
fixes #26847.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-02 21:39:13 +00:00
Scott Taylor
678ef2b1e1 In wpdb::db_connect(), allow the loading of a custom database error template - this is already allowed in dead_db().
In `dead_db()`, move the call to `wp_load_translations_early()` before the inclusion of the `db-error.php` file to allow translation in both locations before the template is loaded.

Props sbruner, kovshenin.
Fixes #25703.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-29 05:28:12 +00:00
Scott Taylor
fc7a7b8972 When WP_DEBUG is set to true, suppress deprecated errors from firing when calling mysql_connect(), which is officially deprecated in PHP 5.5. We will remove this shameful code as soon as is humanly possible.
Props wonderboymusic. Extra love to tierra and nacin.
Fixes #26322.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-02 00:09:10 +00:00
Andrew Nacin
20b0153753 Document the 'query' filter in wp-db.
props natejacobs.
see #25229.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 17:07:09 +00:00
Andrew Nacin
f39e2c28ce Reset $wpdb->insert_id on a failed INSERT or REPLACE. See [24459] [24494].
git-svn-id: http://core.svn.wordpress.org/trunk@24872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 18:14:05 +00:00
Andrew Nacin
eb822723ae Check that we have a database connection in wpdb::_real_escape(). see #24773.
git-svn-id: http://core.svn.wordpress.org/trunk@24758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-20 20:16:21 +00:00
Andrew Nacin
0cb7fbacc8 Ensure _deprecated_function() exists before calling it. wpdb currently does not have a full functions.php dependency, and this can break external inclusions. see #24774.
git-svn-id: http://core.svn.wordpress.org/trunk@24724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-17 21:08:05 +00:00
Andrew Nacin
3b4f3dea29 Deprecate wpdb::escape() in favor of wpdb::prepare() and esc_sql(). fixes #24774.
git-svn-id: http://core.svn.wordpress.org/trunk@24718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-16 17:44:42 +00:00
Andrew Nacin
dffd2b1bd9 Always use mysql_real_escape_string(), even when DB_CHARSET is not properly set. fixes #24773.
git-svn-id: http://core.svn.wordpress.org/trunk@24712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-16 14:07:53 +00:00
Andrew Nacin
2ac8311b74 Partially revert [24459] and only flush insert_id on the next insert or replace query, as we had been doing before. (Yes, this is not how mysql_insert_id() works.)
git-svn-id: http://core.svn.wordpress.org/trunk@24494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 18:22:26 +00:00
Andrew Nacin
9f10b33324 Have wpdb::flush() reset more variables.
git-svn-id: http://core.svn.wordpress.org/trunk@24459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-21 01:32:54 +00:00
Sergey Biryukov
e65c4190f1 Remove extraneous function parameters in the wpdb class. props rlerdorf. see #24210.
git-svn-id: http://core.svn.wordpress.org/trunk@24121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-29 00:31:56 +00:00
Sergey Biryukov
2bcf4b8802 Only show database errors if WP_DEBUG_DISPLAY is enabled. props cheeserolls, storkontheroof, crazycoders. fixes #22203.
git-svn-id: http://core.svn.wordpress.org/trunk@24027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-18 09:51:02 +00:00
Andrew Nacin
e588812a49 Enforce a minimum of two arguments for wpdb::prepare(). The first argument is the query (or fragment thereof), which is required. Additional arguments are values to substitute into placeholders.
This will generate E_WARNINGs for insufficient arguments when prepare() is called with no additional arguments. This should discourage improper uses of prepare() under the guise of safely running a query.

props xknown. fixes #22262.



git-svn-id: http://core.svn.wordpress.org/trunk@22429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 19:30:59 +00:00
Andrew Nacin
d85554c5f1 When replacing floats in wpdb::prepare(), avoid escaped placeholders (%%f). props SergeyBiryukov. fixes #19861.
git-svn-id: http://core.svn.wordpress.org/trunk@22304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 20:52:50 +00:00
Ryan Boren
8ae2c51069 Correct phpdoc for wpdb::bail(). wp_die() is issued when show_errors is true, not false. Props SergeyBiryukov. fixes #22211
git-svn-id: http://core.svn.wordpress.org/trunk@22254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-17 13:11:45 +00:00
Ryan Boren
77518e9c71 Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865
git-svn-id: http://core.svn.wordpress.org/trunk@22118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 20:00:16 +00:00
Andrew Nacin
1508b46bb4 Call error_log() in wp-db without unnecessary conditionals. fixes #21103.
git-svn-id: http://core.svn.wordpress.org/trunk@21807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 01:35:43 +00:00