From f91d22aadb59b72d7de3fb047ea2d236003d55bd Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 26 Nov 2008 11:48:05 +0000 Subject: [PATCH] If api.wp.org request blocks, make sure another requests isn't scheduled for 12 hours. see #8347 git-svn-id: http://svn.automattic.com/wordpress/trunk@9901 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/http.php | 1 + wp-includes/update.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/wp-includes/http.php b/wp-includes/http.php index cffc88e853..5d0523e9e3 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -786,6 +786,7 @@ class WP_Http_Streams { stream_set_timeout($handle, $r['timeout'] ); if ( ! $r['blocking'] ) { + stream_set_blocking($handle, 0); fclose($handle); return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') ); } diff --git a/wp-includes/update.php b/wp-includes/update.php index 9097e3bcff..b2ca6023d0 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -35,6 +35,10 @@ function wp_version_check() { ) return false; + // Update last_checked for current to prevent multiple blocking requests if request hangs + $current->last_checked = time(); + update_option( 'update_core', $current ); + if ( method_exists( $wpdb, 'db_version' ) ) $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users)); else @@ -138,6 +142,10 @@ function wp_update_plugins() { if ( $time_not_changed && !$plugin_changed ) return false; + // Update last_checked for current to prevent multiple blocking requests if request hangs + $current->last_checked = time(); + update_option( 'update_plugins', $current ); + $to_send->plugins = $plugins; $to_send->active = $active; $send = serialize( $to_send ); @@ -196,11 +204,15 @@ function wp_update_themes( ) { $new_option = ''; $new_option->last_checked = time( ); - $time_not_changed = isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ); + $time_not_changed = isset( $current_theme->last_checked ) && 43200 > ( time( ) - $current_theme->last_checked ); if( $time_not_changed ) return false; + // Update last_checked for current to prevent multiple blocking requests if request hangs + $current_theme->last_checked = time(); + update_option( 'update_themes', $current_theme ); + $themes = array( ); $themes['current_theme'] = $current_theme; foreach( (array) $installed_themes as $theme_title => $theme ) {