27 '<p>' . __('If this process fails for any reason, users logging in to their sites will force the same update.') . '</p>' |
27 '<p>' . __('If this process fails for any reason, users logging in to their sites will force the same update.') . '</p>' |
28 ) ); |
28 ) ); |
29 |
29 |
30 get_current_screen()->set_help_sidebar( |
30 get_current_screen()->set_help_sidebar( |
31 '<p><strong>' . __('For more information:') . '</strong></p>' . |
31 '<p><strong>' . __('For more information:') . '</strong></p>' . |
32 '<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Updates_Screen" target="_blank">Documentation on Upgrade Network</a>') . '</p>' . |
32 '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Updates_Screen" target="_blank">Documentation on Upgrade Network</a>') . '</p>' . |
33 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
33 '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
34 ); |
34 ); |
35 |
35 |
36 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
36 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
37 |
37 |
38 if ( ! current_user_can( 'manage_network' ) ) |
38 if ( ! current_user_can( 'manage_network' ) ) |
39 wp_die( __( 'You do not have permission to access this page.' ) ); |
39 wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
40 |
40 |
41 echo '<div class="wrap">'; |
41 echo '<div class="wrap">'; |
42 screen_icon('tools'); |
|
43 echo '<h2>' . __( 'Upgrade Network' ) . '</h2>'; |
42 echo '<h2>' . __( 'Upgrade Network' ) . '</h2>'; |
44 |
43 |
45 $action = isset($_GET['action']) ? $_GET['action'] : 'show'; |
44 $action = isset($_GET['action']) ? $_GET['action'] : 'show'; |
46 |
45 |
47 switch ( $action ) { |
46 switch ( $action ) { |
51 if ( $n < 5 ) { |
50 if ( $n < 5 ) { |
52 global $wp_db_version; |
51 global $wp_db_version; |
53 update_site_option( 'wpmu_upgrade_site', $wp_db_version ); |
52 update_site_option( 'wpmu_upgrade_site', $wp_db_version ); |
54 } |
53 } |
55 |
54 |
56 $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A ); |
55 $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A ); |
57 if ( empty( $blogs ) ) { |
56 if ( empty( $blogs ) ) { |
58 echo '<p>' . __( 'All done!' ) . '</p>'; |
57 echo '<p>' . __( 'All done!' ) . '</p>'; |
59 break; |
58 break; |
60 } |
59 } |
61 echo "<ul>"; |
60 echo "<ul>"; |
62 foreach ( (array) $blogs as $details ) { |
61 foreach ( (array) $blogs as $details ) { |
63 switch_to_blog( $details['blog_id'] ); |
62 switch_to_blog( $details['blog_id'] ); |
64 $siteurl = site_url(); |
63 $siteurl = site_url(); |
65 $upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
64 $upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
66 restore_current_blog(); |
65 restore_current_blog(); |
|
66 |
67 echo "<li>$siteurl</li>"; |
67 echo "<li>$siteurl</li>"; |
|
68 |
68 $response = wp_remote_get( $upgrade_url, array( 'timeout' => 120, 'httpversion' => '1.1' ) ); |
69 $response = wp_remote_get( $upgrade_url, array( 'timeout' => 120, 'httpversion' => '1.1' ) ); |
69 if ( is_wp_error( $response ) ) |
70 if ( is_wp_error( $response ) ) { |
70 wp_die( sprintf( __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: <em>%2$s</em>' ), $siteurl, $response->get_error_message() ) ); |
71 wp_die( sprintf( |
|
72 /* translators: 1: site url, 2: server error message */ |
|
73 __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ), |
|
74 $siteurl, |
|
75 '<em>' . $response->get_error_message() . '</em>' |
|
76 ) ); |
|
77 } |
|
78 |
|
79 /** |
|
80 * Fires after the Multisite DB upgrade for each site is complete. |
|
81 * |
|
82 * @since MU |
|
83 * |
|
84 * @param array|WP_Error $response The upgrade response array or WP_Error on failure. |
|
85 */ |
71 do_action( 'after_mu_upgrade', $response ); |
86 do_action( 'after_mu_upgrade', $response ); |
|
87 /** |
|
88 * Fires after each site has been upgraded. |
|
89 * |
|
90 * @since MU |
|
91 * |
|
92 * @param int $blog_id The id of the blog. |
|
93 */ |
72 do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); |
94 do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); |
73 } |
95 } |
74 echo "</ul>"; |
96 echo "</ul>"; |
75 ?><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> |
97 ?><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> |
76 <script type='text/javascript'> |
98 <script type="text/javascript"> |
77 <!-- |
99 <!-- |
78 function nextpage() { |
100 function nextpage() { |
79 location.href = "upgrade.php?action=upgrade&n=<?php echo ($n + 5) ?>"; |
101 location.href = "upgrade.php?action=upgrade&n=<?php echo ($n + 5) ?>"; |
80 } |
102 } |
81 setTimeout( "nextpage()", 250 ); |
103 setTimeout( "nextpage()", 250 ); |