3 * Multisite upgrade administration panel.
6 * @subpackage Multisite
10 /** Load WordPress Administration Bootstrap */
11 require_once( dirname( __FILE__ ) . '/admin.php' );
13 require_once( ABSPATH . WPINC . '/http.php' );
15 $title = __( 'Upgrade Network' );
16 $parent_file = 'upgrade.php';
18 get_current_screen()->add_help_tab( array(
20 'title' => __('Overview'),
22 '<p>' . __('Only use this screen once you have updated to a new version of WordPress through Updates/Available Updates (via the Network Administration navigation menu or the Toolbar). Clicking the Upgrade Network button will step through each site in the network, five at a time, and make sure any database updates are applied.') . '</p>' .
23 '<p>' . __('If a version update to core has not happened, clicking this button won’t affect anything.') . '</p>' .
24 '<p>' . __('If this process fails for any reason, users logging in to their sites will force the same update.') . '</p>'
27 get_current_screen()->set_help_sidebar(
28 '<p><strong>' . __('For more information:') . '</strong></p>' .
29 '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Updates_Screen">Documentation on Upgrade Network</a>') . '</p>' .
30 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
33 require_once( ABSPATH . 'wp-admin/admin-header.php' );
35 if ( ! current_user_can( 'manage_network' ) )
36 wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
38 echo '<div class="wrap">';
39 echo '<h1>' . __( 'Upgrade Network' ) . '</h1>';
41 $action = isset($_GET['action']) ? $_GET['action'] : 'show';
45 $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0;
49 * @global string $wp_db_version
51 global $wp_db_version;
52 update_site_option( 'wpmu_upgrade_site', $wp_db_version );
55 $site_ids = get_sites( array(
59 'network_id' => get_current_network_id(),
66 if ( empty( $site_ids ) ) {
67 echo '<p>' . __( 'All done!' ) . '</p>';
71 foreach ( (array) $site_ids as $site_id ) {
72 switch_to_blog( $site_id );
73 $siteurl = site_url();
74 $upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' );
75 restore_current_blog();
77 echo "<li>$siteurl</li>";
79 $response = wp_remote_get( $upgrade_url, array(
81 'httpversion' => '1.1',
84 if ( is_wp_error( $response ) ) {
86 /* translators: 1: site url, 2: server error message */
87 __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ),
89 '<em>' . $response->get_error_message() . '</em>'
94 * Fires after the Multisite DB upgrade for each site is complete.
98 * @param array|WP_Error $response The upgrade response array or WP_Error on failure.
100 do_action( 'after_mu_upgrade', $response );
102 * Fires after each site has been upgraded.
106 * @param int $site_id The Site ID.
108 do_action( 'wpmu_upgrade_site', $site_id );
111 ?><p><?php _e( 'If your browser doesn’t start loading the next page automatically, click this link:' ); ?> <a class="button" href="upgrade.php?action=upgrade&n=<?php echo ($n + 5) ?>"><?php _e("Next Sites"); ?></a></p>
112 <script type="text/javascript">
114 function nextpage() {
115 location.href = "upgrade.php?action=upgrade&n=<?php echo ($n + 5) ?>";
117 setTimeout( "nextpage()", 250 );
123 if ( get_site_option( 'wpmu_upgrade_site' ) != $GLOBALS['wp_db_version'] ) :
125 <h2><?php _e( 'Database Update Required' ); ?></h2>
126 <p><?php _e( 'WordPress has been updated! Before we send you on your way, we need to individually upgrade the sites in your network.' ); ?></p>
129 <p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p>
130 <p><a class="button button-primary" href="upgrade.php?action=upgrade"><?php _e( 'Upgrade Network' ); ?></a></p>
133 * Fires before the footer on the network upgrade screen.
137 do_action( 'wpmu_upgrade_page' );
143 <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>