Make WordPress Core

Ticket #37799: 37799.2.diff

File 37799.2.diff, 2.6 KB (added by pcarvalho, 8 years ago)

add current batch count and total, and improve messages for network upgrade

  • wp-admin/network/upgrade.php

     
    4141
    4242$action = isset($_GET['action']) ? $_GET['action'] : 'show';
    4343
     44$total_sites = get_blog_count();
     45
    4446switch ( $action ) {
    4547        case "upgrade":
    4648                $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0;
     
    6567                        'orderby'    => 'id',
    6668                ) );
    6769                if ( empty( $site_ids ) ) {
    68                         echo '<p>' . __( 'All done!' ) . '</p>';
     70                        echo '<p>' . esc_html__( 'No more sites found.' ) . '</p>';
     71                        // If a site fails to be upgraded, the script will just stop, so the $n has always the total so far
     72                        echo '<p>' . esc_html( sprintf( _n( '%1$s site have been upgraded.', '%1$s sites have been upgraded.', $n ), $n ) ) . '</p>';
    6973                        break;
    7074                }
     75
    7176                echo "<ul>";
    7277                foreach ( (array) $site_ids as $site_id ) {
    7378                        switch_to_blog( $site_id );
     
    9095                                        '<em>' . $response->get_error_message() . '</em>'
    9196                                ) );
    9297                        }
    93 
    9498                        /**
    9599                         * Fires after the Multisite DB upgrade for each site is complete.
    96100                         *
     
    109113                        do_action( 'wpmu_upgrade_site', $site_id );
    110114                }
    111115                echo "</ul>";
    112                 ?><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>
     116
     117                $top_boundery = $n + 5;
     118                if ( $total_sites < $top_boundery ) {
     119                        $top_boundery = $total_sites;
     120                }
     121                $lower_boundery = $n + 1;
     122
     123                ?>
     124                <p><?php echo esc_html( sprintf( __( 'Upgrading sites %1$d-%2$d out of %3$d' ),$lower_boundery , $top_boundery , $total_sites ) ); ?></p>
     125                <p><?php esc_html_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 ( $top_boundery ) ?>"><?php esc_html_e( 'Next Sites' ); ?></a></p>
     126
     127
    113128                <script type="text/javascript">
    114129                <!--
    115130                function nextpage() {
    116                         location.href = "upgrade.php?action=upgrade&n=<?php echo ($n + 5) ?>";
     131                        location.href = "upgrade.php?action=upgrade&n=<?php echo ( $top_boundery ) ?>";
    117132                }
    118133                setTimeout( "nextpage()", 250 );
    119134                //-->
     
    128143                <?php endif; ?>
    129144
    130145                <p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p>
     146                <p><?php echo esc_html( sprintf( __( 'There are %1$s sites.' ), $total_sites ) ); ?></p>
    131147                <p><a class="button button-primary" href="upgrade.php?action=upgrade"><?php _e( 'Upgrade Network' ); ?></a></p>
    132148                <?php
    133149                /**