WordPress.org

Make WordPress Core

Ticket #18467: 18467.2.diff

File 18467.2.diff, 5.6 KB (added by nacin, 2 years ago)

Fixes bad sprintf().

  • wp-admin/includes/class-wp-upgrader.php

     
    975975                $working_dir = $this->unpack_package( $download ); 
    976976                if ( is_wp_error($working_dir) ) 
    977977                        return $working_dir; 
    978  
     978/* 
    979979                // Copy update-core.php from the new version into place. 
    980980                if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) { 
    981981                        $wp_filesystem->delete($working_dir, true); 
    982982                        return new WP_Error('copy_failed', $this->strings['copy_failed']); 
    983983                } 
    984984                $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE); 
    985  
     985*/ 
    986986                require(ABSPATH . 'wp-admin/includes/update-core.php'); 
    987987 
    988988                return update_core($working_dir, $wp_dir); 
  • wp-admin/includes/update-core.php

     
    374374        $maintenance_file = $to . '.maintenance'; 
    375375        $wp_filesystem->delete($maintenance_file); 
    376376        $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); 
    377  
     377        $result = true; 
     378/* 
    378379        // Copy new versions of WP files into place. 
    379380        $result = _copy_dir($from . $distro, $to, array('wp-content') ); 
    380  
     381*/ 
    381382        // Custom Content Directory needs updating now. 
    382383        // Copy Languages 
    383384        if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) { 
     
    465466 
    466467        // Remove maintenance file, we're done. 
    467468        $wp_filesystem->delete($maintenance_file); 
     469 
     470        // If we made it this far: 
     471        do_action( '_core_updated_successfully', $wp_version ); 
     472 
     473        return $wp_version; 
    468474} 
    469475 
    470476/** 
     
    525531/** 
    526532 * Redirect to the About WordPress page after a successful upgrade. 
    527533 * 
    528  * This is a temporary function for the 3.3 upgrade only and will be removed in a later version. 
    529  *  
     534 * This function is only needed when the existing install is older than 3.3.0. 
     535 * 
    530536 * @since 3.3.0 
    531537 * 
    532538 */ 
    533 function _redirect_to_about_wordpress() { 
    534         // Only for WP version < 3.3.0 
    535         if ( version_compare( $GLOBALS['wp_version'], '3.3.0', '>' ) ) 
    536                 return; 
    537 ?> 
     539function _redirect_to_about_wordpress( $wp_version ) { 
     540        // Load the updated default text localization domain for new strings 
     541        load_default_textdomain(); 
     542 
     543        // See do_core_upgrade() 
     544        show_message( __('WordPress updated successfully') ); 
     545        show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%s">here</a>.' ), $wp_version, esc_url( admin_url( 'about.php?updated' ) ) ) . '</span>' ); 
     546        show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $wp_version, esc_url( admin_url( 'about.php?updated' ) ) ) . '</span>' ); 
     547        echo '</div>'; 
     548        ?> 
    538549<script type="text/javascript"> 
    539 window.location = '<?php echo admin_url( 'about.php?upgraded' ); ?>'; 
     550//window.location = '<?php echo admin_url( 'about.php?updated' ); ?>'; 
    540551</script> 
    541 <?php 
     552        <?php 
     553 
     554        // Include admin-footer.php and exit 
     555        include(ABSPATH . 'wp-admin/admin-footer.php'); 
     556        exit(); 
    542557} 
    543  
    544 add_action( 'admin_footer-update-core.php', '_redirect_to_about_wordpress' ); 
    545 ?> 
     558if ( version_compare( $GLOBALS['wp_version'], '3.3', '<' ) ) 
     559        add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' ); 
  • wp-admin/update-core.php

     
    378378                show_message($result); 
    379379                if ('up_to_date' != $result->get_error_code() ) 
    380380                        show_message( __('Installation Failed') ); 
    381         } else { 
    382                 show_message( __('WordPress updated successfully') ); 
    383                 show_message( '<a href="' . esc_url( self_admin_url() ) . '">' . __('Go to Dashboard') . '</a>' ); 
     381                echo '</div>'; 
     382                return; 
    384383        } 
    385         echo '</div>'; 
     384 
     385        show_message( __('WordPress updated successfully') ); 
     386        $message = '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( admin_url( 'about.php?updated' ) ) ) . '</span>'; 
     387        $message .= '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a> to learn more.' ), $result, esc_url( admin_url( 'about.php?updated' ) ) ) . '</span>'; 
     388        show_message( $message ); 
     389        ?> 
     390        </div> 
     391        <script type="text/javascript"> 
     392        //window.location = '<?php echo admin_url( 'about.php?upgraded' ); ?>'; 
     393        </script> 
     394        <?php 
    386395} 
    387396 
    388397function do_dismiss_core_update() { 
  • wp-admin/about.php

     
    160160</div> 
    161161 
    162162<div class="return-to-dashboard"> 
    163         <?php if ( current_user_can( 'update_core' ) && isset( $_GET['upgraded'] ) ) : ?> 
     163        <?php 
     164        if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : 
     165                if ( is_multisite() ) : ?> 
     166        <a href="<?php echo esc_url( network_admin_url( 'update-core.php' ) ); ?>"><?php _e( 'Return to Updates' ); ?></a> | 
     167        <?php else : ?> 
    164168        <a href="<?php echo esc_url( admin_url( 'update-core.php' ) ); ?>"><?php _e( 'Return to Dashboard &rarr; Updates' ); ?></a> | 
    165         <?php endif; ?> 
     169        <?php 
     170                endif; 
     171        endif; 
     172        ?> 
    166173        <a href="<?php echo esc_url( admin_url() ); ?>"><?php _e( 'Go to Dashboard &rarr; Home' ); ?></a> 
    167174</div> 
    168175