WordPress.org

Make WordPress Core

Ticket #15162: 15162.diff

File 15162.diff, 6.9 KB (added by PeteMall, 5 years ago)

Add update-core to network admin.

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

     
    10371037 
    10381038                $update_actions =  array( 
    10391039                        'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>', 
    1040                         'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>' 
     1040                        'plugins_page' => '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>' 
    10411041                ); 
    10421042                if ( $this->plugin_active ) 
    10431043                        unset( $update_actions['activate_plugin'] ); 
     
    11951195        function bulk_footer() { 
    11961196                parent::bulk_footer(); 
    11971197                $update_actions =  array( 
    1198                         'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>', 
    1199                         'updates_page' => '<a href="' . admin_url('update-core.php') . '" title="' . esc_attr__('Go to WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>' 
     1198                        'plugins_page' => '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>', 
     1199                        'updates_page' => '<a href="' . self_admin_url('update-core.php') . '" title="' . esc_attr__('Go to WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>' 
    12001200                ); 
    12011201 
    12021202                $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info); 
  • wp-admin/network/menu.php

     
    11<?php 
    22 
    33/* translators: Network menu item */ 
    4 $menu[0] = array(__('Dashboard'), 'manage_network', 'index.php', '', 'menu-top menu-top-first menu-icon-site', 'menu-site', 'div'); 
     4$menu[0] = array(__('Dashboard'), 'manage_network', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'div'); 
    55 
    66$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); 
    77 
     
    1010$menu[10] = array(__('Users'), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div'); 
    1111$menu[15] = array(__('Themes'), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div'); 
    1212 
    13 $plugin_update_count = 0;  
     13$plugin_update_count = $theme_update_count = $wordpress_update_count = 0; 
    1414$update_plugins = get_site_transient( 'update_plugins' );  
    1515if ( !empty($update_plugins->response) )  
    1616        $plugin_update_count = count( $update_plugins->response );  
     
    2121 
    2222 
    2323$menu[25] = array(__('Settings'), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div'); 
    24 $menu[30] = array(__('Update'), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div'); 
    2524 
     25$update_themes = get_site_transient( 'update_themes' ); 
     26if ( !empty($update_themes->response) ) 
     27        $theme_update_count = count( $update_themes->response ); 
     28$update_wordpress = get_core_updates( array('dismissed' => false) ); 
     29if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) 
     30        $wordpress_update_count = 1; 
     31 
     32$update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count; 
     33$update_title = array(); 
     34if ( $wordpress_update_count ) 
     35        $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count); 
     36if ( $plugin_update_count ) 
     37        $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count); 
     38if ( $theme_update_count ) 
     39        $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count); 
     40 
     41$update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; 
     42 
     43$menu[30] = array(sprintf( __('Update %s'), "<span class='update-plugins count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div'); 
     44$submenu[ 'upgrade.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'install_plugins',  'update-core.php'); 
     45$submenu[ 'upgrade.php' ][15] = array( __( 'Update Network' ), 'manage_network', 'upgrade.php' ); 
     46unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress); 
     47 
     48 
    2649$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' ); 
    2750 
    2851$submenu['themes.php'][5]  = array( __('Themes'), 'manage_network_themes', 'themes.php' ); 
  • wp-admin/update-core.php

     
    392392 
    393393if ( 'upgrade-core' == $action ) { 
    394394        wp_version_check(); 
    395         require_once('./admin-header.php'); 
     395        require_once(ABSPATH . 'wp-admin/admin-header.php'); 
    396396        core_upgrade_preamble(); 
    397397} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { 
    398398        check_admin_referer('upgrade-core'); 
     
    404404        elseif ( isset( $_POST['undismiss'] ) ) 
    405405                do_undismiss_core_update(); 
    406406 
    407         require_once('./admin-header.php'); 
     407        require_once(ABSPATH . 'wp-admin/admin-header.php'); 
    408408        if ( 'do-core-reinstall' == $action ) 
    409409                $reinstall = true; 
    410410        else 
     
    430430 
    431431        $title = __('Update Plugins'); 
    432432 
    433         require_once('./admin-header.php'); 
     433        require_once(ABSPATH . 'wp-admin/admin-header.php'); 
    434434        echo '<div class="wrap">'; 
    435435        screen_icon('plugins'); 
    436436        echo '<h2>' . esc_html__('Update Plugins') . '</h2>'; 
     
    453453 
    454454        $title = __('Update Themes'); 
    455455 
    456         require_once('./admin-header.php'); 
     456        require_once(ABSPATH . 'wp-admin/admin-header.php'); 
    457457        echo '<div class="wrap">'; 
    458458        screen_icon('themes'); 
    459459        echo '<h2>' . esc_html__('Update Themes') . '</h2>'; 
     
    461461        echo '</div>'; 
    462462} 
    463463 
    464 include('./admin-footer.php'); 
     464include(ABSPATH . 'wp-admin/admin-footer.php'); 
  • wp-admin/network/update-core.php

     
     1<?php 
     2 
     3require_once( './admin.php' ); 
     4 
     5require( '../update-core.php' );