3 * Update Core administration panel.
6 * @subpackage Administration
9 /** WordPress Administration Bootstrap */
10 require_once( dirname( __FILE__ ) . '/admin.php' );
12 wp_enqueue_style( 'plugin-install' );
13 wp_enqueue_script( 'plugin-install' );
14 wp_enqueue_script( 'updates' );
17 if ( is_multisite() && ! is_network_admin() ) {
18 wp_redirect( network_admin_url( 'update-core.php' ) );
22 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
23 wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
27 * @global string $wp_local_package
29 * @global string $wp_version
31 * @staticvar bool $first_pass
33 * @param object $update
35 function list_core_update( $update ) {
36 global $wp_local_package, $wpdb, $wp_version;
37 static $first_pass = true;
39 if ( 'en_US' == $update->locale && 'en_US' == get_locale() )
40 $version_string = $update->current;
41 // If the only available update is a partial builds, it doesn't need a language-specific version string.
42 elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) )
43 $version_string = $update->current;
45 $version_string = sprintf( "%s–<strong>%s</strong>", $update->current, $update->locale );
48 if ( !isset($update->response) || 'latest' == $update->response )
50 $submit = __('Update Now');
51 $form_action = 'update-core.php?action=do-core-upgrade';
52 $php_version = phpversion();
53 $mysql_version = $wpdb->db_version();
55 if ( 'development' == $update->response ) {
56 $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:');
57 $download = __('Download nightly build');
60 $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 );
61 $submit = __('Re-install Now');
62 $form_action = 'update-core.php?action=do-core-reinstall';
64 $php_compat = version_compare( $php_version, $update->php_version, '>=' );
65 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
68 $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
70 if ( !$mysql_compat && !$php_compat )
71 $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 );
72 elseif ( !$php_compat )
73 $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 );
74 elseif ( !$mysql_compat )
75 $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 );
77 $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);
78 if ( !$mysql_compat || !$php_compat )
79 $show_buttons = false;
81 $download = sprintf(__('Download %s'), $version_string);
87 echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
88 wp_nonce_field('upgrade-core');
90 echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
91 echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
92 if ( $show_buttons ) {
94 submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false );
97 submit_button( $submit, 'button', 'upgrade', false );
99 echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> ';
101 if ( 'en_US' != $update->locale )
102 if ( !isset( $update->dismissed ) || !$update->dismissed )
103 submit_button( __('Hide this update'), 'button', 'dismiss', false );
105 submit_button( __('Bring back this update'), 'button', 'undismiss', false );
107 if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
108 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>';
109 // Partial builds don't need language-specific warnings.
110 elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
111 echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>';
120 function dismissed_updates() {
121 $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
124 $show_text = esc_js(__('Show hidden updates'));
125 $hide_text = esc_js(__('Hide hidden updates'));
127 <script type="text/javascript">
130 $('dismissed-updates').show();
131 $('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')});
132 $('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
136 echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
137 echo '<ul id="dismissed-updates" class="core-updates dismissed">';
138 foreach ( (array) $dismissed as $update) {
140 list_core_update( $update );
148 * Display upgrade WordPress for downloading latest or upgrading automatically form.
152 * @global string $wp_version
153 * @global string $required_php_version
154 * @global string $required_mysql_version
156 function core_upgrade_preamble() {
157 global $wp_version, $required_php_version, $required_mysql_version;
159 $updates = get_core_updates();
161 if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
163 _e('You have the latest version of WordPress.');
165 if ( wp_http_supports( array( 'ssl' ) ) ) {
166 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
167 $upgrader = new WP_Automatic_Updater;
168 $future_minor_update = (object) array(
169 'current' => $wp_version . '.1.next.minor',
170 'version' => $wp_version . '.1.next.minor',
171 'php_version' => $required_php_version,
172 'mysql_version' => $required_mysql_version,
174 $should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
175 if ( $should_auto_update )
176 echo ' ' . __( 'Future security updates will be applied automatically.' );
180 echo '<div class="notice notice-warning"><p>';
181 _e('<strong>Important:</strong> before updating, please <a href="https://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="https://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.');
184 echo '<h2 class="response">';
185 _e( 'An updated version of WordPress is available.' );
189 if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) {
190 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
191 $upgrader = new WP_Automatic_Updater;
192 if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) {
193 echo '<div class="updated inline"><p>';
194 echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' );
199 echo '<ul class="core-updates">';
200 foreach ( (array) $updates as $update ) {
202 list_core_update( $update );
206 // Don't show the maintenance mode notice when we are only showing a single re-install option.
207 if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {
208 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
209 } elseif ( ! $updates ) {
210 list( $normalized_version ) = explode( '-', $wp_version );
211 echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
218 * @global string $wp_version
220 function list_plugin_updates() {
223 $cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
225 require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
226 $plugins = get_plugin_updates();
227 if ( empty( $plugins ) ) {
228 echo '<h2>' . __( 'Plugins' ) . '</h2>';
229 echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
232 $form_action = 'update-core.php?action=do-plugin-upgrade';
234 $core_updates = get_core_updates();
235 if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
236 $core_update_version = false;
238 $core_update_version = $core_updates[0]->current;
240 <h2><?php _e( 'Plugins' ); ?></h2>
241 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p>
242 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
243 <?php wp_nonce_field('upgrade-core'); ?>
244 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
245 <table class="widefat updates-table" id="update-plugins-table">
248 <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
249 <td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td>
253 <tbody class="plugins">
255 foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
256 // Get plugin compat for running version of WordPress.
257 if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) {
258 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
259 } elseif ( isset($plugin_data->update->compatibility->{$cur_wp_version}) ) {
260 $compat = $plugin_data->update->compatibility->{$cur_wp_version};
261 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes);
263 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
265 // Get plugin compat for updated version of WordPress.
266 if ( $core_update_version ) {
267 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
268 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version );
269 } elseif ( isset( $plugin_data->update->compatibility->{$core_update_version} ) ) {
270 $update_compat = $plugin_data->update->compatibility->{$core_update_version};
271 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes);
273 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
276 // Get the upgrade notice for the new plugin version.
277 if ( isset($plugin_data->update->upgrade_notice) ) {
278 $upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
280 $upgrade_notice = '';
283 $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662');
285 '<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
286 esc_url( $details_url ),
287 /* translators: 1: plugin name, 2: version number */
288 esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ),
289 /* translators: %s: plugin version */
290 sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version )
293 $checkbox_id = "checkbox_" . md5( $plugin_data->Name );
296 <td class="check-column">
297 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
298 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
299 /* translators: %s: plugin name */
300 printf( __( 'Select %s' ),
305 <td class="plugin-title"><p>
306 <strong><?php echo $plugin_data->Name; ?></strong>
308 /* translators: 1: plugin version, 2: new version */
309 printf( __( 'You have version %1$s installed. Update to %2$s.' ),
310 $plugin_data->Version,
311 $plugin_data->update->new_version
313 echo ' ' . $details . $compat . $upgrade_notice;
324 <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
325 <td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td>
329 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
337 function list_theme_updates() {
338 $themes = get_theme_updates();
339 if ( empty( $themes ) ) {
340 echo '<h2>' . __( 'Themes' ) . '</h2>';
341 echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
345 $form_action = 'update-core.php?action=do-theme-upgrade';
347 <h2><?php _e( 'Themes' ); ?></h2>
348 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p>
349 <p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p>
350 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
351 <?php wp_nonce_field('upgrade-core'); ?>
352 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
353 <table class="widefat updates-table" id="update-themes-table">
356 <td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
357 <td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>
361 <tbody class="plugins">
363 foreach ( $themes as $stylesheet => $theme ) {
364 $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
367 <td class="check-column">
368 <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
369 <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
370 /* translators: %s: theme name */
371 printf( __( 'Select %s' ),
372 $theme->display( 'Name' )
376 <td class="plugin-title"><p>
377 <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
378 <strong><?php echo $theme->display( 'Name' ); ?></strong>
380 /* translators: 1: theme version, 2: new version */
381 printf( __( 'You have version %1$s installed. Update to %2$s.' ),
382 $theme->display( 'Version' ),
383 $theme->update['new_version']
395 <td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
396 <td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td>
400 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
408 function list_translation_updates() {
409 $updates = wp_get_translation_updates();
411 if ( 'en_US' != get_locale() ) {
412 echo '<h2>' . __( 'Translations' ) . '</h2>';
413 echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
418 $form_action = 'update-core.php?action=do-translation-upgrade';
420 <h2><?php _e( 'Translations' ); ?></h2>
421 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
422 <p><?php _e( 'New translations are available.' ); ?></p>
423 <?php wp_nonce_field( 'upgrade-translations' ); ?>
424 <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
430 * Upgrade WordPress core display.
434 * @global WP_Filesystem_Base $wp_filesystem Subclass
436 * @param bool $reinstall
438 function do_core_upgrade( $reinstall = false ) {
439 global $wp_filesystem;
441 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
444 $url = 'update-core.php?action=do-core-reinstall';
446 $url = 'update-core.php?action=do-core-upgrade';
447 $url = wp_nonce_url($url, 'upgrade-core');
449 $version = isset( $_POST['version'] )? $_POST['version'] : false;
450 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
451 $update = find_core_update( $version, $locale );
455 // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
456 // that it's safe to do so. This only happens when there are no new files to create.
457 $allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
461 <h1><?php _e( 'Update WordPress' ); ?></h1>
464 if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {
469 if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
470 // Failed to connect, Error and request again
471 request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
476 if ( $wp_filesystem->errors->get_error_code() ) {
477 foreach ( $wp_filesystem->errors->get_error_messages() as $message )
478 show_message($message);
484 $update->response = 'reinstall';
486 add_filter( 'update_feedback', 'show_message' );
488 $upgrader = new Core_Upgrader();
489 $result = $upgrader->upgrade( $update, array(
490 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership
493 if ( is_wp_error($result) ) {
494 show_message($result);
495 if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() )
496 show_message( __('Installation Failed') );
501 show_message( __('WordPress updated successfully') );
502 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="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
503 show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
506 <script type="text/javascript">
507 window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
515 function do_dismiss_core_update() {
516 $version = isset( $_POST['version'] )? $_POST['version'] : false;
517 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
518 $update = find_core_update( $version, $locale );
521 dismiss_core_update( $update );
522 wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
529 function do_undismiss_core_update() {
530 $version = isset( $_POST['version'] )? $_POST['version'] : false;
531 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
532 $update = find_core_update( $version, $locale );
535 undismiss_core_update( $version, $locale );
536 wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
540 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
542 $upgrade_error = false;
543 if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
544 && ! isset( $_POST['checked'] ) ) {
545 $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
546 $action = 'upgrade-core';
549 $title = __('WordPress Updates');
550 $parent_file = 'index.php';
552 $updates_overview = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>';
553 $updates_overview .= '<p>' . __( 'If an update is available, you᾿ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>';
555 get_current_screen()->add_help_tab( array(
557 'title' => __( 'Overview' ),
558 'content' => $updates_overview
561 $updates_howto = '<p>' . __( '<strong>WordPress</strong> — Updating your WordPress installation is a simple one-click procedure: just <strong>click on the “Update Now” button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>';
562 $updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> — To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate “Update” button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>';
564 if ( 'en_US' != get_locale() ) {
565 $updates_howto .= '<p>' . __( '<strong>Translations</strong> — The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.' ) . '</p>';
568 get_current_screen()->add_help_tab( array(
569 'id' => 'how-to-update',
570 'title' => __( 'How to Update' ),
571 'content' => $updates_howto
574 get_current_screen()->set_help_sidebar(
575 '<p><strong>' . __('For more information:') . '</strong></p>' .
576 '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' .
577 '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
580 if ( 'upgrade-core' == $action ) {
581 // Force a update check when requested
582 $force_check = ! empty( $_GET['force-check'] );
583 wp_version_check( array(), $force_check );
585 require_once(ABSPATH . 'wp-admin/admin-header.php');
588 <h1><?php _e( 'WordPress Updates' ); ?></h1>
590 if ( $upgrade_error ) {
591 echo '<div class="error"><p>';
592 if ( $upgrade_error == 'themes' )
593 _e('Please select one or more themes to update.');
595 _e('Please select one or more plugins to update.');
600 /* translators: %1 date, %2 time. */
601 printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ) ), date_i18n( __( 'g:i a' ) ) );
602 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
605 if ( $core = current_user_can( 'update_core' ) )
606 core_upgrade_preamble();
607 if ( $plugins = current_user_can( 'update_plugins' ) )
608 list_plugin_updates();
609 if ( $themes = current_user_can( 'update_themes' ) )
610 list_theme_updates();
611 if ( $core || $plugins || $themes )
612 list_translation_updates();
613 unset( $core, $plugins, $themes );
615 * Fires after the core, plugin, and theme update tables.
619 do_action( 'core_upgrade_preamble' );
621 include(ABSPATH . 'wp-admin/admin-footer.php');
623 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
625 if ( ! current_user_can( 'update_core' ) )
626 wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
628 check_admin_referer('upgrade-core');
630 // Do the (un)dismiss actions before headers, so that they can redirect.
631 if ( isset( $_POST['dismiss'] ) )
632 do_dismiss_core_update();
633 elseif ( isset( $_POST['undismiss'] ) )
634 do_undismiss_core_update();
636 require_once(ABSPATH . 'wp-admin/admin-header.php');
637 if ( 'do-core-reinstall' == $action )
642 if ( isset( $_POST['upgrade'] ) )
643 do_core_upgrade($reinstall);
645 include(ABSPATH . 'wp-admin/admin-footer.php');
647 } elseif ( 'do-plugin-upgrade' == $action ) {
649 if ( ! current_user_can( 'update_plugins' ) )
650 wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
652 check_admin_referer('upgrade-core');
654 if ( isset( $_GET['plugins'] ) ) {
655 $plugins = explode( ',', $_GET['plugins'] );
656 } elseif ( isset( $_POST['checked'] ) ) {
657 $plugins = (array) $_POST['checked'];
659 wp_redirect( admin_url('update-core.php') );
663 $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
664 $url = wp_nonce_url($url, 'bulk-update-plugins');
666 $title = __('Update Plugins');
668 require_once(ABSPATH . 'wp-admin/admin-header.php');
669 echo '<div class="wrap">';
670 echo '<h1>' . __( 'Update Plugins' ) . '</h1>';
671 echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>';
673 include(ABSPATH . 'wp-admin/admin-footer.php');
675 } elseif ( 'do-theme-upgrade' == $action ) {
677 if ( ! current_user_can( 'update_themes' ) )
678 wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
680 check_admin_referer('upgrade-core');
682 if ( isset( $_GET['themes'] ) ) {
683 $themes = explode( ',', $_GET['themes'] );
684 } elseif ( isset( $_POST['checked'] ) ) {
685 $themes = (array) $_POST['checked'];
687 wp_redirect( admin_url('update-core.php') );
691 $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
692 $url = wp_nonce_url($url, 'bulk-update-themes');
694 $title = __('Update Themes');
696 require_once(ABSPATH . 'wp-admin/admin-header.php');
699 <h1><?php _e( 'Update Themes' ); ?></h1>
700 <iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe>
703 include(ABSPATH . 'wp-admin/admin-footer.php');
705 } elseif ( 'do-translation-upgrade' == $action ) {
707 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )
708 wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
710 check_admin_referer( 'upgrade-translations' );
712 require_once( ABSPATH . 'wp-admin/admin-header.php' );
713 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
715 $url = 'update-core.php?action=do-translation-upgrade';
716 $nonce = 'upgrade-translations';
717 $title = __( 'Update Translations' );
718 $context = WP_LANG_DIR;
720 $upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
721 $result = $upgrader->bulk_upgrade();
723 require_once( ABSPATH . 'wp-admin/admin-footer.php' );
727 * Fires for each custom update action on the WordPress Updates screen.
729 * The dynamic portion of the hook name, `$action`, refers to the
730 * passed update action. The hook fires in lieu of all available
731 * default update actions.
735 do_action( "update-core-custom_{$action}" );