diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-08-13 15:13:05 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-08-13 15:13:05 +0000 |
commit | bfa3b629e0d67016ec83050c5db762479af40609 (patch) | |
tree | 4c9ae204172d0fad3ae056ccc65ffe9ea91134d2 /wp-includes/update.php | |
parent | 7258ea2d7eeedb439607b72a1f74dee98e4b9d12 (diff) | |
download | wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.tar.gz wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.tar.xz wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.zip |
Merge with WP revision 8635
git-svn-id: http://svn.automattic.com/wordpress-mu/branches/2.6@1421 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/update.php')
-rw-r--r-- | wp-includes/update.php | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/wp-includes/update.php b/wp-includes/update.php index 4d94ac2..beeee9f 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -90,22 +90,17 @@ function wp_update_plugins() { if ( !function_exists('fsockopen') || defined('WP_INSTALLING') ) return false; - $current = get_option( 'update_plugins' ); - - $time_not_changed = isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ); - // If running blog-side, bail unless we've not checked in the last 12 hours - if ( !function_exists( 'get_plugins' ) ) { - if ( $time_not_changed ) - return false; + if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); - } $plugins = get_plugins(); $active = get_option( 'active_plugins' ); + $current = get_option( 'update_plugins' ); $new_option = ''; $new_option->last_checked = time(); + $time_not_changed = isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ); $plugin_changed = false; foreach ( $plugins as $file => $p ) { @@ -120,6 +115,12 @@ function wp_update_plugins() { $plugin_changed = true; } + foreach ( (array) $current->response as $plugin_file => $update_details ) { + if ( ! isset($plugins[ $plugin_file ]) ) { + $plugin_changed = true; + } + } + // Bail if we've checked in the last 12 hours and if nothing has changed if ( $time_not_changed && !$plugin_changed ) return false; @@ -154,9 +155,19 @@ function wp_update_plugins() { update_option( 'update_plugins', $new_option ); } -if ( defined( 'WP_ADMIN' ) && WP_ADMIN ) - add_action( 'admin_init', 'wp_update_plugins' ); -else - add_action( 'init', 'wp_update_plugins' ); + +function _maybe_update_plugins() { + $current = get_option( 'update_plugins' ); + if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) ) + return; + wp_update_plugins(); +} + +add_action( 'load-plugins.php', 'wp_update_plugins' ); +add_action( 'admin_init', '_maybe_update_plugins' ); +add_action( 'wp_update_plugins', 'wp_update_plugins' ); + +if ( !wp_next_scheduled('wp_update_plugins') ) + wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); ?> |