Changeset 56475
- Timestamp:
- 08/26/2023 01:01:05 PM (14 months ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpcompat.xml.dist
r56141 r56475 82 82 <exclude-pattern>/random_compat/random_bytes_mcrypt\.php$</exclude-pattern> 83 83 </rule> 84 85 <!-- Allow the WP DB Class for use of `mysql_` extension in PHP < 7.0. -->86 <rule ref="PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved">87 <exclude-pattern>/src/wp-includes/class-wpdb\.php</exclude-pattern>88 </rule>89 84 </ruleset> -
trunk/src/wp-admin/includes/class-wp-debug-data.php
r56346 r56475 856 856 857 857 // Populate the database debug fields. 858 if ( is_resource( $wpdb->dbh ) ) { 859 // Old mysql extension. 860 $extension = 'mysql'; 861 } elseif ( is_object( $wpdb->dbh ) ) { 858 if ( is_object( $wpdb->dbh ) ) { 862 859 // mysqli or PDO. 863 860 $extension = get_class( $wpdb->dbh ); … … 869 866 $server = $wpdb->get_var( 'SELECT VERSION()' ); 870 867 871 if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) { 872 $client_version = $wpdb->dbh->client_info; 873 } else { 874 // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_client_info,PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved 875 if ( preg_match( '|[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}|', mysql_get_client_info(), $matches ) ) { 876 $client_version = $matches[0]; 877 } else { 878 $client_version = null; 879 } 880 } 868 $client_version = $wpdb->dbh->client_info; 881 869 882 870 $info['wp-database']['fields']['extension'] = array( -
trunk/src/wp-admin/includes/class-wp-site-health.php
r56401 r56475 1357 1357 } 1358 1358 1359 if ( $wpdb->use_mysqli ) { 1360 // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_client_info 1361 $mysql_client_version = mysqli_get_client_info(); 1362 } else { 1363 // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysql_get_client_info,PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved 1364 $mysql_client_version = mysql_get_client_info(); 1365 } 1359 // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_client_info 1360 $mysql_client_version = mysqli_get_client_info(); 1366 1361 1367 1362 /* -
trunk/src/wp-includes/class-wpdb.php
r56180 r56475 143 143 * Possible values: 144 144 * 145 * - For successful SELECT, SHOW, DESCRIBE, or EXPLAIN queries: 146 * - `mysqli_result` instance when the `mysqli` driver is in use 147 * - `resource` when the older `mysql` driver is in use 145 * - `mysqli_result` instance for successful SELECT, SHOW, DESCRIBE, or EXPLAIN queries 148 146 * - `true` for other query types that were successful 149 147 * - `null` if a query is yet to be made or if the result has since been flushed … … 152 150 * @since 0.71 153 151 * 154 * @var mysqli_result| resource|bool|null152 * @var mysqli_result|bool|null 155 153 */ 156 154 protected $result; … … 605 603 * Possible values: 606 604 * 607 * - `mysqli` instance when the `mysqli` driver is in use 608 * - `resource` when the older `mysql` driver is in use 605 * - `mysqli` instance during normal operation 609 606 * - `null` if the connection is yet to be made or has been closed 610 607 * - `false` if the connection has failed … … 612 609 * @since 0.71 613 610 * 614 * @var mysqli| resource|false|null611 * @var mysqli|false|null 615 612 */ 616 613 protected $dbh; … … 695 692 696 693 /** 697 * Whether to use mysqli over mysql. Default false.698 *699 * @since 3.9.0700 *701 * @var bool702 */703 private $use_mysqli = false;704 705 /**706 694 * Whether we've managed to successfully connect at some point. 707 695 * … … 750 738 if ( WP_DEBUG && WP_DEBUG_DISPLAY ) { 751 739 $this->show_errors(); 752 }753 754 // Use the `mysqli` extension if it exists unless `WP_USE_EXT_MYSQL` is defined as true.755 if ( function_exists( 'mysqli_connect' ) ) {756 $this->use_mysqli = true;757 758 if ( defined( 'WP_USE_EXT_MYSQL' ) ) {759 $this->use_mysqli = ! WP_USE_EXT_MYSQL;760 }761 740 } 762 741 … … 881 860 */ 882 861 public function determine_charset( $charset, $collate ) { 883 if ( ( $this->use_mysqli &&! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) {862 if ( ( ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) { 884 863 return compact( 'charset', 'collate' ); 885 864 } … … 916 895 * @since 3.1.0 917 896 * 918 * @param mysqli |resource $dbh The connection returned by `mysqli_connect()` or `mysql_connect()`.919 * @param string 920 * @param string 897 * @param mysqli $dbh The connection returned by `mysqli_connect()`. 898 * @param string $charset Optional. The character set. Default null. 899 * @param string $collate Optional. The collation. Default null. 921 900 */ 922 901 public function set_charset( $dbh, $charset = null, $collate = null ) { … … 930 909 $set_charset_succeeded = true; 931 910 932 if ( $this->use_mysqli ) { 933 if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) { 934 $set_charset_succeeded = mysqli_set_charset( $dbh, $charset ); 911 if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) { 912 $set_charset_succeeded = mysqli_set_charset( $dbh, $charset ); 913 } 914 915 if ( $set_charset_succeeded ) { 916 $query = $this->prepare( 'SET NAMES %s', $charset ); 917 if ( ! empty( $collate ) ) { 918 $query .= $this->prepare( ' COLLATE %s', $collate ); 935 919 } 936 937 if ( $set_charset_succeeded ) { 938 $query = $this->prepare( 'SET NAMES %s', $charset ); 939 if ( ! empty( $collate ) ) { 940 $query .= $this->prepare( ' COLLATE %s', $collate ); 941 } 942 mysqli_query( $dbh, $query ); 943 } 944 } else { 945 if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset' ) ) { 946 $set_charset_succeeded = mysql_set_charset( $charset, $dbh ); 947 } 948 if ( $set_charset_succeeded ) { 949 $query = $this->prepare( 'SET NAMES %s', $charset ); 950 if ( ! empty( $collate ) ) { 951 $query .= $this->prepare( ' COLLATE %s', $collate ); 952 } 953 mysql_query( $query, $dbh ); 954 } 920 mysqli_query( $dbh, $query ); 955 921 } 956 922 } … … 968 934 public function set_sql_mode( $modes = array() ) { 969 935 if ( empty( $modes ) ) { 970 if ( $this->use_mysqli ) { 971 $res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' ); 972 } else { 973 $res = mysql_query( 'SELECT @@SESSION.sql_mode', $this->dbh ); 974 } 936 $res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' ); 975 937 976 938 if ( empty( $res ) ) { … … 978 940 } 979 941 980 if ( $this->use_mysqli ) { 981 $modes_array = mysqli_fetch_array( $res ); 982 if ( empty( $modes_array[0] ) ) { 983 return; 984 } 985 $modes_str = $modes_array[0]; 986 } else { 987 $modes_str = mysql_result( $res, 0 ); 988 } 942 $modes_array = mysqli_fetch_array( $res ); 943 944 if ( empty( $modes_array[0] ) ) { 945 return; 946 } 947 948 $modes_str = $modes_array[0]; 989 949 990 950 if ( empty( $modes_str ) ) { … … 1014 974 $modes_str = implode( ',', $modes ); 1015 975 1016 if ( $this->use_mysqli ) { 1017 mysqli_query( $this->dbh, "SET SESSION sql_mode='$modes_str'" ); 1018 } else { 1019 mysql_query( "SET SESSION sql_mode='$modes_str'", $this->dbh ); 1020 } 976 mysqli_query( $this->dbh, "SET SESSION sql_mode='$modes_str'" ); 1021 977 } 1022 978 … … 1221 1177 * @since 0.71 1222 1178 * 1223 * @param string 1224 * @param mysqli |resource$dbh Optional. Database connection.1225 * 1179 * @param string $db Database name. 1180 * @param mysqli $dbh Optional. Database connection. 1181 * Defaults to the current database handle. 1226 1182 */ 1227 1183 public function select( $db, $dbh = null ) { … … 1230 1186 } 1231 1187 1232 if ( $this->use_mysqli ) { 1233 $success = mysqli_select_db( $dbh, $db ); 1234 } else { 1235 $success = mysql_select_db( $db, $dbh ); 1236 } 1188 $success = mysqli_select_db( $dbh, $db ); 1189 1237 1190 if ( ! $success ) { 1238 1191 $this->ready = false; … … 1298 1251 1299 1252 /** 1300 * Real escape , using mysqli_real_escape_string() or mysql_real_escape_string().1253 * Real escape using mysqli_real_escape_string(). 1301 1254 * 1302 1255 * @since 2.8.0 1303 1256 * 1304 1257 * @see mysqli_real_escape_string() 1305 * @see mysql_real_escape_string()1306 1258 * 1307 1259 * @param string $data String to escape. … … 1314 1266 1315 1267 if ( $this->dbh ) { 1316 if ( $this->use_mysqli ) { 1317 $escaped = mysqli_real_escape_string( $this->dbh, $data ); 1318 } else { 1319 $escaped = mysql_real_escape_string( $data, $this->dbh ); 1320 } 1268 $escaped = mysqli_real_escape_string( $this->dbh, $data ); 1321 1269 } else { 1322 1270 $class = get_class( $this ); … … 1837 1785 1838 1786 if ( ! $str ) { 1839 if ( $this->use_mysqli ) { 1840 $str = mysqli_error( $this->dbh ); 1841 } else { 1842 $str = mysql_error( $this->dbh ); 1843 } 1844 } 1787 $str = mysqli_error( $this->dbh ); 1788 } 1789 1845 1790 $EZSQL_ERROR[] = array( 1846 1791 'query' => $this->last_query, … … 1964 1909 $this->last_error = ''; 1965 1910 1966 if ( $this-> use_mysqli && $this->result instanceof mysqli_result ) {1911 if ( $this->result instanceof mysqli_result ) { 1967 1912 mysqli_free_result( $this->result ); 1968 1913 $this->result = null; … … 1977 1922 mysqli_next_result( $this->dbh ); 1978 1923 } 1979 } elseif ( is_resource( $this->result ) ) {1980 mysql_free_result( $this->result );1981 1924 } 1982 1925 } … … 1996 1939 $this->is_mysql = true; 1997 1940 1941 $client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0; 1942 1998 1943 /* 1999 * Deprecated in 3.9+ when using MySQLi. No equivalent 2000 * $new_link parameter exists for mysqli_* functions. 1944 * Set the MySQLi error reporting off because WordPress handles its own. 1945 * This is due to the default value change from `MYSQLI_REPORT_OFF` 1946 * to `MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT` in PHP 8.1. 2001 1947 */ 2002 $new_link = defined( 'MYSQL_NEW_LINK' ) ? MYSQL_NEW_LINK : true; 2003 $client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0; 2004 2005 if ( $this->use_mysqli ) { 2006 /* 2007 * Set the MySQLi error reporting off because WordPress handles its own. 2008 * This is due to the default value change from `MYSQLI_REPORT_OFF` 2009 * to `MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT` in PHP 8.1. 2010 */ 2011 mysqli_report( MYSQLI_REPORT_OFF ); 2012 2013 $this->dbh = mysqli_init(); 2014 2015 $host = $this->dbhost; 2016 $port = null; 2017 $socket = null; 2018 $is_ipv6 = false; 2019 2020 $host_data = $this->parse_db_host( $this->dbhost ); 2021 if ( $host_data ) { 2022 list( $host, $port, $socket, $is_ipv6 ) = $host_data; 2023 } 2024 2025 /* 2026 * If using the `mysqlnd` library, the IPv6 address needs to be enclosed 2027 * in square brackets, whereas it doesn't while using the `libmysqlclient` library. 2028 * @see https://bugs.php.net/bug.php?id=67563 2029 */ 2030 if ( $is_ipv6 && extension_loaded( 'mysqlnd' ) ) { 2031 $host = "[$host]"; 2032 } 2033 2034 if ( WP_DEBUG ) { 2035 mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); 2036 } else { 2037 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 2038 @mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); 2039 } 2040 2041 if ( $this->dbh->connect_errno ) { 2042 $this->dbh = null; 2043 2044 /* 2045 * It's possible ext/mysqli is misconfigured. Fall back to ext/mysql if: 2046 * - We haven't previously connected, and 2047 * - WP_USE_EXT_MYSQL isn't set to false, and 2048 * - ext/mysql is loaded. 2049 */ 2050 $attempt_fallback = true; 2051 2052 if ( $this->has_connected ) { 2053 $attempt_fallback = false; 2054 } elseif ( defined( 'WP_USE_EXT_MYSQL' ) && ! WP_USE_EXT_MYSQL ) { 2055 $attempt_fallback = false; 2056 } elseif ( ! function_exists( 'mysql_connect' ) ) { 2057 $attempt_fallback = false; 2058 } 2059 2060 if ( $attempt_fallback ) { 2061 $this->use_mysqli = false; 2062 return $this->db_connect( $allow_bail ); 2063 } 2064 } 1948 mysqli_report( MYSQLI_REPORT_OFF ); 1949 1950 $this->dbh = mysqli_init(); 1951 1952 $host = $this->dbhost; 1953 $port = null; 1954 $socket = null; 1955 $is_ipv6 = false; 1956 1957 $host_data = $this->parse_db_host( $this->dbhost ); 1958 if ( $host_data ) { 1959 list( $host, $port, $socket, $is_ipv6 ) = $host_data; 1960 } 1961 1962 /* 1963 * If using the `mysqlnd` library, the IPv6 address needs to be enclosed 1964 * in square brackets, whereas it doesn't while using the `libmysqlclient` library. 1965 * @see https://bugs.php.net/bug.php?id=67563 1966 */ 1967 if ( $is_ipv6 && extension_loaded( 'mysqlnd' ) ) { 1968 $host = "[$host]"; 1969 } 1970 1971 if ( WP_DEBUG ) { 1972 mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); 2065 1973 } else { 2066 if ( WP_DEBUG ) {2067 $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );2068 } else {2069 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 2070 $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );2071 }1974 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1975 @mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); 1976 } 1977 1978 if ( $this->dbh->connect_errno ) { 1979 $this->dbh = null; 2072 1980 } 2073 1981 … … 2197 2105 */ 2198 2106 public function check_connection( $allow_bail = true ) { 2199 if ( $this->use_mysqli ) { 2200 if ( ! empty( $this->dbh ) && mysqli_ping( $this->dbh ) ) { 2201 return true; 2202 } 2203 } else { 2204 if ( ! empty( $this->dbh ) && mysql_ping( $this->dbh ) ) { 2205 return true; 2206 } 2107 if ( ! empty( $this->dbh ) && mysqli_ping( $this->dbh ) ) { 2108 return true; 2207 2109 } 2208 2110 … … 2348 2250 // Database server has gone away, try to reconnect. 2349 2251 $mysql_errno = 0; 2350 if ( ! empty( $this->dbh ) ) { 2351 if ( $this->use_mysqli ) { 2352 if ( $this->dbh instanceof mysqli ) { 2353 $mysql_errno = mysqli_errno( $this->dbh ); 2354 } else { 2355 /* 2356 * $dbh is defined, but isn't a real connection. 2357 * Something has gone horribly wrong, let's try a reconnect. 2358 */ 2359 $mysql_errno = 2006; 2360 } 2361 } else { 2362 if ( is_resource( $this->dbh ) ) { 2363 $mysql_errno = mysql_errno( $this->dbh ); 2364 } else { 2365 $mysql_errno = 2006; 2366 } 2367 } 2252 2253 if ( $this->dbh instanceof mysqli ) { 2254 $mysql_errno = mysqli_errno( $this->dbh ); 2255 } else { 2256 /* 2257 * $dbh is defined, but isn't a real connection. 2258 * Something has gone horribly wrong, let's try a reconnect. 2259 */ 2260 $mysql_errno = 2006; 2368 2261 } 2369 2262 … … 2378 2271 2379 2272 // If there is an error then take note of it. 2380 if ( $this->use_mysqli ) { 2381 if ( $this->dbh instanceof mysqli ) { 2382 $this->last_error = mysqli_error( $this->dbh ); 2383 } else { 2384 $this->last_error = __( 'Unable to retrieve the error message from MySQL' ); 2385 } 2273 if ( $this->dbh instanceof mysqli ) { 2274 $this->last_error = mysqli_error( $this->dbh ); 2386 2275 } else { 2387 if ( is_resource( $this->dbh ) ) { 2388 $this->last_error = mysql_error( $this->dbh ); 2389 } else { 2390 $this->last_error = __( 'Unable to retrieve the error message from MySQL' ); 2391 } 2276 $this->last_error = __( 'Unable to retrieve the error message from MySQL' ); 2392 2277 } 2393 2278 … … 2405 2290 $return_val = $this->result; 2406 2291 } elseif ( preg_match( '/^\s*(insert|delete|update|replace)\s/i', $query ) ) { 2407 if ( $this->use_mysqli ) { 2408 $this->rows_affected = mysqli_affected_rows( $this->dbh ); 2409 } else { 2410 $this->rows_affected = mysql_affected_rows( $this->dbh ); 2411 } 2292 $this->rows_affected = mysqli_affected_rows( $this->dbh ); 2293 2412 2294 // Take note of the insert_id. 2413 2295 if ( preg_match( '/^\s*(insert|replace)\s/i', $query ) ) { 2414 if ( $this->use_mysqli ) { 2415 $this->insert_id = mysqli_insert_id( $this->dbh ); 2416 } else { 2417 $this->insert_id = mysql_insert_id( $this->dbh ); 2418 } 2419 } 2296 $this->insert_id = mysqli_insert_id( $this->dbh ); 2297 } 2298 2420 2299 // Return number of rows affected. 2421 2300 $return_val = $this->rows_affected; 2422 2301 } else { 2423 2302 $num_rows = 0; 2424 if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { 2303 2304 if ( $this->result instanceof mysqli_result ) { 2425 2305 while ( $row = mysqli_fetch_object( $this->result ) ) { 2426 2306 $this->last_result[ $num_rows ] = $row; 2427 2307 $num_rows++; 2428 2308 } 2429 } elseif ( is_resource( $this->result ) ) {2430 while ( $row = mysql_fetch_object( $this->result ) ) {2431 $this->last_result[ $num_rows ] = $row;2432 $num_rows++;2433 }2434 2309 } 2435 2310 … … 2443 2318 2444 2319 /** 2445 * Internal function to perform the mysql _query() call.2320 * Internal function to perform the mysqli_query() call. 2446 2321 * 2447 2322 * @since 3.9.0 … … 2456 2331 } 2457 2332 2458 if ( ! empty( $this->dbh ) && $this->use_mysqli) {2333 if ( ! empty( $this->dbh ) ) { 2459 2334 $this->result = mysqli_query( $this->dbh, $query ); 2460 } elseif ( ! empty( $this->dbh ) ) { 2461 $this->result = mysql_query( $query, $this->dbh ); 2462 } 2335 } 2336 2463 2337 $this->num_queries++; 2464 2338 … … 3637 3511 $connection_charset = $this->charset; 3638 3512 } else { 3639 if ( $this->use_mysqli ) { 3640 $connection_charset = mysqli_character_set_name( $this->dbh ); 3641 } else { 3642 $connection_charset = mysql_client_encoding(); 3643 } 3513 $connection_charset = mysqli_character_set_name( $this->dbh ); 3644 3514 } 3645 3515 … … 3851 3721 } 3852 3722 3853 if ( $this->use_mysqli ) { 3854 $num_fields = mysqli_num_fields( $this->result ); 3855 for ( $i = 0; $i < $num_fields; $i++ ) { 3856 $this->col_info[ $i ] = mysqli_fetch_field( $this->result ); 3857 } 3858 } else { 3859 $num_fields = mysql_num_fields( $this->result ); 3860 for ( $i = 0; $i < $num_fields; $i++ ) { 3861 $this->col_info[ $i ] = mysql_fetch_field( $this->result, $i ); 3862 } 3723 $num_fields = mysqli_num_fields( $this->result ); 3724 3725 for ( $i = 0; $i < $num_fields; $i++ ) { 3726 $this->col_info[ $i ] = mysqli_fetch_field( $this->result ); 3863 3727 } 3864 3728 } … … 3933 3797 $error = ''; 3934 3798 3935 if ( $this->use_mysqli ) { 3936 if ( $this->dbh instanceof mysqli ) { 3937 $error = mysqli_error( $this->dbh ); 3938 } elseif ( mysqli_connect_errno() ) { 3939 $error = mysqli_connect_error(); 3940 } 3941 } else { 3942 if ( is_resource( $this->dbh ) ) { 3943 $error = mysql_error( $this->dbh ); 3944 } else { 3945 $error = mysql_error(); 3946 } 3799 if ( $this->dbh instanceof mysqli ) { 3800 $error = mysqli_error( $this->dbh ); 3801 } elseif ( mysqli_connect_errno() ) { 3802 $error = mysqli_connect_error(); 3947 3803 } 3948 3804 … … 3976 3832 } 3977 3833 3978 if ( $this->use_mysqli ) { 3979 $closed = mysqli_close( $this->dbh ); 3980 } else { 3981 $closed = mysql_close( $this->dbh ); 3982 } 3834 $closed = mysqli_close( $this->dbh ); 3983 3835 3984 3836 if ( $closed ) { … … 4099 3951 return false; 4100 3952 } 4101 if ( $this->use_mysqli ) { 4102 $client_version = mysqli_get_client_info(); 4103 } else { 4104 $client_version = mysql_get_client_info(); 4105 } 3953 3954 $client_version = mysqli_get_client_info(); 4106 3955 4107 3956 /* … … 4155 4004 4156 4005 /** 4157 * Ret rieves full database server information.4006 * Returns the version of the MySQL server. 4158 4007 * 4159 4008 * @since 5.5.0 4160 4009 * 4161 * @return string |false Server info on success, false on failure.4010 * @return string Server version as a string. 4162 4011 */ 4163 4012 public function db_server_info() { 4164 if ( $this->use_mysqli ) { 4165 $server_info = mysqli_get_server_info( $this->dbh ); 4166 } else { 4167 $server_info = mysql_get_server_info( $this->dbh ); 4168 } 4169 4170 return $server_info; 4013 return mysqli_get_server_info( $this->dbh ); 4171 4014 } 4172 4015 } -
trunk/src/wp-includes/load.php
r56249 r56475 135 135 136 136 /** 137 * Checks for the required PHP version, and the MySQLextension or137 * Checks for the required PHP version, and the mysqli extension or 138 138 * a database drop-in. 139 139 * … … 167 167 $wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content'; 168 168 169 if ( ! function_exists( 'mysqli_connect' ) && ! function_exists( 'mysql_connect' )169 if ( ! function_exists( 'mysqli_connect' ) 170 170 && ! file_exists( $wp_content_dir . '/db.php' ) 171 171 ) { -
trunk/tests/phpunit/includes/utils.php
r55028 r56475 557 557 global $wpdb; 558 558 $this->dbh = $wpdb->dbh; 559 $this->use_mysqli = $wpdb->use_mysqli;560 559 $this->is_mysql = $wpdb->is_mysql; 561 560 $this->ready = true; -
trunk/tests/phpunit/tests/db.php
r55562 r56475 714 714 public function test_mysqli_flush_sync() { 715 715 global $wpdb; 716 if ( ! $wpdb->use_mysqli ) {717 $this->markTestSkipped( 'mysqli not being used.' );718 }719 716 720 717 $suppress = $wpdb->suppress_errors( true );
Note: See TracChangeset
for help on using the changeset viewer.