Changeset 28526 for trunk/src/wp-includes/wp-db.php
- Timestamp:
- 05/19/2014 03:35:29 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/wp-db.php
r28339 r28526 79 79 * @var string 80 80 */ 81 var$last_error = '';81 public $last_error = ''; 82 82 83 83 /** … … 210 210 * @var int 211 211 */ 212 var$blogid = 0;212 public $blogid = 0; 213 213 214 214 /** … … 219 219 * @var int 220 220 */ 221 var$siteid = 0;221 public $siteid = 0; 222 222 223 223 /** … … 272 272 * @var string 273 273 */ 274 var$comments;274 public $comments; 275 275 276 276 /** … … 281 281 * @var string 282 282 */ 283 var$commentmeta;283 public $commentmeta; 284 284 285 285 /** … … 290 290 * @var string 291 291 */ 292 var$links;292 public $links; 293 293 294 294 /** … … 299 299 * @var string 300 300 */ 301 var$options;301 public $options; 302 302 303 303 /** … … 308 308 * @var string 309 309 */ 310 var$postmeta;310 public $postmeta; 311 311 312 312 /** … … 317 317 * @var string 318 318 */ 319 var$posts;319 public $posts; 320 320 321 321 /** … … 326 326 * @var string 327 327 */ 328 var$terms;328 public $terms; 329 329 330 330 /** … … 335 335 * @var string 336 336 */ 337 var$term_relationships;337 public $term_relationships; 338 338 339 339 /** … … 344 344 * @var string 345 345 */ 346 var$term_taxonomy;346 public $term_taxonomy; 347 347 348 348 /* … … 357 357 * @var string 358 358 */ 359 var$usermeta;359 public $usermeta; 360 360 361 361 /** … … 366 366 * @var string 367 367 */ 368 var$users;368 public $users; 369 369 370 370 /** … … 375 375 * @var string 376 376 */ 377 var$blogs;377 public $blogs; 378 378 379 379 /** … … 384 384 * @var string 385 385 */ 386 var$blog_versions;386 public $blog_versions; 387 387 388 388 /** … … 393 393 * @var string 394 394 */ 395 var$registration_log;395 public $registration_log; 396 396 397 397 /** … … 402 402 * @var string 403 403 */ 404 var$signups;404 public $signups; 405 405 406 406 /** … … 411 411 * @var string 412 412 */ 413 var$site;413 public $site; 414 414 415 415 /** … … 420 420 * @var string 421 421 */ 422 var$sitecategories;422 public $sitecategories; 423 423 424 424 /** … … 429 429 * @var string 430 430 */ 431 var$sitemeta;431 public $sitemeta; 432 432 433 433 /** … … 445 445 * @var array 446 446 */ 447 var$field_types = array();447 public $field_types = array(); 448 448 449 449 /** … … 454 454 * @var string 455 455 */ 456 var$charset;456 public $charset; 457 457 458 458 /** … … 463 463 * @var string 464 464 */ 465 var$collate;465 public $collate; 466 466 467 467 /** … … 517 517 * @var string 518 518 */ 519 var$func_call;519 public $func_call; 520 520 521 521 /** … … 576 576 * @param string $dbhost MySQL database host 577 577 */ 578 function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {578 public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { 579 579 register_shutdown_function( array( $this, '__destruct' ) ); 580 580 … … 615 615 * @return bool true 616 616 */ 617 function __destruct() {617 public function __destruct() { 618 618 return true; 619 619 } … … 627 627 * @return mixed The private member 628 628 */ 629 function __get( $name ) {629 public function __get( $name ) { 630 630 if ( 'col_info' == $name ) 631 631 $this->load_col_info(); … … 642 642 * @param mixed $value The value to set 643 643 */ 644 function __set( $name, $value ) {644 public function __set( $name, $value ) { 645 645 $this->$name = $value; 646 646 } … … 655 655 * @return bool If the member is set or not 656 656 */ 657 function __isset( $name ) {657 public function __isset( $name ) { 658 658 return isset( $this->$name ); 659 659 } … … 666 666 * @param string $name The private member to unset 667 667 */ 668 function __unset( $name ) {668 public function __unset( $name ) { 669 669 unset( $this->$name ); 670 670 } … … 675 675 * @since 3.1.0 676 676 */ 677 function init_charset() {677 public function init_charset() { 678 678 if ( function_exists('is_multisite') && is_multisite() ) { 679 679 $this->charset = 'utf8'; … … 699 699 * @param string $collate The collation (optional) 700 700 */ 701 function set_charset( $dbh, $charset = null, $collate = null ) {701 public function set_charset( $dbh, $charset = null, $collate = null ) { 702 702 if ( ! isset( $charset ) ) 703 703 $charset = $this->charset; … … 737 737 * @param array $modes Optional. A list of SQL modes to set. 738 738 */ 739 function set_sql_mode( $modes = array() ) {739 public function set_sql_mode( $modes = array() ) { 740 740 if ( empty( $modes ) ) { 741 741 if ( $this->use_mysqli ) { … … 803 803 * @return string|WP_Error Old prefix or WP_Error on error 804 804 */ 805 function set_prefix( $prefix, $set_table_names = true ) {805 public function set_prefix( $prefix, $set_table_names = true ) { 806 806 807 807 if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) … … 842 842 * @return string previous blog id 843 843 */ 844 function set_blog_id( $blog_id, $site_id = 0 ) {844 public function set_blog_id( $blog_id, $site_id = 0 ) { 845 845 if ( ! empty( $site_id ) ) 846 846 $this->siteid = $site_id; … … 868 868 * @return string Blog prefix. 869 869 */ 870 function get_blog_prefix( $blog_id = null ) {870 public function get_blog_prefix( $blog_id = null ) { 871 871 if ( is_multisite() ) { 872 872 if ( null === $blog_id ) … … 910 910 * @return array Table names. When a prefix is requested, the key is the unprefixed table name. 911 911 */ 912 function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {912 public function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) { 913 913 switch ( $scope ) { 914 914 case 'all' : … … 971 971 * @return null Always null. 972 972 */ 973 function select( $db, $dbh = null ) {973 public function select( $db, $dbh = null ) { 974 974 if ( is_null($dbh) ) 975 975 $dbh = $this->dbh; … … 1080 1080 * @return mixed 1081 1081 */ 1082 function escape( $data ) {1082 public function escape( $data ) { 1083 1083 if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) ) 1084 1084 _deprecated_function( __METHOD__, '3.6', 'wpdb::prepare() or esc_sql()' ); … … 1105 1105 * @return void 1106 1106 */ 1107 function escape_by_ref( &$string ) {1107 public function escape_by_ref( &$string ) { 1108 1108 if ( ! is_float( $string ) ) 1109 1109 $string = $this->_real_escape( $string ); … … 1147 1147 * if there was something to prepare 1148 1148 */ 1149 function prepare( $query, $args ) {1149 public function prepare( $query, $args ) { 1150 1150 if ( is_null( $query ) ) 1151 1151 return; … … 1178 1178 * @return bool False if the showing of errors is disabled. 1179 1179 */ 1180 function print_error( $str = '' ) {1180 public function print_error( $str = '' ) { 1181 1181 global $EZSQL_ERROR; 1182 1182 … … 1238 1238 * @return bool Old value for showing errors. 1239 1239 */ 1240 function show_errors( $show = true ) {1240 public function show_errors( $show = true ) { 1241 1241 $errors = $this->show_errors; 1242 1242 $this->show_errors = $show; … … 1254 1254 * @return bool Whether showing of errors was active 1255 1255 */ 1256 function hide_errors() {1256 public function hide_errors() { 1257 1257 $show = $this->show_errors; 1258 1258 $this->show_errors = false; … … 1271 1271 * @return bool Old value 1272 1272 */ 1273 function suppress_errors( $suppress = true ) {1273 public function suppress_errors( $suppress = true ) { 1274 1274 $errors = $this->suppress_errors; 1275 1275 $this->suppress_errors = (bool) $suppress; … … 1283 1283 * @return void 1284 1284 */ 1285 function flush() {1285 public function flush() { 1286 1286 $this->last_result = array(); 1287 1287 $this->col_info = null; … … 1311 1311 * @return bool True with a successful connection, false on failure. 1312 1312 */ 1313 function db_connect( $allow_bail = true ) {1313 public function db_connect( $allow_bail = true ) { 1314 1314 1315 1315 $this->is_mysql = true; … … 1426 1426 * @return bool True if the connection is up. 1427 1427 */ 1428 function check_connection( $allow_bail = true ) {1428 public function check_connection( $allow_bail = true ) { 1429 1429 if ( $this->use_mysqli ) { 1430 1430 if ( @mysqli_ping( $this->dbh ) ) { … … 1498 1498 * @return int|false Number of rows affected/selected or false on error 1499 1499 */ 1500 function query( $query ) {1500 public function query( $query ) { 1501 1501 if ( ! $this->ready ) 1502 1502 return false; … … 1646 1646 * @return int|false The number of rows inserted, or false on error. 1647 1647 */ 1648 function insert( $table, $data, $format = null ) {1648 public function insert( $table, $data, $format = null ) { 1649 1649 return $this->_insert_replace_helper( $table, $data, $format, 'INSERT' ); 1650 1650 } … … 1669 1669 * @return int|false The number of rows affected, or false on error. 1670 1670 */ 1671 function replace( $table, $data, $format = null ) {1671 public function replace( $table, $data, $format = null ) { 1672 1672 return $this->_insert_replace_helper( $table, $data, $format, 'REPLACE' ); 1673 1673 } … … 1732 1732 * @return int|false The number of rows updated, or false on error. 1733 1733 */ 1734 function update( $table, $data, $where, $format = null, $where_format = null ) {1734 public function update( $table, $data, $where, $format = null, $where_format = null ) { 1735 1735 if ( ! is_array( $data ) || ! is_array( $where ) ) 1736 1736 return false; … … 1781 1781 * @return int|false The number of rows updated, or false on error. 1782 1782 */ 1783 function delete( $table, $where, $where_format = null ) {1783 public function delete( $table, $where, $where_format = null ) { 1784 1784 if ( ! is_array( $where ) ) 1785 1785 return false; … … 1820 1820 * @return string|null Database query result (as string), or null on failure 1821 1821 */ 1822 function get_var( $query = null, $x = 0, $y = 0 ) {1822 public function get_var( $query = null, $x = 0, $y = 0 ) { 1823 1823 $this->func_call = "\$db->get_var(\"$query\", $x, $y)"; 1824 1824 if ( $query ) … … 1847 1847 * @return mixed Database query result in format specified by $output or null on failure 1848 1848 */ 1849 function get_row( $query = null, $output = OBJECT, $y = 0 ) {1849 public function get_row( $query = null, $output = OBJECT, $y = 0 ) { 1850 1850 $this->func_call = "\$db->get_row(\"$query\",$output,$y)"; 1851 1851 if ( $query ) … … 1884 1884 * @return array Database query result. Array indexed from 0 by SQL result row number. 1885 1885 */ 1886 function get_col( $query = null , $x = 0 ) {1886 public function get_col( $query = null , $x = 0 ) { 1887 1887 if ( $query ) 1888 1888 $this->query( $query ); … … 1909 1909 * @return mixed Database query results 1910 1910 */ 1911 function get_results( $query = null, $output = OBJECT ) {1911 public function get_results( $query = null, $output = OBJECT ) { 1912 1912 $this->func_call = "\$db->get_results(\"$query\", $output)"; 1913 1913 … … 1983 1983 * @return mixed Column Results 1984 1984 */ 1985 function get_col_info( $info_type = 'name', $col_offset = -1 ) {1985 public function get_col_info( $info_type = 'name', $col_offset = -1 ) { 1986 1986 $this->load_col_info(); 1987 1987 … … 2008 2008 * @return true 2009 2009 */ 2010 function timer_start() {2010 public function timer_start() { 2011 2011 $this->time_start = microtime( true ); 2012 2012 return true; … … 2020 2020 * @return float Total time spent on the query, in seconds 2021 2021 */ 2022 function timer_stop() {2022 public function timer_stop() { 2023 2023 return ( microtime( true ) - $this->time_start ); 2024 2024 } … … 2035 2035 * @return false|void 2036 2036 */ 2037 function bail( $message, $error_code = '500' ) {2037 public function bail( $message, $error_code = '500' ) { 2038 2038 if ( !$this->show_errors ) { 2039 2039 if ( class_exists( 'WP_Error' ) ) … … 2055 2055 * @return WP_Error 2056 2056 */ 2057 function check_database_version() {2057 public function check_database_version() { 2058 2058 global $wp_version, $required_mysql_version; 2059 2059 // Make sure the server has the required MySQL version … … 2073 2073 * @return bool True if collation is supported, false if version does not 2074 2074 */ 2075 function supports_collation() {2075 public function supports_collation() { 2076 2076 _deprecated_function( __FUNCTION__, '3.5', 'wpdb::has_cap( \'collation\' )' ); 2077 2077 return $this->has_cap( 'collation' ); … … 2105 2105 * @return bool 2106 2106 */ 2107 function has_cap( $db_cap ) {2107 public function has_cap( $db_cap ) { 2108 2108 $version = $this->db_version(); 2109 2109 … … 2130 2130 * @return string The name of the calling function 2131 2131 */ 2132 function get_caller() {2132 public function get_caller() { 2133 2133 return wp_debug_backtrace_summary( __CLASS__ ); 2134 2134 } … … 2141 2141 * @return false|string false on failure, version number on success 2142 2142 */ 2143 function db_version() {2143 public function db_version() { 2144 2144 if ( $this->use_mysqli ) { 2145 2145 $server_info = mysqli_get_server_info( $this->dbh );
Note: See TracChangeset
for help on using the changeset viewer.