Skip to content

Commit 199bc9d

Browse files
committed
Upgrade/Install: Delay automatic updates after installation.
After installation, the user is directed to the `Log In` page. This triggers the `wp_schedule_update_checks()` function which is hooked to `init` and schedules updates to run immediately if no other events exist. As a result of more robust use of maintenance mode for automatic updates added in [58128], the user may be presented with a maintenance mode screen just after installing WordPress. To improve the user experience, this schedules core updates for 1 hour, plugin updates for 1.5 hours, and theme updates for 2 hours after installation. Follow-up to [58128], [58139], [58308], [58309]. Props afragen, hellofromTonya, peterwilsoncc, nithi22, dd32. Fixes #61457. See #58281, #61391. git-svn-id: https://develop.svn.wordpress.org/trunk@58435 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e4d3def commit 199bc9d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/wp-admin/includes/upgrade.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ function wp_install( $blog_title, $user_name, $user_email, $is_public, $deprecat
5252
wp_check_mysql_version();
5353
wp_cache_flush();
5454
make_db_current_silent();
55+
56+
/*
57+
* Ensure update checks are delayed after installation.
58+
*
59+
* This prevents users being presented with a maintenance mode screen
60+
* immediately after installation.
61+
*/
62+
wp_unschedule_hook( 'wp_version_check' );
63+
wp_unschedule_hook( 'wp_update_plugins' );
64+
wp_unschedule_hook( 'wp_update_themes' );
65+
66+
wp_schedule_event( time() + HOUR_IN_SECONDS, 'twicedaily', 'wp_version_check' );
67+
wp_schedule_event( time() + ( 1.5 * HOUR_IN_SECONDS ), 'twicedaily', 'wp_update_plugins' );
68+
wp_schedule_event( time() + ( 2 * HOUR_IN_SECONDS ), 'twicedaily', 'wp_update_themes' );
69+
5570
populate_options();
5671
populate_roles();
5772

0 commit comments

Comments
 (0)