Changeset 1543
- Timestamp:
- 08/20/2004 05:52:49 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/wp-db.php
r1475 r1543 10 10 define('ARRAY_A', 'ARRAY_A', false); 11 11 define('ARRAY_N', 'ARRAY_N', false); 12 12 13 if (!defined('SAVEQUERIES')) 13 14 define('SAVEQUERIES', false); … … 19 20 var $last_query; 20 21 var $col_info; 22 var $queries; 21 23 22 24 // Our tables … … 39 41 40 42 function wpdb($dbuser, $dbpassword, $dbname, $dbhost) { 41 $this->dbh = @mysql_connect($dbhost, $dbuser,$dbpassword);43 $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword); 42 44 if (!$this->dbh) { 43 45 $this->bail(" … … 60 62 61 63 function select($db) { 62 if (!@mysql_select_db($db, $this->dbh)) {64 if (!@mysql_select_db($db, $this->dbh)) { 63 65 $this->bail(" 64 66 <h1>Can’t select database</h1> … … 135 137 136 138 // Perform the query via std mysql_query function.. 137 $this->result = @mysql_query($query,$this->dbh); 139 if (SAVEQUERIES) 140 $this->timer_start(); 141 142 $this->result = @mysql_query($query, $this->dbh); 138 143 ++$this->num_queries; 139 if (SAVEQUERIES) { 140 $this->savedqueries[] = $query;141 }144 145 if (SAVEQUERIES) 146 $this->queries[] = array( $query, $this->timer_stop() ); 142 147 143 148 // If there is an error then take note of it.. … … 279 284 } 280 285 286 function timer_start() { 287 $mtime = microtime(); 288 $mtime = explode(' ', $mtime); 289 $this->time_start = $mtime[1] + $mtime[0]; 290 return true; 291 } 292 293 function timer_stop($precision = 3) { 294 $mtime = microtime(); 295 $mtime = explode(' ', $mtime); 296 $time_end = $mtime[1] + $mtime[0]; 297 $time_total = $time_end - $this->time_start; 298 return $timetotal; 299 } 300 281 301 function bail($message) { // Just wraps errors in a nice header and footer 282 echo <<<HEAD 283 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 284 <html xmlns="http://www.w3.org/1999/xhtml"> 285 <head> 286 <title>WordPress › Installation</title> 287 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 288 <style media="screen" type="text/css"> 289 <!-- 290 html { 291 background: #eee; 292 } 293 body { 294 background: #fff; 295 color: #000; 296 font-family: Georgia, "Times New Roman", Times, serif; 297 margin-left: 25%; 298 margin-right: 25%; 299 padding: .2em 2em; 300 } 302 if ( !$this->show_errors ) 303 return false; 304 echo <<<HEAD 305 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 306 <html xmlns="http://www.w3.org/1999/xhtml"> 307 <head> 308 <title>WordPress › Error</title> 309 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 310 <style media="screen" type="text/css"> 311 <!-- 312 html { 313 background: #eee; 314 } 315 body { 316 background: #fff; 317 color: #000; 318 font-family: Georgia, "Times New Roman", Times, serif; 319 margin-left: 25%; 320 margin-right: 25%; 321 padding: .2em 2em; 322 } 323 324 h1 { 325 color: #006; 326 font-size: 18px; 327 font-weight: lighter; 328 } 329 330 h2 { 331 font-size: 16px; 332 } 333 334 p, li, dt { 335 line-height: 140%; 336 padding-bottom: 2px; 337 } 301 338 302 h1 { 303 color: #006; 304 font-size: 18px; 305 font-weight: lighter; 306 } 307 308 h2 { 309 font-size: 16px; 310 } 311 312 p, li, dt { 313 line-height: 140%; 314 padding-bottom: 2px; 315 } 316 317 ul, ol { 318 padding: 5px 5px 5px 20px; 319 } 320 #logo { 321 margin-bottom: 2em; 322 } 323 --> 324 </style> 325 </head> 326 <body> 327 <h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1> 339 ul, ol { 340 padding: 5px 5px 5px 20px; 341 } 342 #logo { 343 margin-bottom: 2em; 344 } 345 --> 346 </style> 347 </head> 348 <body> 349 <h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1> 328 350 HEAD; 329 echo $message;330 echo "</body></html>";331 die();351 echo $message; 352 echo "</body></html>"; 353 die(); 332 354 } 333 355 } 334 356 335 357 $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); 336 337 358 ?>
Note: See TracChangeset
for help on using the changeset viewer.