Make WordPress Core

Changeset 13387


Ignore:
Timestamp:
02/24/2010 09:30:13 PM (15 years ago)
Author:
wpmuguru
Message:

database code cleanup, See #12362

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-settings.php

    r13386 r13387  
    116116}
    117117
    118 $wpdb->set_prefix( $table_prefix ); // set up blog tables
     118$wpdb->set_prefix( $table_prefix, false ); // set DB table prefix
    119119$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
    120120$table_prefix = $wpdb->get_blog_prefix();
  • trunk/wp-includes/wp-db.php

    r13382 r13387  
    549549     * @return string|WP_Error Old prefix or WP_Error on error
    550550     */
    551     function set_prefix( $prefix ) {
     551    function set_prefix( $prefix, $set_table_names = true ) {
    552552
    553553        if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
     
    561561        $this->base_prefix = $prefix;
    562562
    563         foreach ( $this->tables( 'global' ) as $table => $prefixed_table )
    564             $this->$table = $prefixed_table;
    565 
    566         if ( defined( 'VHOST' ) && empty( $this->blogid ) )
    567             return $old_prefix;
    568 
    569         $this->prefix = $this->get_blog_prefix( $this->blogid );
    570 
    571         foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
    572             $this->$table = $prefixed_table;
    573 
    574         foreach ( $this->tables( 'old' ) as $table => $prefixed_table )
    575             $this->$table = $prefixed_table;
    576 
     563        if ( $set_table_names ) {
     564            foreach ( $this->tables( 'global' ) as $table => $prefixed_table )
     565                $this->$table = $prefixed_table;
     566
     567            if ( defined( 'VHOST' ) && empty( $this->blogid ) )
     568                return $old_prefix;
     569
     570            $this->prefix = $this->get_blog_prefix( $this->blogid );
     571
     572            foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
     573                $this->$table = $prefixed_table;
     574
     575            foreach ( $this->tables( 'old' ) as $table => $prefixed_table )
     576                $this->$table = $prefixed_table;
     577        }
    577578        return $old_prefix;
    578579    }
Note: See TracChangeset for help on using the changeset viewer.