<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[47749] trunk/src/wp-includes/wp-db.php: Docs: Further update inline documentation for the `wpdb` class per the documentation standards.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/47749">47749</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/47749","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-05-03 11:43:14 +0000 (Sun, 03 May 2020)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Further update inline documentation for the `wpdb` class per the documentation standards.
Restore some previous edits from <a href="https://core.trac.wordpress.org/changeset/46696">[46696]</a>, <a href="https://core.trac.wordpress.org/changeset/47060">[47060]</a>, <a href="https://core.trac.wordpress.org/changeset/47122">[47122]</a>, <a href="https://core.trac.wordpress.org/changeset/47230">[47230]</a> that were accidentally reverted in <a href="https://core.trac.wordpress.org/changeset/47740">[47740]</a>.
See <a href="https://core.trac.wordpress.org/ticket/49572">#49572</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludeswpdbphp">trunk/src/wp-includes/wp-db.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludeswpdbphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/wp-db.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/wp-db.php 2020-05-02 22:55:17 UTC (rev 47748)
+++ trunk/src/wp-includes/wp-db.php 2020-05-03 11:43:14 UTC (rev 47749)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,11 +37,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> define( 'ARRAY_N', 'ARRAY_N' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * WordPress database access abstraction class
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * WordPress database access abstraction class.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This class is used to interact with a database without needing to use raw SQL statements. By default, WordPress
- * uses this class to instantiate the global $wpdb object, providing access to the WordPress database.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This class is used to interact with a database without needing to use raw SQL statements.
+ * By default, WordPress uses this class to instantiate the global $wpdb object, providing
+ * access to the WordPress database.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * It is possible to replace this class with your own by setting the $wpdb global variable
+ * in wp-content/db.php file to your class. The wpdb class will still be included, so you can
+ * extend it or simply use your own.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @link https://developer.wordpress.org/reference/classes/wpdb/
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -67,7 +72,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var $suppress_errors = false;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The last error encountered during the last query.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The error encountered during the last query.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -187,7 +192,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $0 The query's SQL.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type float $1 Total time spent on the query, in seconds.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string $2 Comma separated list of the calling functions.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string $2 Comma-separated list of the calling functions.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type float $3 Unix timestamp of the time at the start of the query.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type array $4 Custom query data.
</span><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -270,7 +275,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * List of deprecated WordPress tables.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * categories, post2cat, and link2cat were deprecated in 2.3.0, db version 5539.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * 'categories', 'post2cat', and 'link2cat' were deprecated in 2.3.0, db version 5539.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::tables()
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -461,9 +466,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public $sitemeta;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Format specifiers for DB columns. Columns not listed here default to %s. Initialized during WP load.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Format specifiers for DB columns.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Keys are column names, values are format types: 'ID' => '%d'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Columns not listed here default to %s. Initialized during WP load.
+ * Keys are column names, values are format types: 'ID' => '%d'.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.8.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::prepare()
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -542,7 +548,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Whether MySQL is used as the database engine.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set in WPDB::db_connect() to true, by default. This is used when checking
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Set in wpdb::db_connect() to true, by default. This is used when checking
</ins><span class="cx" style="display: block; padding: 0 10px"> * against the required MySQL version for WordPress. Normally, a replacement
</span><span class="cx" style="display: block; padding: 0 10px"> * database drop-in (db.php) will skip these checks, but setting this to true
</span><span class="cx" style="display: block; padding: 0 10px"> * will force the checks to occur.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -586,12 +592,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Connects to the database server and selects a database.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * PHP5 style constructor for compatibility with PHP5. Does the actual setting up of the class properties and
- * connection to the database.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * PHP5 style constructor for compatibility with PHP5. Does the actual setting up
+ * of the class properties and connection to the database.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link https://core.trac.wordpress.org/ticket/3354
</del><span class="cx" style="display: block; padding: 0 10px"> * @since 2.0.8
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://core.trac.wordpress.org/ticket/3354
</ins><span class="cx" style="display: block; padding: 0 10px"> * @global string $wp_version The WordPress version string.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $dbuser MySQL database user.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -632,7 +638,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $name The private member to get, and optionally process.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return mixed The private member.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return mixed The private member.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function __get( $name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'col_info' === $name ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -667,9 +673,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $name The private member to check.
- *
- * @return bool If the member is set or not.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $name The private member to check.
+ * @return bool If the member is set or not.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function __isset( $name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return isset( $this->$name );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -687,7 +692,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set $this->charset and $this->collate
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets $this->charset and $this->collate.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -810,13 +815,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Change the current SQL mode, and ensure its WordPress compatibility.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Changes the current SQL mode, and ensures its WordPress compatibility.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * If no modes are passed, it will ensure the current MySQL server modes are compatible.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $modes Optional. A list of SQL modes to set.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $modes Optional. A list of SQL modes to set. Default empty array.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function set_sql_mode( $modes = array() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $modes ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -879,7 +884,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $prefix Alphanumeric name for the new prefix.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param bool $set_table_names Optional. Whether the table names, e.g. wpdb::$posts, should be updated or not.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param bool $set_table_names Optional. Whether the table names, e.g. wpdb::$posts,
+ * should be updated or not. Default true.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string|WP_Error Old prefix or WP_Error on error.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function set_prefix( $prefix, $set_table_names = true ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -952,6 +958,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Gets blog prefix.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $blog_id Optional.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Blog prefix.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -974,27 +981,30 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Returns an array of WordPress tables.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to override the WordPress users and usermeta
- * tables that would otherwise be determined by the prefix.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to override the WordPress users
+ * and usermeta tables that would otherwise be determined by the prefix.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The $scope argument can take one of the following:
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * 'all' - returns 'all' and 'global' tables. No old tables are returned.
</span><span class="cx" style="display: block; padding: 0 10px"> * 'blog' - returns the blog-level tables for the queried blog.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * 'global' - returns the global tables for the installation, returning multisite tables only if running multisite.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * 'global' - returns the global tables for the installation, returning multisite tables only on multisite.
</ins><span class="cx" style="display: block; padding: 0 10px"> * 'ms_global' - returns the multisite global tables, regardless if current installation is multisite.
</span><span class="cx" style="display: block; padding: 0 10px"> * 'old' - returns tables which are deprecated.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @uses wpdb::$tables
</span><span class="cx" style="display: block; padding: 0 10px"> * @uses wpdb::$old_tables
</span><span class="cx" style="display: block; padding: 0 10px"> * @uses wpdb::$global_tables
</span><span class="cx" style="display: block; padding: 0 10px"> * @uses wpdb::$ms_global_tables
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $scope Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all.
- * @param bool $prefix Optional. Whether to include table prefixes. Default true. If blog
- * prefix is requested, then the custom users and usermeta tables will be mapped.
- * @param int $blog_id Optional. The blog_id to prefix. Defaults to wpdb::$blogid. Used only when prefix is requested.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $scope Optional. Possible values include 'all', 'global', 'ms_global', 'blog',
+ * or 'old' tables. Default 'all'.
+ * @param bool $prefix Optional. Whether to include table prefixes. If blog prefix is requested,
+ * then the custom users and usermeta tables will be mapped. Default true.
+ * @param int $blog_id Optional. The blog_id to prefix. Used only when prefix is requested.
+ * Defaults to wpdb::$blogid.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return array Table names. When a prefix is requested, the key is the unprefixed table name.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1055,12 +1065,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Selects a database using the current database connection.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The database name will be changed based on the current database connection. On failure, the execution will
- * bail and display a DB error.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The database name will be changed based on the current database connection.
+ * On failure, the execution will bail and display a DB error.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $db MySQL database name
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $db MySQL database name.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param resource|null $dbh Optional link identifier.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function select( $db, $dbh = null ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1122,7 +1132,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.8.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @deprecated 3.6.0 Use wpdb::prepare()
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @see wpdb::prepare
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @see wpdb::prepare()
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see esc_sql()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $string
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1136,11 +1146,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Real escape, using mysqli_real_escape_string() or mysql_real_escape_string()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Real escape, using mysqli_real_escape_string() or mysql_real_escape_string().
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 2.8.0
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see mysqli_real_escape_string()
</span><span class="cx" style="display: block; padding: 0 10px"> * @see mysql_real_escape_string()
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 2.8.0
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $string String to escape.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Escaped string.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1167,10 +1178,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Escape data. Works on arrays.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Escapes data. Works on arrays.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 2.8.0
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @uses wpdb::_real_escape()
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 2.8.0
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string|array $data Data to escape.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|array Escaped data, in the same type as supplied.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1201,8 +1213,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::prepare()
</span><span class="cx" style="display: block; padding: 0 10px"> * @see esc_sql()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $data
- * @return mixed
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|array $data Data to escape.
+ * @return string|array Escaped data, in the same type as supplied.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function escape( $data ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1246,37 +1258,39 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * %f (float)
</span><span class="cx" style="display: block; padding: 0 10px"> * %s (string)
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * All placeholders MUST be left unquoted in the query string. A corresponding argument MUST be passed for each
- * placeholder.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * All placeholders MUST be left unquoted in the query string. A corresponding argument
+ * MUST be passed for each placeholder.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Note: There is one exception to the above: for compatibility with old behavior, older-style numbered or formatted
- * string placeholders (eg, %1$s, %5s) will not have quotes added by this function, so should be passed with
- * appropriate quotes around them.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Note: There is one exception to the above: for compatibility with old behavior,
+ * numbered or formatted string placeholders (eg, %1$s, %5s) will not have quotes
+ * added by this function, so should be passed with appropriate quotes around them.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Literal percentage signs (%) in the query string must be written as %%. Percentage wildcards (for example,
- * to use in LIKE syntax) must be passed via a substitution argument containing the complete LIKE string, these
- * cannot be inserted directly in the query string. Also see wpdb::esc_like().
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Literal percentage signs (%) in the query string must be written as %%. Percentage wildcards
+ * (for example, to use in LIKE syntax) must be passed via a substitution argument containing
+ * the complete LIKE string, these cannot be inserted directly in the query string.
+ * Also see wpdb::esc_like().
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Arguments may be passed as individual arguments to the method, or as a single array containing all arguments.
- * A combination of the two is not supported.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Arguments may be passed as individual arguments to the method, or as a single array
+ * containing all arguments. A combination of the two is not supported.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><span class="cx" style="display: block; padding: 0 10px"> * $wpdb->prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d OR `other_field` LIKE %s", array( 'foo', 1337, '%bar' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> * $wpdb->prepare( "SELECT DATE_FORMAT(`field`, '%%c') FROM `table` WHERE `column` = %s", 'foo' );
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link https://www.php.net/sprintf Description of syntax.
</del><span class="cx" style="display: block; padding: 0 10px"> * @since 2.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.3.0 Formalized the existing and already documented `...$args` parameter
</span><span class="cx" style="display: block; padding: 0 10px"> * by updating the function signature. The second parameter was changed
</span><span class="cx" style="display: block; padding: 0 10px"> * from `$args` to `...$args`.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/sprintf Description of syntax.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $query Query statement with sprintf()-like placeholders.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called
- * with an array of arguments, or the first variable to substitute into the query's
- * placeholders if being called with individual arguments.
- * @param mixed ...$args Further variables to substitute into the query's placeholders if being called with
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array|mixed $args The array of variables to substitute into the query's placeholders
+ * if being called with an array of arguments, or the first variable
+ * to substitute into the query's placeholders if being called with
</ins><span class="cx" style="display: block; padding: 0 10px"> * individual arguments.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param mixed ...$args Further variables to substitute into the query's placeholders
+ * if being called with individual arguments.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string|void Sanitized query string, if there is a query to prepare.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function prepare( $query, ...$args ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1388,7 +1402,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * First half of escaping for LIKE special characters % and _ before preparing for MySQL.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Example Prepared Statement:
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1403,10 +1417,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $text The raw text to be escaped. The input typed by the user should have no
- * extra or deleted slashes.
- * @return string Text in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()
- * or real_escape next.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $text The raw text to be escaped. The input typed by the user
+ * should have no extra or deleted slashes.
+ * @return string Text in the form of a LIKE phrase. The output is not SQL safe.
+ * Call wpdb::prepare() or wpdb::_real_escape() next.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function esc_like( $text ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return addcslashes( $text, '_%\\' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1413,12 +1427,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Print SQL/DB error.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Prints SQL/DB error.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @global array $EZSQL_ERROR Stores error information of query and error string
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $str The error to display
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global array $EZSQL_ERROR Stores error information of query and error string.
+ *
+ * @param string $str The error to display.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void|false Void if the showing of errors is enabled, false if disabled.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function print_error( $str = '' ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1489,15 +1504,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Enables showing of database errors.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This function should be used only to enable showing of errors. wpdb::hide_errors() should be used instead for
- * hiding of errors. However, this function can be used to enable and disable showing of database errors.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This function should be used only to enable showing of errors.
+ * wpdb::hide_errors() should be used instead for hiding errors.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @see wpdb::hide_errors()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 0.71
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 0.71
</del><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::hide_errors()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param bool $show Whether to show or hide errors.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param bool $show Optional. Whether to show errors. Default true.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether showing of errors was previously active.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function show_errors( $show = true ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1512,6 +1526,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * By default database errors are not shown.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::show_errors()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether showing of errors was previously active.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1523,15 +1538,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Whether to suppress database errors.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Enables or disables suppressing of database errors.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * By default database errors are suppressed, with a simple call to this function they can be enabled.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * By default database errors are suppressed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::hide_errors()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param bool $suppress Optional. New value. Defaults to true.
- * @return bool Old value
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param bool $suppress Optional. Whether to suppress errors. Default true.
+ * @return bool Whether suppressing of errors was previously active.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function suppress_errors( $suppress = true ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $errors = $this->suppress_errors;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1540,7 +1556,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Kill cached query results.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Kills cached query results.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1571,7 +1587,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Connect to and select database.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Connects to and selects database.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * If $allow_bail is false, the lack of database connection will need to be handled manually.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1605,9 +1621,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * If using the `mysqlnd` library, the IPv6 address needs to be
- * enclosed in square brackets, whereas it doesn't while using the
- * `libmysqlclient` library.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * If using the `mysqlnd` library, the IPv6 address needs to be enclosed
+ * in square brackets, whereas it doesn't while using the `libmysqlclient` library.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see https://bugs.php.net/bug.php?id=67563
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $is_ipv6 && extension_loaded( 'mysqlnd' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1707,17 +1722,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Parse the DB_HOST setting to interpret it for mysqli_real_connect.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Parses the DB_HOST setting to interpret it for mysqli_real_connect().
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * mysqli_real_connect doesn't support the host param including a port or socket like mysql_connect does. This
- * duplicates how mysql_connect detects a port and/or socket file.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * mysqli_real_connect() doesn't support the host param including a port or socket
+ * like mysql_connect() does. This duplicates how mysql_connect() detects a port
+ * and/or socket file.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $host The DB_HOST setting to parse.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array|bool Array containing the host, the port, the socket and whether
- * it is an IPv6 address, in that order. If $host couldn't be parsed,
- * returns false.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array|false Array containing the host, the port, the socket and
+ * whether it is an IPv6 address, in that order.
+ * False if $host couldn't be parsed.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function parse_db_host( $host ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $port = null;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1762,8 +1778,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Checks that the connection to the database is still up. If not, try to reconnect.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * If this function is unable to reconnect, it will forcibly die, or if after the {@see 'template_redirect'} hook
- * has been fired, return false instead.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * If this function is unable to reconnect, it will forcibly die, or if called
+ * after the {@see 'template_redirect'} hook has been fired, return false instead.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * If $allow_bail is false, the lack of database connection will need to be handled manually.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1792,8 +1808,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> for ( $tries = 1; $tries <= $this->reconnect_retries; $tries++ ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // On the last try, re-enable warnings. We want to see a single instance of the
- // "unable to connect" message on the bail() screen, if it appears.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // On the last try, re-enable warnings. We want to see a single instance
+ // of the "unable to connect" message on the bail() screen, if it appears.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->reconnect_retries === $tries && WP_DEBUG ) {
</span><span class="cx" style="display: block; padding: 0 10px"> error_reporting( $error_reporting );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1843,18 +1859,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // We weren't able to reconnect, so we better bail.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->bail( $message, 'db_connect_fail' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Call dead_db() if bail didn't die, because this database is no more. It has ceased to be (at least temporarily).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Call dead_db() if bail didn't die, because this database is no more.
+ // It has ceased to be (at least temporarily).
</ins><span class="cx" style="display: block; padding: 0 10px"> dead_db();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Perform a MySQL database query, using current database connection.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Performs a MySQL database query, using current database connection.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * More information can be found on the codex page.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * More information can be found on the Codex page.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $query Database query
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://codex.wordpress.org/Function_Reference/wpdb_Class
+ *
+ * @param string $query Database query.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return int|bool Boolean true for CREATE, ALTER, TRUNCATE and DROP queries. Number of rows
</span><span class="cx" style="display: block; padding: 0 10px"> * affected/selected for all other queries. Boolean false on error.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1986,7 +2005,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Log number of rows the query returned and return number of rows selected.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Log and return the number of rows selected.
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->num_rows = $num_rows;
</span><span class="cx" style="display: block; padding: 0 10px"> $return_val = $num_rows;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2033,10 +2052,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $query The query's SQL.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param float $query_time Total time spent on the query, in seconds.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $query_callstack Comma separated list of the calling functions.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $query_callstack Comma-separated list of the calling functions.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param float $query_start Unix timestamp of the time at the start of the query.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $query_data Custom query data.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * }
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function log_query( $query, $query_time, $query_callstack, $query_start, $query_data ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2051,7 +2069,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $query_data Custom query data.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $query The query's SQL.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param float $query_time Total time spent on the query, in seconds.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $query_callstack Comma separated list of the calling functions.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $query_callstack Comma-separated list of the calling functions.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param float $query_start Unix timestamp of the time at the start of the query.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $query_data = apply_filters( 'log_query_custom_data', $query_data, $query, $query_time, $query_callstack, $query_start );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2124,7 +2142,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Insert a row into a table.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Inserts a row into the table.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 'bar' ) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2131,6 +2149,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::prepare()
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::$field_types
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wp_set_wpdb_vars()
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2152,7 +2171,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Replace a row into a table.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Replaces a row in the table.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 'bar' ) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2159,6 +2178,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::prepare()
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::$field_types
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wp_set_wpdb_vars()
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2185,11 +2205,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Runs an insert or replace query based on $type argument.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::prepare()
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::$field_types
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wp_set_wpdb_vars()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $table Table name
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $table Table name.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $data Data to insert (in column => value pairs).
</span><span class="cx" style="display: block; padding: 0 10px"> * Both $data columns and $data values should be "raw" (neither should be SQL escaped).
</span><span class="cx" style="display: block; padding: 0 10px"> * Sending a null value will cause the column to be set to NULL - the corresponding
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2199,7 +2220,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * A format is one of '%d', '%f', '%s' (integer, float, string).
</span><span class="cx" style="display: block; padding: 0 10px"> * If omitted, all values in $data will be treated as strings unless otherwise
</span><span class="cx" style="display: block; padding: 0 10px"> * specified in wpdb::$field_types.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $type Optional. What type of operation is this? INSERT or REPLACE. Defaults to INSERT.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $type Optional. Type of operation. Possible values include 'INSERT' or 'REPLACE'.
+ * Default 'INSERT'.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return int|false The number of rows affected, or false on error.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2236,7 +2258,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Update a row in the table.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Updates a row in the table.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Examples:
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 'bar' ), array( 'ID' => 1 ) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2243,11 +2265,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::prepare()
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::$field_types
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wp_set_wpdb_vars()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $table Table name
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $table Table name.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $data Data to update (in column => value pairs).
</span><span class="cx" style="display: block; padding: 0 10px"> * Both $data columns and $data values should be "raw" (neither should be SQL escaped).
</span><span class="cx" style="display: block; padding: 0 10px"> * Sending a null value will cause the column to be set to NULL - the corresponding
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2314,17 +2337,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Delete a row in the table
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Deletes a row in the table.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Examples:
</ins><span class="cx" style="display: block; padding: 0 10px"> * wpdb::delete( 'table', array( 'ID' => 1 ) )
</span><span class="cx" style="display: block; padding: 0 10px"> * wpdb::delete( 'table', array( 'ID' => 1 ), array( '%d' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.4.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::prepare()
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::$field_types
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wp_set_wpdb_vars()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $table Table name
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $table Table name.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $where A named array of WHERE clauses (in column => value pairs).
</span><span class="cx" style="display: block; padding: 0 10px"> * Multiple clauses will be joined with ANDs.
</span><span class="cx" style="display: block; padding: 0 10px"> * Both $where columns and $where values should be "raw".
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2370,10 +2395,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Processes arrays of field/value pairs and field formats.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This is a helper method for wpdb's CRUD methods, which take field/value pairs for inserts, updates, and where
- * clauses. This method first pairs each value with a format. Then it determines the charset of that field, using
- * that to determine if any invalid text would be stripped. If text is stripped, then field processing is rejected
- * and the query fails.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This is a helper method for wpdb's CRUD methods, which take field/value pairs
+ * for inserts, updates, and where clauses. This method first pairs each value
+ * with a format. Then it determines the charset of that field, using that
+ * to determine if any invalid text would be stripped. If text is stripped,
+ * then field processing is rejected and the query fails.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2380,9 +2406,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $table Table name.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $data Field/value pair.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param mixed $format Format for each field.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- *
- * @return array|false Returns an array of fields that contain paired value and formats. Returns false for
- * invalid values.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array|false An array of fields that contain paired value and formats.
+ * False for invalid values.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function process_fields( $table, $data, $format ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $data = $this->process_field_formats( $data, $format );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2416,7 +2441,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $data Array of fields to values.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param mixed $format Formats to be mapped to the values in $data.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array Array, keyed by field names with values being an array of 'value' and 'format' keys.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array Array, keyed by field names with values being an array
+ * of 'value' and 'format' keys.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function process_field_formats( $data, $format ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $formats = (array) $format;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2444,7 +2470,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Adds field charsets to field/value/format arrays generated by the wpdb::process_field_formats() method.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds field charsets to field/value/format arrays generated by wpdb::process_field_formats().
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2451,6 +2477,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $data As it comes from the wpdb::process_field_formats() method.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $table Table name.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array|false The same array as $data with additional 'charset' keys.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * False on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function process_field_charsets( $data, $table ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $data as $field => $value ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2474,7 +2501,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * For string fields, record the maximum string length that field can safely save.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * For string fields, records the maximum string length that field can safely save.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.1
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2505,11 +2532,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve one variable from the database.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves one variable from the database.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Executes a SQL query and returns the value from the SQL result. If the SQL result contains more than one column
- * and/or more than one row, the value in the column and row specified is returned. If $query is null, the value
- * in the specified column and row from the previous SQL result is returned.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Executes a SQL query and returns the value from the SQL result.
+ * If the SQL result contains more than one column and/or more than one row,
+ * the value in the column and row specified is returned. If $query is null,
+ * the value in the specified column and row from the previous SQL result is returned.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2516,7 +2544,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string|null $query Optional. SQL query. Defaults to null, use the result from the previous query.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $x Optional. Column of value to return. Indexed from 0.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $y Optional. Row of value to return. Indexed from 0.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string|null Database query result (as string), or null on failure
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|null Database query result (as string), or null on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_var( $query = null, $x = 0, $y = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->func_call = "\$db->get_var(\"$query\", $x, $y)";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2529,17 +2557,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->query( $query );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Extract var out of cached results based x,y vals.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Extract var out of cached results based on x,y vals.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $this->last_result[ $y ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $values = array_values( get_object_vars( $this->last_result[ $y ] ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If there is a value return it else return null.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If there is a value return it, else return null.
</ins><span class="cx" style="display: block; padding: 0 10px"> return ( isset( $values[ $x ] ) && '' !== $values[ $x ] ) ? $values[ $x ] : null;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve one row from the database.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves one row from the database.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Executes a SQL query and returns the row from the SQL result.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2546,11 +2574,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string|null $query SQL query.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
- * correspond to a stdClass object, an associative array, or a numeric array,
- * respectively. Default OBJECT.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $output Optional. The required return type. Possible values include
+ * OBJECT, ARRAY_A, or ARRAY_N, which correspond to an stdClass object,
+ * an associative array, or a numeric array, respectively. Default OBJECT.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $y Optional. Row to return. Indexed from 0.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array|object|null|void Database query result in format specified by $output or null on failure
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array|object|null|void Database query result in format specified by $output or null on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_row( $query = null, $output = OBJECT, $y = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2584,11 +2612,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve one column from the database.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves one column from the database.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Executes a SQL query and returns the column from the SQL result. If the SQL result contains more than one column,
- * this function returns the column specified. If $query is null, this function returns the specified column from
- * the previous SQL result.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Executes a SQL query and returns the column from the SQL result.
+ * If the SQL result contains more than one column, the column specified is returned.
+ * If $query is null, the specified column from the previous SQL result is returned.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2616,7 +2644,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve an entire SQL result set from the database (i.e., many rows)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves an entire SQL result set from the database (i.e., many rows).
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Executes a SQL query and returns the entire SQL result.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2624,11 +2652,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $query SQL query.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $output Optional. Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * With one of the first three, return an array of rows indexed from 0 by SQL result row
- * number. Each row is an associative array (column => value, ...), a numerically indexed
- * array (0 => value, ...), or an object. ( ->column = value ), respectively. With
- * OBJECT_K, return an associative array of row objects keyed by the value of each row's
- * first column's value. Duplicate keys are discarded.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * With one of the first three, return an array of rows indexed
+ * from 0 by SQL result row number. Each row is an associative array
+ * (column => value, ...), a numerically indexed array (0 => value, ...),
+ * or an object ( ->column = value ), respectively. With OBJECT_K,
+ * return an associative array of row objects keyed by the value
+ * of each row's first column's value. Duplicate keys are discarded.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return array|object|null Database query results.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2791,8 +2820,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $table Table name.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $column Column name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string|false|WP_Error Column character set as a string. False if the column has no character set.
- * WP_Error object if there was an error.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|false|WP_Error Column character set as a string. False if the column has
+ * no character set. WP_Error object if there was an error.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_col_charset( $table, $column ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $tablekey = strtolower( $table );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2848,7 +2877,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve the maximum string length allowed in a given column.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves the maximum string length allowed in a given column.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The length may either be specified as a byte length or a character length.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2856,8 +2885,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $table Table name.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $column Column name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array|false|WP_Error array( 'length' => (int), 'type' => 'byte' | 'char' )
- * false if the column has no length (for example, numeric column)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array|false|WP_Error array( 'length' => (int), 'type' => 'byte' | 'char' ).
+ * False if the column has no length (for example, numeric column).
</ins><span class="cx" style="display: block; padding: 0 10px"> * WP_Error object if there was an error.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_col_length( $table, $column ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2939,10 +2968,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Check if a string is ASCII.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Checks if a string is ASCII.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The negative regex is faster for non-ASCII strings, as it allows the search to finish as soon as it encounters
- * a non-ASCII character.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The negative regex is faster for non-ASCII strings, as it allows
+ * the search to finish as soon as it encounters a non-ASCII character.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2962,7 +2991,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Check if the query is accessing a collation considered safe on the current version of MySQL.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Checks if the query is accessing a collation considered safe on the current version of MySQL.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3023,11 +3052,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $data Array of value arrays. Each value array has the keys 'value' and 'charset'. An optional
- * 'ascii' key can be set to false to avoid redundant ASCII checks.
- * @return array|WP_Error The $data parameter, with invalid characters removed from each value. This works as a
- * passthrough: any additional keys such as 'field' are retained in each value array. If we
- * cannot remove invalid characters, a WP_Error object is returned.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $data Array of value arrays. Each value array has the keys 'value' and 'charset'.
+ * An optional 'ascii' key can be set to false to avoid redundant ASCII checks.
+ * @return array|WP_Error The $data parameter, with invalid characters removed from each value.
+ * This works as a passthrough: any additional keys such as 'field' are
+ * retained in each value array. If we cannot remove invalid characters,
+ * a WP_Error object is returned.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function strip_invalid_text( $data ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $db_check_string = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3040,8 +3070,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $truncate_by_byte_length = 'byte' === $value['length']['type'];
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $length = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Since we have no length, we'll never truncate. Initialize the variable to false. true would take us
- // through an unnecessary (for this case) codepath below.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Since we have no length, we'll never truncate. Initialize the variable to false.
+ // True would take us through an unnecessary (for this case) codepath below.
</ins><span class="cx" style="display: block; padding: 0 10px"> $truncate_by_byte_length = false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3180,7 +3210,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $query Query to convert.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $query Query to convert.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string|WP_Error The converted query, or a WP_Error object if the conversion fails.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function strip_invalid_text_from_query( $query ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3261,7 +3291,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Find the first table name referenced in a query.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Finds the first table name referenced in a query.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3300,9 +3330,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * SHOW TABLE STATUS LIKE and SHOW TABLES LIKE 'wp\_123\_%'
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This quoted LIKE operand seldom holds a full table name. It is usually a
- * pattern for matching a prefix so we just strip the trailing % and unescape
- * the _ to get 'wp_123_' which drop-ins can use for routing these SQL statements.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This quoted LIKE operand seldom holds a full table name.
+ * It is usually a pattern for matching a prefix so we just
+ * strip the trailing % and unescape the _ to get 'wp_123_'
+ * which drop-ins can use for routing these SQL statements.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( preg_match( '/^\s*SHOW\s+(?:TABLE\s+STATUS|(?:FULL\s+)?TABLES)\s+(?:WHERE\s+Name\s+)?LIKE\s*("|\')((?:[\\\\0-9a-zA-Z$_.-]|[\xC2-\xDF][\x80-\xBF])+)%?\\1/is', $query, $maybe ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return str_replace( '\\_', '_', $maybe[2] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3335,7 +3366,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Load the column metadata from the last query.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Loads the column metadata from the last query.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3358,15 +3389,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve column metadata from the last query.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves column metadata from the last query.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $info_type Optional. Type one of name, table, def, max_length, not_null, primary_key,
- * multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $info_type Optional. Possible values include 'name', 'table', 'def', 'max_length',
+ * 'not_null', 'primary_key', 'multiple_key', 'unique_key', 'numeric',
+ * 'blob', 'type', 'unsigned', 'zerofill'. Default 'name'.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $col_offset Optional. 0: col name. 1: which table the col's in. 2: col's max length.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * 3: if the col is numeric. 4: col's type
- * @return mixed Column Results
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * 3: if the col is numeric. 4: col's type. Default -1.
+ * @return mixed Column results.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_col_info( $info_type = 'name', $col_offset = -1 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->load_col_info();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3416,9 +3448,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $message The Error message
- * @param string $error_code Optional. A Computer readable string to identify the error.
- * @return false|void
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $message The error message.
+ * @param string $error_code Optional. A computer-readable string to identify the error.
+ * Default '500'.
+ * @return void|false Void if the showing of errors is enabled, false if disabled.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function bail( $message, $error_code = '500' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $this->show_errors ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3460,7 +3493,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return bool True if the connection was successfully closed, false if it wasn't, or if the connection doesn't exist.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return bool True if the connection was successfully closed,
+ * false if it wasn't, or if the connection doesn't exist.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function close() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $this->dbh ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3483,13 +3517,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Whether MySQL database is at least the required minimum version.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Determines whether MySQL database is at least the required minimum version.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @global string $wp_version
- * @global string $required_mysql_version
- * @return WP_Error|void
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global string $wp_version The WordPress version string.
+ * @global string $required_mysql_version The required MySQL version string.
+ * @return void|WP_Error
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function check_database_version() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_version, $required_mysql_version;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3501,7 +3535,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Whether the database supports collation.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Determines whether the database supports collation.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Called when WordPress is generating the table scheme.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3510,7 +3544,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @deprecated 3.5.0 Use wpdb::has_cap()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return bool True if collation is supported, false if version does not
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return bool True if collation is supported, false if not.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function supports_collation() {
</span><span class="cx" style="display: block; padding: 0 10px"> _deprecated_function( __FUNCTION__, '3.5.0', 'wpdb::has_cap( \'collation\' )' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3518,7 +3552,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The database character collate.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves the database character collate.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3538,7 +3572,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Determine if a database supports a particular feature.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Determines if a database supports a particular feature.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.7.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.1.0 Added support for the 'utf8mb4' feature.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3546,8 +3580,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see wpdb::db_version()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $db_cap The feature to check for. Accepts 'collation', 'group_concat', 'subqueries', 'set_charset',
- * 'utf8mb4', or 'utf8mb4_520'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $db_cap The feature to check for. Accepts 'collation', 'group_concat',
+ * 'subqueries', 'set_charset', 'utf8mb4', or 'utf8mb4_520'.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return int|false Whether the database feature is supported, false otherwise.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function has_cap( $db_cap ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3588,13 +3622,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve the name of the function that called wpdb.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves the name of the function that called wpdb.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Searches up the list of functions until it reaches the one that would most logically had called this method.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Searches up the list of functions until it reaches the one that would
+ * most logically had called this method.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string Comma separated list of the calling functions.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string Comma-separated list of the calling functions.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_caller() {
</span><span class="cx" style="display: block; padding: 0 10px"> return wp_debug_backtrace_summary( __CLASS__ );
</span></span></pre>
</div>
</div>
</body>
</html>