From 8c5057119eb00943fe8c428bcd4324495f5d17c7 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 10 Mar 2015 23:19:02 +0000 Subject: [PATCH] Revert the part of [31168] that [31701] was trying to fix. `default-filters.php` is loaded before the `$current_site` global is set, so `is_main_site()` cannot be used there. fixes #30947. git-svn-id: https://develop.svn.wordpress.org/trunk@31708 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/default-filters.php | 25 ------------------------- src/wp-includes/update.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 65ad323786..57e02d6fab 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -358,31 +358,6 @@ add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 ); // Taxonomy add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority -// Update -if ( ( is_main_site() || is_network_admin() ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { - add_action( 'admin_init', '_maybe_update_core' ); - add_action( 'wp_version_check', 'wp_version_check' ); - add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 ); - - add_action( 'load-plugins.php', 'wp_update_plugins' ); - add_action( 'load-update.php', 'wp_update_plugins' ); - add_action( 'load-update-core.php', 'wp_update_plugins' ); - add_action( 'admin_init', '_maybe_update_plugins' ); - add_action( 'wp_update_plugins', 'wp_update_plugins' ); - add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 ); - - add_action( 'load-themes.php', 'wp_update_themes' ); - add_action( 'load-update.php', 'wp_update_themes' ); - add_action( 'load-update-core.php', 'wp_update_themes' ); - add_action( 'admin_init', '_maybe_update_themes' ); - add_action( 'wp_update_themes', 'wp_update_themes' ); - add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 ); - - add_action( 'update_option_WPLANG', 'wp_clean_update_cache', 10, 0 ); - add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' ); - add_action( 'init', 'wp_schedule_update_checks' ); -} - // Canonical add_action( 'template_redirect', 'redirect_canonical' ); add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 ); diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php index e29c78f9a7..b19b27c87f 100644 --- a/src/wp-includes/update.php +++ b/src/wp-includes/update.php @@ -663,3 +663,31 @@ function wp_clean_update_cache() { wp_clean_themes_cache(); delete_site_transient( 'update_core' ); } + +if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { + return; +} + +add_action( 'admin_init', '_maybe_update_core' ); +add_action( 'wp_version_check', 'wp_version_check' ); +add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 ); + +add_action( 'load-plugins.php', 'wp_update_plugins' ); +add_action( 'load-update.php', 'wp_update_plugins' ); +add_action( 'load-update-core.php', 'wp_update_plugins' ); +add_action( 'admin_init', '_maybe_update_plugins' ); +add_action( 'wp_update_plugins', 'wp_update_plugins' ); +add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 ); + +add_action( 'load-themes.php', 'wp_update_themes' ); +add_action( 'load-update.php', 'wp_update_themes' ); +add_action( 'load-update-core.php', 'wp_update_themes' ); +add_action( 'admin_init', '_maybe_update_themes' ); +add_action( 'wp_update_themes', 'wp_update_themes' ); +add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 ); + +add_action( 'update_option_WPLANG', 'wp_clean_update_cache' , 10, 0 ); + +add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' ); + +add_action( 'init', 'wp_schedule_update_checks' );