From b8566c75cde6621701388c9962245107135c28e4 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 16 Apr 2009 22:00:39 +0000 Subject: [PATCH] Optimize install check by checking alloptions cache before doing a separate query. Props joostdevalk. fixes #8947 git-svn-id: http://svn.automattic.com/wordpress/trunk@10958 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 1ff8d11c6..f3c4d2e2a 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1679,7 +1679,12 @@ function is_blog_installed() { return true; $suppress = $wpdb->suppress_errors(); - $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); + $alloptions = wp_load_alloptions(); + // If siteurl is not set to autoload, but other options are loaded, check if it's there + if ( !isset($alloptions['siteurl']) && count($alloptions) > 1 ) + $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); + else + $installed = $alloptions['siteurl']; $wpdb->suppress_errors($suppress); $installed = !empty( $installed ) ? true : false;