Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class dd32_wpdb_ssl extends wpdb {
- /**
- * Connect to and select database
- * This is a COPY of the WordPress function as of r19773
- * Alteration: Adds the MySQL SSL arg.
- */
- function db_connect() {
- $this->is_mysql = true;
- if ( WP_DEBUG ) {
- $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true, MYSQL_CLIENT_SSL );
- } else {
- $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true, MYSQL_CLIENT_SSL );
- }
- if ( !$this->dbh ) {
- if ( ! function_exists( 'wp_load_translations_early' ) ) // only 3.4+ gets the wonderful error messages, everyone else, you just die
- die( 'Error establishing database connection. Goodbye.' );
- $this->bail( sprintf( __( "
- <h1>Error establishing a database connection</h1>
- <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
- <ul>
- <li>Are you sure you have the correct username and password?</li>
- <li>Are you sure that you have typed the correct hostname?</li>
- <li>Are you sure that the database server is running?</li>
- </ul>
- <p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
- " ), $this->dbhost ), 'db_connect_fail' );
- return;
- }
- $this->set_charset( $this->dbh );
- $this->ready = true;
- $this->select( $this->dbname, $this->dbh );
- }
- }
- $wpdb = new dd32_wpdb_ssl( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement