From 27bc4a130f1583e6fede25456bc06e80608d218c Mon Sep 17 00:00:00 2001 From: Ryan Boren 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: https://develop.svn.wordpress.org/trunk@6244 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 610969689b..2facb14759 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; }