[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Multisite upgrade administration panel. 4 * 5 * @package WordPress 6 * @subpackage Multisite 7 * @since 3.0.0 8 */ 9 10 /** Load WordPress Administration Bootstrap */ 11 require_once __DIR__ . '/admin.php'; 12 13 require_once ABSPATH . WPINC . '/http.php'; 14 15 // Used in the HTML title tag. 16 $title = __( 'Upgrade Network' ); 17 $parent_file = 'upgrade.php'; 18 19 get_current_screen()->add_help_tab( 20 array( 21 'id' => 'overview', 22 'title' => __( 'Overview' ), 23 'content' => 24 '<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>' . 25 '<p>' . __( 'If a version update to core has not happened, clicking this button will not affect anything.' ) . '</p>' . 26 '<p>' . __( 'If this process fails for any reason, users logging in to their sites will force the same update.' ) . '</p>', 27 ) 28 ); 29 30 get_current_screen()->set_help_sidebar( 31 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 32 '<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/multisite/admin/#network-admin-updates-screen">Documentation on Upgrade Network</a>' ) . '</p>' . 33 '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' 34 ); 35 36 require_once ABSPATH . 'wp-admin/admin-header.php'; 37 38 if ( ! current_user_can( 'upgrade_network' ) ) { 39 wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); 40 } 41 42 echo '<div class="wrap">'; 43 echo '<h1>' . __( 'Upgrade Network' ) . '</h1>'; 44 45 $action = isset( $_GET['action'] ) ? $_GET['action'] : 'show'; 46 47 switch ( $action ) { 48 case 'upgrade': 49 $n = ( isset( $_GET['n'] ) ) ? (int) $_GET['n'] : 0; 50 51 if ( $n < 5 ) { 52 /** 53 * @global int $wp_db_version WordPress database version. 54 */ 55 global $wp_db_version; 56 update_site_option( 'wpmu_upgrade_site', $wp_db_version ); 57 } 58 59 $site_ids = get_sites( 60 array( 61 'spam' => 0, 62 'deleted' => 0, 63 'archived' => 0, 64 'network_id' => get_current_network_id(), 65 'number' => 5, 66 'offset' => $n, 67 'fields' => 'ids', 68 'order' => 'DESC', 69 'orderby' => 'id', 70 'update_site_meta_cache' => false, 71 ) 72 ); 73 if ( empty( $site_ids ) ) { 74 echo '<p>' . __( 'All done!' ) . '</p>'; 75 break; 76 } 77 echo '<ul>'; 78 foreach ( (array) $site_ids as $site_id ) { 79 switch_to_blog( $site_id ); 80 $siteurl = site_url(); 81 $upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); 82 restore_current_blog(); 83 84 echo "<li>$siteurl</li>"; 85 86 $response = wp_remote_get( 87 $upgrade_url, 88 array( 89 'timeout' => 120, 90 'httpversion' => '1.1', 91 'sslverify' => false, 92 ) 93 ); 94 95 if ( is_wp_error( $response ) ) { 96 wp_die( 97 sprintf( 98 /* translators: 1: Site URL, 2: Server error message. */ 99 __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ), 100 $siteurl, 101 '<em>' . $response->get_error_message() . '</em>' 102 ) 103 ); 104 } 105 106 /** 107 * Fires after the Multisite DB upgrade for each site is complete. 108 * 109 * @since MU (3.0.0) 110 * 111 * @param array $response The upgrade response array. 112 */ 113 do_action( 'after_mu_upgrade', $response ); 114 115 /** 116 * Fires after each site has been upgraded. 117 * 118 * @since MU (3.0.0) 119 * 120 * @param int $site_id The Site ID. 121 */ 122 do_action( 'wpmu_upgrade_site', $site_id ); 123 } 124 echo '</ul>'; 125 ?><p><?php _e( 'If your browser does not 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> 126 <script type="text/javascript"> 127 <!-- 128 function nextpage() { 129 location.href = "upgrade.php?action=upgrade&n=<?php echo ( $n + 5 ); ?>"; 130 } 131 setTimeout( "nextpage()", 250 ); 132 //--> 133 </script> 134 <?php 135 break; 136 case 'show': 137 default: 138 if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $GLOBALS['wp_db_version'] ) : 139 ?> 140 <h2><?php _e( 'Database Update Required' ); ?></h2> 141 <p><?php _e( 'WordPress has been updated! Next and final step is to individually upgrade the sites in your network.' ); ?></p> 142 <?php endif; ?> 143 144 <p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p> 145 <p><a class="button button-primary" href="upgrade.php?action=upgrade"><?php _e( 'Upgrade Network' ); ?></a></p> 146 <?php 147 /** 148 * Fires before the footer on the network upgrade screen. 149 * 150 * @since MU (3.0.0) 151 */ 152 do_action( 'wpmu_upgrade_page' ); 153 break; 154 } 155 ?> 156 </div> 157 158 <?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sat Nov 23 08:20:01 2024 | Cross-referenced by PHPXref |