]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/update-core.php
WordPress 4.7
[autoinstalls/wordpress.git] / wp-admin / update-core.php
index e123463bb0caa33695a80f855f4f9f56a08a8c92..c6c21ead5c410733d3046d831c11d7e95f9abce0 100644 (file)
@@ -26,16 +26,17 @@ if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes'
  *
  * @global string $wp_local_package
  * @global wpdb   $wpdb
- * @global string $wp_version
  *
  * @staticvar bool $first_pass
  *
  * @param object $update
  */
 function list_core_update( $update ) {
-       global $wp_local_package, $wpdb, $wp_version;
+       global $wp_local_package, $wpdb;
        static $first_pass = true;
 
+       $wp_version = get_bloginfo( 'version' );
+
        if ( 'en_US' == $update->locale && 'en_US' == get_locale() )
                $version_string = $update->current;
        // If the only available update is a partial builds, it doesn't need a language-specific version string.
@@ -53,11 +54,10 @@ function list_core_update( $update ) {
        $mysql_version  = $wpdb->db_version();
        $show_buttons = true;
        if ( 'development' == $update->response ) {
-               $message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:');
-               $download = __('Download nightly build');
+               $message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically:');
        } else {
                if ( $current ) {
-                       $message = sprintf( __( 'If you need to re-install version %s, you can do so here or download the package and re-install manually:' ), $version_string );
+                       $message = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string );
                        $submit = __('Re-install Now');
                        $form_action = 'update-core.php?action=do-core-reinstall';
                } else {
@@ -68,17 +68,20 @@ function list_core_update( $update ) {
                                $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
 
                        if ( !$mysql_compat && !$php_compat )
+                               /* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Minimum required MySQL version number, 4: Current PHP version number, 5: Current MySQL version number */
                                $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
                        elseif ( !$php_compat )
+                               /* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Current PHP version number */
                                $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
                        elseif ( !$mysql_compat )
+                               /* translators: 1: WordPress version number, 2: Minimum required MySQL version number, 3: Current MySQL version number */
                                $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
                        else
-                               $message =      sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
+                               /* translators: 1: WordPress version number, 2: WordPress version number including locale if necessary */
+                               $message =      sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically:'), $update->current, $version_string);
                        if ( !$mysql_compat || !$php_compat )
                                $show_buttons = false;
                }
-               $download = sprintf(__('Download %s'), $version_string);
        }
 
        echo '<p>';
@@ -91,18 +94,17 @@ function list_core_update( $update ) {
        echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
        if ( $show_buttons ) {
                if ( $first_pass ) {
-                       submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false );
+                       submit_button( $submit, $current ? '' : 'primary regular', 'upgrade', false );
                        $first_pass = false;
                } else {
-                       submit_button( $submit, 'button', 'upgrade', false );
+                       submit_button( $submit, '', 'upgrade', false );
                }
-               echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
        }
        if ( 'en_US' != $update->locale )
                if ( !isset( $update->dismissed ) || !$update->dismissed )
-                       submit_button( __('Hide this update'), 'button', 'dismiss', false );
+                       submit_button( __( 'Hide this update' ), '', 'dismiss', false );
                else
-                       submit_button( __('Bring back this update'), 'button', 'undismiss', false );
+                       submit_button( __( 'Bring back this update' ), '', 'undismiss', false );
        echo '</p>';
        if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
            echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
@@ -149,13 +151,13 @@ function dismissed_updates() {
  *
  * @since 2.7.0
  *
- * @global string $wp_version
  * @global string $required_php_version
  * @global string $required_mysql_version
  */
 function core_upgrade_preamble() {
-       global $wp_version, $required_php_version, $required_mysql_version;
+       global $required_php_version, $required_mysql_version;
 
+       $wp_version = get_bloginfo( 'version' );
        $updates = get_core_updates();
 
        if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
@@ -213,14 +215,9 @@ function core_upgrade_preamble() {
        dismissed_updates();
 }
 
-/**
- *
- * @global string $wp_version
- */
 function list_plugin_updates() {
-       global $wp_version;
-
-       $cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
+       $wp_version = get_bloginfo( 'version' );
+       $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version );
 
        require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
        $plugins = get_plugin_updates();
@@ -253,8 +250,6 @@ function list_plugin_updates() {
        <tbody class="plugins">
 <?php
        foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
-               $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
-
                // Get plugin compat for running version of WordPress.
                if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) {
                        $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
@@ -575,8 +570,8 @@ get_current_screen()->add_help_tab( array(
 
 get_current_screen()->set_help_sidebar(
        '<p><strong>' . __('For more information:') . '</strong></p>' .
-       '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' .
-       '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+       '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen">Documentation on Updating WordPress</a>' ) . '</p>' .
+       '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
 );
 
 if ( 'upgrade-core' == $action ) {
@@ -598,9 +593,16 @@ if ( 'upgrade-core' == $action ) {
                echo '</p></div>';
        }
 
+       $last_update_check = false;
+       $current = get_site_transient( 'update_core' );
+
+       if ( $current && isset ( $current->last_checked ) )     {
+               $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
+       }
+
        echo '<p>';
        /* translators: %1 date, %2 time. */
-       printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ) ), date_i18n( __( 'g:i a' ) ) );
+       printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a' ), $last_update_check ) );
        echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
        echo '</p>';
 
@@ -620,6 +622,11 @@ if ( 'upgrade-core' == $action ) {
         */
        do_action( 'core_upgrade_preamble' );
        echo '</div>';
+
+       wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
+               'totals'  => wp_get_update_data(),
+       ) );
+
        include(ABSPATH . 'wp-admin/admin-footer.php');
 
 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
@@ -644,6 +651,10 @@ if ( 'upgrade-core' == $action ) {
        if ( isset( $_POST['upgrade'] ) )
                do_core_upgrade($reinstall);
 
+       wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
+               'totals'  => wp_get_update_data(),
+       ) );
+
        include(ABSPATH . 'wp-admin/admin-footer.php');
 
 } elseif ( 'do-plugin-upgrade' == $action ) {
@@ -672,6 +683,11 @@ if ( 'upgrade-core' == $action ) {
        echo '<h1>' . __( 'Update Plugins' ) . '</h1>';
        echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>';
        echo '</div>';
+
+       wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
+               'totals'  => wp_get_update_data(),
+       ) );
+
        include(ABSPATH . 'wp-admin/admin-footer.php');
 
 } elseif ( 'do-theme-upgrade' == $action ) {
@@ -702,6 +718,11 @@ if ( 'upgrade-core' == $action ) {
                <iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe>
        </div>
        <?php
+
+       wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
+               'totals'  => wp_get_update_data(),
+       ) );
+
        include(ABSPATH . 'wp-admin/admin-footer.php');
 
 } elseif ( 'do-translation-upgrade' == $action ) {
@@ -722,6 +743,10 @@ if ( 'upgrade-core' == $action ) {
        $upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
        $result = $upgrader->bulk_upgrade();
 
+       wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
+               'totals'  => wp_get_update_data(),
+       ) );
+
        require_once( ABSPATH . 'wp-admin/admin-footer.php' );
 
 } else {