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