wp/wp-admin/network/upgrade.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     6  * @subpackage Multisite
     6  * @subpackage Multisite
     7  * @since 3.0.0
     7  * @since 3.0.0
     8  */
     8  */
     9 
     9 
    10 /** Load WordPress Administration Bootstrap */
    10 /** Load WordPress Administration Bootstrap */
    11 require_once( dirname( __FILE__ ) . '/admin.php' );
    11 require_once __DIR__ . '/admin.php';
    12 
    12 
    13 require_once( ABSPATH . WPINC . '/http.php' );
    13 require_once ABSPATH . WPINC . '/http.php';
    14 
    14 
    15 $title       = __( 'Upgrade Network' );
    15 $title       = __( 'Upgrade Network' );
    16 $parent_file = 'upgrade.php';
    16 $parent_file = 'upgrade.php';
    17 
    17 
    18 get_current_screen()->add_help_tab(
    18 get_current_screen()->add_help_tab(
    26 	)
    26 	)
    27 );
    27 );
    28 
    28 
    29 get_current_screen()->set_help_sidebar(
    29 get_current_screen()->set_help_sidebar(
    30 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    30 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    31 	'<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Updates_Screen">Documentation on Upgrade Network</a>' ) . '</p>' .
    31 	'<p>' . __( '<a href="https://wordpress.org/support/article/network-admin-updates-screen/">Documentation on Upgrade Network</a>' ) . '</p>' .
    32 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    32 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    33 );
    33 );
    34 
    34 
    35 require_once( ABSPATH . 'wp-admin/admin-header.php' );
    35 require_once ABSPATH . 'wp-admin/admin-header.php';
    36 
    36 
    37 if ( ! current_user_can( 'upgrade_network' ) ) {
    37 if ( ! current_user_can( 'upgrade_network' ) ) {
    38 	wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
    38 	wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
    39 }
    39 }
    40 
    40 
    47 	case 'upgrade':
    47 	case 'upgrade':
    48 		$n = ( isset( $_GET['n'] ) ) ? intval( $_GET['n'] ) : 0;
    48 		$n = ( isset( $_GET['n'] ) ) ? intval( $_GET['n'] ) : 0;
    49 
    49 
    50 		if ( $n < 5 ) {
    50 		if ( $n < 5 ) {
    51 			/**
    51 			/**
    52 			 * @global string $wp_db_version
    52 			 * @global int $wp_db_version WordPress database version.
    53 			 */
    53 			 */
    54 			global $wp_db_version;
    54 			global $wp_db_version;
    55 			update_site_option( 'wpmu_upgrade_site', $wp_db_version );
    55 			update_site_option( 'wpmu_upgrade_site', $wp_db_version );
    56 		}
    56 		}
    57 
    57 
    88 					'timeout'     => 120,
    88 					'timeout'     => 120,
    89 					'httpversion' => '1.1',
    89 					'httpversion' => '1.1',
    90 					'sslverify'   => false,
    90 					'sslverify'   => false,
    91 				)
    91 				)
    92 			);
    92 			);
       
    93 
    93 			if ( is_wp_error( $response ) ) {
    94 			if ( is_wp_error( $response ) ) {
    94 				wp_die(
    95 				wp_die(
    95 					sprintf(
    96 					sprintf(
    96 						/* translators: 1: site url, 2: server error message */
    97 						/* translators: 1: Site URL, 2: Server error message. */
    97 						__( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ),
    98 						__( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ),
    98 						$siteurl,
    99 						$siteurl,
    99 						'<em>' . $response->get_error_message() . '</em>'
   100 						'<em>' . $response->get_error_message() . '</em>'
   100 					)
   101 					)
   101 				);
   102 				);
   107 			 * @since MU (3.0.0)
   108 			 * @since MU (3.0.0)
   108 			 *
   109 			 *
   109 			 * @param array|WP_Error $response The upgrade response array or WP_Error on failure.
   110 			 * @param array|WP_Error $response The upgrade response array or WP_Error on failure.
   110 			 */
   111 			 */
   111 			do_action( 'after_mu_upgrade', $response );
   112 			do_action( 'after_mu_upgrade', $response );
       
   113 
   112 			/**
   114 			/**
   113 			 * Fires after each site has been upgraded.
   115 			 * Fires after each site has been upgraded.
   114 			 *
   116 			 *
   115 			 * @since MU (3.0.0)
   117 			 * @since MU (3.0.0)
   116 			 *
   118 			 *
   130 		</script>
   132 		</script>
   131 		<?php
   133 		<?php
   132 		break;
   134 		break;
   133 	case 'show':
   135 	case 'show':
   134 	default:
   136 	default:
   135 		if ( get_site_option( 'wpmu_upgrade_site' ) != $GLOBALS['wp_db_version'] ) :
   137 		if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $GLOBALS['wp_db_version'] ) :
   136 			?>
   138 			?>
   137 		<h2><?php _e( 'Database Update Required' ); ?></h2>
   139 		<h2><?php _e( 'Database Update Required' ); ?></h2>
   138 		<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>
   140 		<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>
   139 		<?php endif; ?>
   141 		<?php endif; ?>
   140 
   142 
   150 		break;
   152 		break;
   151 }
   153 }
   152 ?>
   154 ?>
   153 </div>
   155 </div>
   154 
   156 
   155 <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
   157 <?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>