$current_site->site_name=$wpdb->get_var($wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'",$current_site->id));
die("That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>");
}else{
die("No WPMU site defined on this host. If you are the owner of this site, please check <a href='http://codex.wordpress.org/Debugging_WPMU'>Debugging WPMU</a> for further assistance.");
}
}else{
$path='/';
}
}else{
$current_site=$wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s",$domain,$path));
if($current_site!=null)
return$current_site;
$current_site=$wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'",$domain));
die("That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>");
}else{
die("No WPMU site defined on this host. If you are the owner of this site, please check <a href='http://codex.wordpress.org/Debugging_WPMU'>Debugging WPMU</a> for further assistance.");
}
}else{
$path='/';
}
}
return$current_site;
}
$current_site=wpmu_current_site();
if(!isset($current_site->blog_id))
$current_site->blog_id=$wpdb->get_var("SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'");
// no blog found, are we installing? Check if the table exists.
if(defined('WP_INSTALLING')){
$blog_id=$wpdb->get_var("SELECT blog_id FROM $wpdb->blogs LIMIT 0,1");
if($blog_id==false){
// table doesn't exist. This is the first blog
$blog_id=1;
}else{
// table exists
// don't create record at this stage. we're obviously installing so it doesn't matter what the table vars below are like.
// default to using the "main" blog.
$blog_id=1;
}
$current_blog->blog_id=$blog_id;
}else{
$check=$wpdb->get_results("SELECT * FROM $wpdb->site");
if($check==false){
$msg=': DB Tables Missing';
}else{
$msg='';
}
die("No Blog by that name on this system.".$msg);
}
}
$wpdb->suppress_errors(false);
if('0'==$current_blog->public){
// This just means the blog shouldn't show up in google, etc. Only to registered members
}
functionis_installed(){
global$wpdb,$domain,$path;
$base=stripslashes($base);
if(defined("WP_INSTALLING")==false){
$check=$wpdb->get_results("SELECT * FROM $wpdb->site");
$msg="If your blog does not display, please contact the owner of this site.<br /><br />If you are the owner of this site please check that MySQL is running properly and all tables are error free.<br /><br />";
if($check==false){
$msg.="<strong>Database Tables Missing.</strong><br />Database tables are missing. This means that MySQL is either not running, WPMU was not installed properly, or someone deleted {$wpdb->site}. You really <em>should</em> look at your database now.<br />";
}else{
$msg.='<strong>Could Not Find Blog!</strong><br />';
$msg.="Searched for <em>".$domain.$path."</em> in ".DB_NAME."::".$wpdb->blogs." table. Is that right?<br />";
}
$msg.="<br />\n<h1>What do I do now?</h1>";
$msg.="Read the <a target='_blank' href='http://codex.wordpress.org/Debugging_WPMU'>bug report</a> page. Some of the guidelines there may help you figure out what went wrong.<br />";
$msg.="If you're still stuck with this message, then check that your database contains the following tables:<ul>
<li>$wpdb->blogs</li>
<li>$wpdb->users</li>
<li>$wpdb->usermeta</li>
<li>$wpdb->site</li>
<li>$wpdb->sitemeta</li>
<li>$wpdb->sitecategories</li>
</ul>";
$msg.="If you suspect a problem please report it to the support forums but you must include the information asked for in the <a href='http://codex.wordpress.org/Debugging_WPMU'>WPMU bug reporting guidelines</a>!<br /><br />";
if(is_file('release-info.txt')){
$msg.='Your bug report must include the following text: "';