Just cache the is_blog_installed value. If the options table goes away while the value is still cached, oh well. Very edge-case.

git-svn-id: https://develop.svn.wordpress.org/trunk@6249 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-10-14 07:57:56 +00:00
parent c061823bb4
commit c77a783d55
1 changed files with 7 additions and 5 deletions

View File

@ -911,16 +911,18 @@ function do_robots() {
function is_blog_installed() {
global $wpdb, $wp_is_blog_installed;
// Set flag so we don't do the query more than once.
if ( isset($wp_is_blog_installed) )
return $wp_is_blog_installed;
// Check cache first. If options table goes away and we have true cached, oh well.
if ( wp_cache_get('is_blog_installed') )
return true;
$wpdb->hide_errors();
$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
$wpdb->show_errors();
$wp_is_blog_installed = !empty( $installed ) ? true : false;
return $wp_is_blog_installed;
$installed = !empty( $installed ) ? true : false;
wp_cache_set('is_blog_installed', $installed);
return $installed;
}