WordPress.org

Make WordPress Core

Ticket #31018: 31018.diff

File 31018.diff, 845 bytes (added by blobaugh, 5 years ago)

Adds support for persistent database connections

  • wp-includes/default-constants.php

    diff --git wp-includes/default-constants.php wp-includes/default-constants.php
    index ae97efd..b22e24c 100644
    function wp_initial_constants() { 
    7171        if ( !defined('WP_CACHE') )
    7272                define('WP_CACHE', false);
    7373
     74        // Persistent database connections
     75        if( !defined( 'DB_PERSISTENT' ) ) {
     76                define( 'DB_PERSISTENT', false );
     77        }
     78
    7479        /**
    7580         * Private
    7681         */
  • wp-includes/wp-db.php

    diff --git wp-includes/wp-db.php wp-includes/wp-db.php
    index 5178317..ddf4304 100644
    class wpdb { 
    14171417                                }
    14181418                        }
    14191419
     1420                        if( DB_PERSISTENT ) {
     1421                                $host = "p:$host";
     1422                        }
     1423                       
    14201424                        if ( WP_DEBUG ) {
    14211425                                mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
    14221426                        } else {