Make WordPress Core


Ignore:
Timestamp:
02/19/2010 01:03:58 AM (17 years ago)
Author:
nacin
Message:

Assume WP_DEBUG is defined in wpdb. Remove unnecessary constant() calls. Ensure DB_COLLATE defined as empty string doesn't override default Multisite collation. fixes #12041, see #11644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/wp-db.php

    r13174 r13209  
    346346         */
    347347        function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
    348                 if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true )
     348                if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB )
    349349                        $this->db_connect();
    350350                return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
    … …  
    368368                register_shutdown_function(array(&$this, "__destruct"));
    369369
    370                 if ( defined( 'WP_DEBUG' ) && WP_DEBUG )
     370                if ( WP_DEBUG )
    371371                        $this->show_errors();
    372372
    373373                if ( is_multisite() ) {
    374374                        $this->charset = 'utf8';
    375                         if ( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' )
    376                                 $this->collate = constant( 'DB_COLLATE' );
     375                        if ( defined( 'DB_COLLATE' ) && DB_COLLATE )
     376                                $this->collate = DB_COLLATE;
    377377                        else
    378378                                $this->collate = 'utf8_general_ci';
     379                } elseif ( defined( 'DB_COLLATE' ) ) {
     380                        $this->collate = DB_COLLATE;
    379381                }
    380382
    381383                if ( defined('DB_CHARSET') )
    382384                        $this->charset = DB_CHARSET;
    383 
    384                 if ( defined('DB_COLLATE') )
    385                         $this->collate = DB_COLLATE;
    386385
    387386                $this->dbuser = $dbuser;
    … …  
    667666                        $msg = "WordPress database error: [$str]\n{$this->last_query}\n";
    668667                        if ( defined( 'ERRORLOGFILE' ) )
    669                                 error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) );
     668                                error_log( $msg, 3, ERRORLOGFILE );
    670669                        if ( defined( 'DIEONDBERROR' ) )
    671670                                die( $msg );
    … …  
    808807                // use $this->dbhglobal for gloal table ops
    809808                unset( $dbh );
    810                 if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) {
     809                if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB ) {
    811810                        if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
    812811                                if( false == isset( $this->dbhglobal ) ) {
Note: See TracChangeset for help on using the changeset viewer.