From 16411f9c7be96cfb0de9f8fccdbbab985d5b122f Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 13 Oct 2007 18:39:28 +0000 Subject: [PATCH] Set global is_blog_installed flag so we don't query the DB more than once per load. git-svn-id: http://svn.automattic.com/wordpress/trunk@6244 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 610969689..2facb1475 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -909,12 +909,18 @@ function do_robots() { function is_blog_installed() { - global $wpdb; + 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; + $wpdb->hide_errors(); $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); $wpdb->show_errors(); - return !empty( $installed ); + $wp_is_blog_installed = !empty( $installed ) ? true : false; + return $wp_is_blog_installed; }