| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* bbPress Converter Database |
| 5 |
* |
| 6 |
* @package bbPress |
| 7 |
* @subpackage Administration |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly |
| 11 |
defined( 'ABSPATH' ) || exit; |
| 12 |
|
| 13 |
if ( ! class_exists( 'BBP_Converter_DB' ) && class_exists( 'wpdb' ) ) : |
| 14 |
/** |
| 15 |
* bbPress Converter Database Access Abstraction Object |
| 16 |
* |
| 17 |
* @since 2.6.0 bbPress (r6784) |
| 18 |
*/ |
| 19 |
class BBP_Converter_DB extends wpdb { |
| 20 |
|
| 21 |
/** |
| 22 |
* Sets up the credentials used to connect to the database server, but does |
| 23 |
* not actually connect to the database on construct. |
| 24 |
* |
| 25 |
* @since 2.6.0 bbPress (r6784) |
| 26 |
* |
| 27 |
* @param string $dbuser MySQL database user |
| 28 |
* @param string $dbpassword MySQL database password |
| 29 |
* @param string $dbname MySQL database name |
| 30 |
* @param string $dbhost MySQL database host |
| 31 |
*/ |
| 32 |
public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { |
| 33 |
|
| 34 |
if ( WP_DEBUG && WP_DEBUG_DISPLAY ) { |
| 35 |
$this->show_errors(); |
| 36 |
} |
| 37 |
|
| 38 |
// Use ext/mysqli if it exists unless WP_USE_EXT_MYSQL is defined as true |
| 39 |
if ( function_exists( 'mysqli_connect' ) ) { |
| 40 |
$this->use_mysqli = true; |
| 41 |
|
| 42 |
if ( defined( 'WP_USE_EXT_MYSQL' ) ) { |
| 43 |
$this->use_mysqli = ! WP_USE_EXT_MYSQL; |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
// Setup credentials |
| 48 |
$this->dbuser = $dbuser; |
| 49 |
$this->dbpassword = $dbpassword; |
| 50 |
$this->dbname = $dbname; |
| 51 |
$this->dbhost = $dbhost; |
| 52 |
|
| 53 |
// Normally wpdb would try to connect here, but we don't want to do that |
| 54 |
// until we are good and ready, so instead we do nothing. |
| 55 |
} |
| 56 |
} |
| 57 |
endif; |
| 58 |
|