Edit File by line
/home/barbar84/public_h.../wp-inclu...
File: wp-db.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WordPress database access abstraction class
[2] Fix | Delete
*
[3] Fix | Delete
* Original code from {@link http://php.justinvincent.com Justin Vincent (justin@visunet.ie)}
[4] Fix | Delete
*
[5] Fix | Delete
* @package WordPress
[6] Fix | Delete
* @subpackage Database
[7] Fix | Delete
* @since 0.71
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* @since 0.71
[12] Fix | Delete
*/
[13] Fix | Delete
define( 'EZSQL_VERSION', 'WP1.25' );
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* @since 0.71
[17] Fix | Delete
*/
[18] Fix | Delete
define( 'OBJECT', 'OBJECT' );
[19] Fix | Delete
// phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase
[20] Fix | Delete
define( 'object', 'OBJECT' ); // Back compat.
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* @since 2.5.0
[24] Fix | Delete
*/
[25] Fix | Delete
define( 'OBJECT_K', 'OBJECT_K' );
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* @since 0.71
[29] Fix | Delete
*/
[30] Fix | Delete
define( 'ARRAY_A', 'ARRAY_A' );
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* @since 0.71
[34] Fix | Delete
*/
[35] Fix | Delete
define( 'ARRAY_N', 'ARRAY_N' );
[36] Fix | Delete
[37] Fix | Delete
/**
[38] Fix | Delete
* WordPress database access abstraction class.
[39] Fix | Delete
*
[40] Fix | Delete
* This class is used to interact with a database without needing to use raw SQL statements.
[41] Fix | Delete
* By default, WordPress uses this class to instantiate the global $wpdb object, providing
[42] Fix | Delete
* access to the WordPress database.
[43] Fix | Delete
*
[44] Fix | Delete
* It is possible to replace this class with your own by setting the $wpdb global variable
[45] Fix | Delete
* in wp-content/db.php file to your class. The wpdb class will still be included, so you can
[46] Fix | Delete
* extend it or simply use your own.
[47] Fix | Delete
*
[48] Fix | Delete
* @link https://developer.wordpress.org/reference/classes/wpdb/
[49] Fix | Delete
*
[50] Fix | Delete
* @since 0.71
[51] Fix | Delete
*/
[52] Fix | Delete
class wpdb {
[53] Fix | Delete
[54] Fix | Delete
/**
[55] Fix | Delete
* Whether to show SQL/DB errors.
[56] Fix | Delete
*
[57] Fix | Delete
* Default is to show errors if both WP_DEBUG and WP_DEBUG_DISPLAY evaluate to true.
[58] Fix | Delete
*
[59] Fix | Delete
* @since 0.71
[60] Fix | Delete
* @var bool
[61] Fix | Delete
*/
[62] Fix | Delete
public $show_errors = false;
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* Whether to suppress errors during the DB bootstrapping. Default false.
[66] Fix | Delete
*
[67] Fix | Delete
* @since 2.5.0
[68] Fix | Delete
* @var bool
[69] Fix | Delete
*/
[70] Fix | Delete
public $suppress_errors = false;
[71] Fix | Delete
[72] Fix | Delete
/**
[73] Fix | Delete
* The error encountered during the last query.
[74] Fix | Delete
*
[75] Fix | Delete
* @since 2.5.0
[76] Fix | Delete
* @var string
[77] Fix | Delete
*/
[78] Fix | Delete
public $last_error = '';
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* The number of queries made.
[82] Fix | Delete
*
[83] Fix | Delete
* @since 1.2.0
[84] Fix | Delete
* @var int
[85] Fix | Delete
*/
[86] Fix | Delete
public $num_queries = 0;
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* Count of rows returned by the last query.
[90] Fix | Delete
*
[91] Fix | Delete
* @since 0.71
[92] Fix | Delete
* @var int
[93] Fix | Delete
*/
[94] Fix | Delete
public $num_rows = 0;
[95] Fix | Delete
[96] Fix | Delete
/**
[97] Fix | Delete
* Count of rows affected by the last query.
[98] Fix | Delete
*
[99] Fix | Delete
* @since 0.71
[100] Fix | Delete
* @var int
[101] Fix | Delete
*/
[102] Fix | Delete
public $rows_affected = 0;
[103] Fix | Delete
[104] Fix | Delete
/**
[105] Fix | Delete
* The ID generated for an AUTO_INCREMENT column by the last query (usually INSERT).
[106] Fix | Delete
*
[107] Fix | Delete
* @since 0.71
[108] Fix | Delete
* @var int
[109] Fix | Delete
*/
[110] Fix | Delete
public $insert_id = 0;
[111] Fix | Delete
[112] Fix | Delete
/**
[113] Fix | Delete
* The last query made.
[114] Fix | Delete
*
[115] Fix | Delete
* @since 0.71
[116] Fix | Delete
* @var string
[117] Fix | Delete
*/
[118] Fix | Delete
public $last_query;
[119] Fix | Delete
[120] Fix | Delete
/**
[121] Fix | Delete
* Results of the last query.
[122] Fix | Delete
*
[123] Fix | Delete
* @since 0.71
[124] Fix | Delete
* @var array|null
[125] Fix | Delete
*/
[126] Fix | Delete
public $last_result;
[127] Fix | Delete
[128] Fix | Delete
/**
[129] Fix | Delete
* MySQL result, which is either a resource or boolean.
[130] Fix | Delete
*
[131] Fix | Delete
* @since 0.71
[132] Fix | Delete
* @var mixed
[133] Fix | Delete
*/
[134] Fix | Delete
protected $result;
[135] Fix | Delete
[136] Fix | Delete
/**
[137] Fix | Delete
* Cached column info, for sanity checking data before inserting.
[138] Fix | Delete
*
[139] Fix | Delete
* @since 4.2.0
[140] Fix | Delete
* @var array
[141] Fix | Delete
*/
[142] Fix | Delete
protected $col_meta = array();
[143] Fix | Delete
[144] Fix | Delete
/**
[145] Fix | Delete
* Calculated character sets on tables.
[146] Fix | Delete
*
[147] Fix | Delete
* @since 4.2.0
[148] Fix | Delete
* @var array
[149] Fix | Delete
*/
[150] Fix | Delete
protected $table_charset = array();
[151] Fix | Delete
[152] Fix | Delete
/**
[153] Fix | Delete
* Whether text fields in the current query need to be sanity checked. Default false.
[154] Fix | Delete
*
[155] Fix | Delete
* @since 4.2.0
[156] Fix | Delete
* @var bool
[157] Fix | Delete
*/
[158] Fix | Delete
protected $check_current_query = true;
[159] Fix | Delete
[160] Fix | Delete
/**
[161] Fix | Delete
* Flag to ensure we don't run into recursion problems when checking the collation.
[162] Fix | Delete
*
[163] Fix | Delete
* @since 4.2.0
[164] Fix | Delete
* @see wpdb::check_safe_collation()
[165] Fix | Delete
* @var bool
[166] Fix | Delete
*/
[167] Fix | Delete
private $checking_collation = false;
[168] Fix | Delete
[169] Fix | Delete
/**
[170] Fix | Delete
* Saved info on the table column.
[171] Fix | Delete
*
[172] Fix | Delete
* @since 0.71
[173] Fix | Delete
* @var array
[174] Fix | Delete
*/
[175] Fix | Delete
protected $col_info;
[176] Fix | Delete
[177] Fix | Delete
/**
[178] Fix | Delete
* Log of queries that were executed, for debugging purposes.
[179] Fix | Delete
*
[180] Fix | Delete
* @since 1.5.0
[181] Fix | Delete
* @since 2.5.0 The third element in each query log was added to record the calling functions.
[182] Fix | Delete
* @since 5.1.0 The fourth element in each query log was added to record the start time.
[183] Fix | Delete
* @since 5.3.0 The fifth element in each query log was added to record custom data.
[184] Fix | Delete
*
[185] Fix | Delete
* @var array[] {
[186] Fix | Delete
* Array of queries that were executed.
[187] Fix | Delete
*
[188] Fix | Delete
* @type array ...$0 {
[189] Fix | Delete
* Data for each query.
[190] Fix | Delete
*
[191] Fix | Delete
* @type string $0 The query's SQL.
[192] Fix | Delete
* @type float $1 Total time spent on the query, in seconds.
[193] Fix | Delete
* @type string $2 Comma-separated list of the calling functions.
[194] Fix | Delete
* @type float $3 Unix timestamp of the time at the start of the query.
[195] Fix | Delete
* @type array $4 Custom query data.
[196] Fix | Delete
* }
[197] Fix | Delete
* }
[198] Fix | Delete
*/
[199] Fix | Delete
public $queries;
[200] Fix | Delete
[201] Fix | Delete
/**
[202] Fix | Delete
* The number of times to retry reconnecting before dying. Default 5.
[203] Fix | Delete
*
[204] Fix | Delete
* @since 3.9.0
[205] Fix | Delete
* @see wpdb::check_connection()
[206] Fix | Delete
* @var int
[207] Fix | Delete
*/
[208] Fix | Delete
protected $reconnect_retries = 5;
[209] Fix | Delete
[210] Fix | Delete
/**
[211] Fix | Delete
* WordPress table prefix
[212] Fix | Delete
*
[213] Fix | Delete
* You can set this to have multiple WordPress installations in a single database.
[214] Fix | Delete
* The second reason is for possible security precautions.
[215] Fix | Delete
*
[216] Fix | Delete
* @since 2.5.0
[217] Fix | Delete
* @var string
[218] Fix | Delete
*/
[219] Fix | Delete
public $prefix = '';
[220] Fix | Delete
[221] Fix | Delete
/**
[222] Fix | Delete
* WordPress base table prefix.
[223] Fix | Delete
*
[224] Fix | Delete
* @since 3.0.0
[225] Fix | Delete
* @var string
[226] Fix | Delete
*/
[227] Fix | Delete
public $base_prefix;
[228] Fix | Delete
[229] Fix | Delete
/**
[230] Fix | Delete
* Whether the database queries are ready to start executing.
[231] Fix | Delete
*
[232] Fix | Delete
* @since 2.3.2
[233] Fix | Delete
* @var bool
[234] Fix | Delete
*/
[235] Fix | Delete
public $ready = false;
[236] Fix | Delete
[237] Fix | Delete
/**
[238] Fix | Delete
* Blog ID.
[239] Fix | Delete
*
[240] Fix | Delete
* @since 3.0.0
[241] Fix | Delete
* @var int
[242] Fix | Delete
*/
[243] Fix | Delete
public $blogid = 0;
[244] Fix | Delete
[245] Fix | Delete
/**
[246] Fix | Delete
* Site ID.
[247] Fix | Delete
*
[248] Fix | Delete
* @since 3.0.0
[249] Fix | Delete
* @var int
[250] Fix | Delete
*/
[251] Fix | Delete
public $siteid = 0;
[252] Fix | Delete
[253] Fix | Delete
/**
[254] Fix | Delete
* List of WordPress per-blog tables.
[255] Fix | Delete
*
[256] Fix | Delete
* @since 2.5.0
[257] Fix | Delete
* @see wpdb::tables()
[258] Fix | Delete
* @var array
[259] Fix | Delete
*/
[260] Fix | Delete
public $tables = array(
[261] Fix | Delete
'posts',
[262] Fix | Delete
'comments',
[263] Fix | Delete
'links',
[264] Fix | Delete
'options',
[265] Fix | Delete
'postmeta',
[266] Fix | Delete
'terms',
[267] Fix | Delete
'term_taxonomy',
[268] Fix | Delete
'term_relationships',
[269] Fix | Delete
'termmeta',
[270] Fix | Delete
'commentmeta',
[271] Fix | Delete
);
[272] Fix | Delete
[273] Fix | Delete
/**
[274] Fix | Delete
* List of deprecated WordPress tables.
[275] Fix | Delete
*
[276] Fix | Delete
* 'categories', 'post2cat', and 'link2cat' were deprecated in 2.3.0, db version 5539.
[277] Fix | Delete
*
[278] Fix | Delete
* @since 2.9.0
[279] Fix | Delete
* @see wpdb::tables()
[280] Fix | Delete
* @var array
[281] Fix | Delete
*/
[282] Fix | Delete
public $old_tables = array( 'categories', 'post2cat', 'link2cat' );
[283] Fix | Delete
[284] Fix | Delete
/**
[285] Fix | Delete
* List of WordPress global tables.
[286] Fix | Delete
*
[287] Fix | Delete
* @since 3.0.0
[288] Fix | Delete
* @see wpdb::tables()
[289] Fix | Delete
* @var array
[290] Fix | Delete
*/
[291] Fix | Delete
public $global_tables = array( 'users', 'usermeta' );
[292] Fix | Delete
[293] Fix | Delete
/**
[294] Fix | Delete
* List of Multisite global tables.
[295] Fix | Delete
*
[296] Fix | Delete
* @since 3.0.0
[297] Fix | Delete
* @see wpdb::tables()
[298] Fix | Delete
* @var array
[299] Fix | Delete
*/
[300] Fix | Delete
public $ms_global_tables = array(
[301] Fix | Delete
'blogs',
[302] Fix | Delete
'blogmeta',
[303] Fix | Delete
'signups',
[304] Fix | Delete
'site',
[305] Fix | Delete
'sitemeta',
[306] Fix | Delete
'sitecategories',
[307] Fix | Delete
'registration_log',
[308] Fix | Delete
);
[309] Fix | Delete
[310] Fix | Delete
/**
[311] Fix | Delete
* WordPress Comments table.
[312] Fix | Delete
*
[313] Fix | Delete
* @since 1.5.0
[314] Fix | Delete
* @var string
[315] Fix | Delete
*/
[316] Fix | Delete
public $comments;
[317] Fix | Delete
[318] Fix | Delete
/**
[319] Fix | Delete
* WordPress Comment Metadata table.
[320] Fix | Delete
*
[321] Fix | Delete
* @since 2.9.0
[322] Fix | Delete
* @var string
[323] Fix | Delete
*/
[324] Fix | Delete
public $commentmeta;
[325] Fix | Delete
[326] Fix | Delete
/**
[327] Fix | Delete
* WordPress Links table.
[328] Fix | Delete
*
[329] Fix | Delete
* @since 1.5.0
[330] Fix | Delete
* @var string
[331] Fix | Delete
*/
[332] Fix | Delete
public $links;
[333] Fix | Delete
[334] Fix | Delete
/**
[335] Fix | Delete
* WordPress Options table.
[336] Fix | Delete
*
[337] Fix | Delete
* @since 1.5.0
[338] Fix | Delete
* @var string
[339] Fix | Delete
*/
[340] Fix | Delete
public $options;
[341] Fix | Delete
[342] Fix | Delete
/**
[343] Fix | Delete
* WordPress Post Metadata table.
[344] Fix | Delete
*
[345] Fix | Delete
* @since 1.5.0
[346] Fix | Delete
* @var string
[347] Fix | Delete
*/
[348] Fix | Delete
public $postmeta;
[349] Fix | Delete
[350] Fix | Delete
/**
[351] Fix | Delete
* WordPress Posts table.
[352] Fix | Delete
*
[353] Fix | Delete
* @since 1.5.0
[354] Fix | Delete
* @var string
[355] Fix | Delete
*/
[356] Fix | Delete
public $posts;
[357] Fix | Delete
[358] Fix | Delete
/**
[359] Fix | Delete
* WordPress Terms table.
[360] Fix | Delete
*
[361] Fix | Delete
* @since 2.3.0
[362] Fix | Delete
* @var string
[363] Fix | Delete
*/
[364] Fix | Delete
public $terms;
[365] Fix | Delete
[366] Fix | Delete
/**
[367] Fix | Delete
* WordPress Term Relationships table.
[368] Fix | Delete
*
[369] Fix | Delete
* @since 2.3.0
[370] Fix | Delete
* @var string
[371] Fix | Delete
*/
[372] Fix | Delete
public $term_relationships;
[373] Fix | Delete
[374] Fix | Delete
/**
[375] Fix | Delete
* WordPress Term Taxonomy table.
[376] Fix | Delete
*
[377] Fix | Delete
* @since 2.3.0
[378] Fix | Delete
* @var string
[379] Fix | Delete
*/
[380] Fix | Delete
public $term_taxonomy;
[381] Fix | Delete
[382] Fix | Delete
/**
[383] Fix | Delete
* WordPress Term Meta table.
[384] Fix | Delete
*
[385] Fix | Delete
* @since 4.4.0
[386] Fix | Delete
* @var string
[387] Fix | Delete
*/
[388] Fix | Delete
public $termmeta;
[389] Fix | Delete
[390] Fix | Delete
//
[391] Fix | Delete
// Global and Multisite tables
[392] Fix | Delete
//
[393] Fix | Delete
[394] Fix | Delete
/**
[395] Fix | Delete
* WordPress User Metadata table.
[396] Fix | Delete
*
[397] Fix | Delete
* @since 2.3.0
[398] Fix | Delete
* @var string
[399] Fix | Delete
*/
[400] Fix | Delete
public $usermeta;
[401] Fix | Delete
[402] Fix | Delete
/**
[403] Fix | Delete
* WordPress Users table.
[404] Fix | Delete
*
[405] Fix | Delete
* @since 1.5.0
[406] Fix | Delete
* @var string
[407] Fix | Delete
*/
[408] Fix | Delete
public $users;
[409] Fix | Delete
[410] Fix | Delete
/**
[411] Fix | Delete
* Multisite Blogs table.
[412] Fix | Delete
*
[413] Fix | Delete
* @since 3.0.0
[414] Fix | Delete
* @var string
[415] Fix | Delete
*/
[416] Fix | Delete
public $blogs;
[417] Fix | Delete
[418] Fix | Delete
/**
[419] Fix | Delete
* Multisite Blog Metadata table.
[420] Fix | Delete
*
[421] Fix | Delete
* @since 5.1.0
[422] Fix | Delete
* @var string
[423] Fix | Delete
*/
[424] Fix | Delete
public $blogmeta;
[425] Fix | Delete
[426] Fix | Delete
/**
[427] Fix | Delete
* Multisite Registration Log table.
[428] Fix | Delete
*
[429] Fix | Delete
* @since 3.0.0
[430] Fix | Delete
* @var string
[431] Fix | Delete
*/
[432] Fix | Delete
public $registration_log;
[433] Fix | Delete
[434] Fix | Delete
/**
[435] Fix | Delete
* Multisite Signups table.
[436] Fix | Delete
*
[437] Fix | Delete
* @since 3.0.0
[438] Fix | Delete
* @var string
[439] Fix | Delete
*/
[440] Fix | Delete
public $signups;
[441] Fix | Delete
[442] Fix | Delete
/**
[443] Fix | Delete
* Multisite Sites table.
[444] Fix | Delete
*
[445] Fix | Delete
* @since 3.0.0
[446] Fix | Delete
* @var string
[447] Fix | Delete
*/
[448] Fix | Delete
public $site;
[449] Fix | Delete
[450] Fix | Delete
/**
[451] Fix | Delete
* Multisite Sitewide Terms table.
[452] Fix | Delete
*
[453] Fix | Delete
* @since 3.0.0
[454] Fix | Delete
* @var string
[455] Fix | Delete
*/
[456] Fix | Delete
public $sitecategories;
[457] Fix | Delete
[458] Fix | Delete
/**
[459] Fix | Delete
* Multisite Site Metadata table.
[460] Fix | Delete
*
[461] Fix | Delete
* @since 3.0.0
[462] Fix | Delete
* @var string
[463] Fix | Delete
*/
[464] Fix | Delete
public $sitemeta;
[465] Fix | Delete
[466] Fix | Delete
/**
[467] Fix | Delete
* Format specifiers for DB columns.
[468] Fix | Delete
*
[469] Fix | Delete
* Columns not listed here default to %s. Initialized during WP load.
[470] Fix | Delete
* Keys are column names, values are format types: 'ID' => '%d'.
[471] Fix | Delete
*
[472] Fix | Delete
* @since 2.8.0
[473] Fix | Delete
* @see wpdb::prepare()
[474] Fix | Delete
* @see wpdb::insert()
[475] Fix | Delete
* @see wpdb::update()
[476] Fix | Delete
* @see wpdb::delete()
[477] Fix | Delete
* @see wp_set_wpdb_vars()
[478] Fix | Delete
* @var array
[479] Fix | Delete
*/
[480] Fix | Delete
public $field_types = array();
[481] Fix | Delete
[482] Fix | Delete
/**
[483] Fix | Delete
* Database table columns charset.
[484] Fix | Delete
*
[485] Fix | Delete
* @since 2.2.0
[486] Fix | Delete
* @var string
[487] Fix | Delete
*/
[488] Fix | Delete
public $charset;
[489] Fix | Delete
[490] Fix | Delete
/**
[491] Fix | Delete
* Database table columns collate.
[492] Fix | Delete
*
[493] Fix | Delete
* @since 2.2.0
[494] Fix | Delete
* @var string
[495] Fix | Delete
*/
[496] Fix | Delete
public $collate;
[497] Fix | Delete
[498] Fix | Delete
/**
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function