Make WordPress Core

Ticket #31470: 31470.diff

File 31470.diff, 2.8 KB (added by MikeHansenMe, 10 years ago)
  • src/wp-admin/includes/update.php

     
    191191add_filter( 'update_footer', 'core_update_footer' );
    192192
    193193function update_nag() {
    194         if ( is_multisite() && !current_user_can('update_core') )
     194        if ( is_multisite() && ! current_user_can( 'update_core' ) ) {
    195195                return false;
     196        }
    196197
    197198        global $pagenow;
    198199
    199         if ( 'update-core.php' == $pagenow )
     200        if ( 'update-core.php' == $pagenow ) {
    200201                return;
     202        }
    201203
    202204        $cur = get_preferred_from_update_core();
    203205
    204         if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
     206        if ( ! isset( $cur->response ) || 'upgrade' != $cur->response ) {
    205207                return false;
     208        }
    206209
    207         if ( current_user_can('update_core') ) {
    208                 $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url( 'update-core.php' ) );
    209         } else {
    210                 $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
     210        if ( current_user_can( 'update_core' ) ) {
     211                $msg = sprintf( __( '<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.' ), $cur->current, network_admin_url( 'update-core.php' ) );
     212        } elseif ( current_user_can( 'publish_pages' ) ) {
     213                $msg = sprintf( __( '<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.' ), $cur->current );
    211214        }
    212215        echo "<div class='update-nag'>$msg</div>";
    213216}
     
    415418                 * This flag is cleared whenever a successful update occurs using Core_Upgrader.
    416419                 */
    417420                $comparison = ! empty( $failed['critical'] ) ? '>=' : '>';
    418                 if ( version_compare( $failed['attempted'], $wp_version, $comparison ) )
     421                if ( version_compare( $failed['attempted'], $wp_version, $comparison ) ) {
    419422                        $nag = true;
     423                }
    420424        }
    421425
    422         if ( ! $nag )
     426        if ( ! $nag ) {
    423427                return false;
     428        }
    424429
    425         if ( current_user_can('update_core') )
    426                 $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' );
    427         else
    428                 $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
     430        if ( current_user_can( 'update_core' ) ) {
     431                $msg = sprintf( __( 'An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.' ), 'update-core.php' );
     432        } elseif ( current_user_can( 'publish_pages' ) ) {
     433                $msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' );
     434        }
    429435
    430436        echo "<div class='update-nag'>$msg</div>";
    431437}