No WPMU site defined on this host.

Apologies if this is covered elsewhere, but I’ve searched for the phrase which is the title of my post and didn’t come up with a specific answer. I’m getting the above error message when I switch from standard WPMU to the Multi-DB code. It should be noted that if I remove the db.php and db-config.php files, I go right back to a merrily-swinging WPMU installation.

I’m using the released 1.0.1 version of the Multi-DB files. The way I have it set up currently is to have my old db as the global db for now, with the root blog’s tables in the VIP database. The add_vip_blog call reflects this. I’m using the 16-database setup. I’m using my host’s shared IP address for the dc_ip and host IPs in the add_db_server calls. I’ve tried switching to ‘localhost’ for this information, but with the same results. All the usernames and passwords are identical.

Server information: Apache 2.2.9 (Unix), PHP 5.2.6, MySQL 5.0.45-community-log on a Linux server.

Thanks for whatever help you can send my way!

  • Luke
    • The Crimson Coder

    And the version of MU is?

    It’s known (with a new version coming down the pipe) that it will not work with 2.6 yet.

    If you’re not on 2.6, then if you can take it out and everything is fine, then my first thought would be: have you moved your tables around yet?

    Did you add the right configuration in db-config.php?

    “No WPMU site defined on this host” comes when MU cannot find a site in the wp_site table, assuming you’re using the default prefix. Running though /site_root/wpmu-settings.php is where that will be caused to pop up.

  • tbelknap
    • Flash Drive

    It’s known (with a new version coming down the pipe) that it will not work with 2.6 yet.

    Well, that was one detail I neglected to add to my post, and that turns out to be the most relevant one. OK, so no multi-db for 2.6 yet.

    Thanks for the help and the quick response!

  • ZappoMan
    • Design Lord, Child of Thor

    I see from this thread and several others that multi-db does not yet support 2.6…

    I’ve been playing around with migrating to 2.6, and am seeing this not-workingness… I think it relates to have 2.6 changed wpdb::set_prefix()’s behavior. But some quick hacks to multi-db have not yielded instantaneous results.

    Has anyone tried to get multi-db to work with 2.6 yet?

  • ZappoMan
    • Design Lord, Child of Thor

    Ok, I should check myself before I wreck myself…

    I just copied over the global_tables variable and the set_prefix() method from the standard 2.6 wp-db.php into db.php and things seem to be working now.

    cross my fingers… hope that’s it.

  • ZappoMan
    • Design Lord, Child of Thor

    Well, I seem to be working aok with my mod.

    Here’s the “diff”:

    around line 120 (inside the wpdb class) add:

    var $global_tables = array(‘blogs’, ‘signups’, ‘site’, ‘sitemeta’, ‘users’, ‘usermeta’, ‘sitecategories’, ‘registration_log’, ‘blog_versions’:wink:;

    Then replace wpdb::set_prefix() [about line 193] with:

    function set_prefix($prefix) {
    if ( preg_match('|[^a-z0-9_]|i', $prefix) )
    return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/
    'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/);
    $old_prefix = $this->base_prefix;
    $this->base_prefix = $prefix;
    foreach ( $this->global_tables as $table )
    $this->$table = $prefix . $table;

    if ( empty($this->blogid) )
    return $old_prefix;

    $this->prefix = $this->base_prefix . $this->blogid . '_';

    foreach ( $this->blog_tables as $table )
    $this->$table = $this->prefix . $table;

    if ( defined('CUSTOM_USER_TABLE') )
    $this->users = CUSTOM_USER_TABLE;

    if ( defined('CUSTOM_USER_META_TABLE') )
    $this->usermeta = CUSTOM_USER_META_TABLE;
    return $old_prefix;
    }

    This makes my multi-db work great with 2.6.

    At least it’s working in my dev environment.

  • Barry
    • DEV MAN’s Mascot

    Yes, other than some added comments and a couple of new DEFINES near the top, those are pretty much the only changes in the WPMU wpdb class from 1.5.1 to 2.6 (as far as I remember anyway) though you could also now remove the declaration for $tables as it is not longer needed (now held in global_tables and blog_tables).