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( __( 'You do not have sufficient permissions 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 '<h3 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 '<h3>' . __( 'Plugins' ) . '</h3>';
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 <h3><?php _e( 'Plugins' ); ?></h3>
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" id="update-plugins-table">
248 <td scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
249 <th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th>
253 <tbody class="plugins">
255 foreach ( (array) $plugins as $plugin_file => $plugin_data) {
256 $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
257 if ( is_wp_error( $info ) ) {
261 // Get plugin compat for running version of WordPress.
262 if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) {
263 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
264 } elseif ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) {
265 $compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version];
266 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]);
268 $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
270 // Get plugin compat for updated version of WordPress.
271 if ( $core_update_version ) {
272 if ( isset($info->compatibility[$core_update_version][$plugin_data->update->new_version]) ) {
273 $update_compat = $info->compatibility[$core_update_version][$plugin_data->update->new_version];
274 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]);
276 $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
279 // Get the upgrade notice for the new plugin version.
280 if ( isset($plugin_data->update->upgrade_notice) ) {
281 $upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
283 $upgrade_notice = '';
286 $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');
287 $details_text = sprintf(__('View version %1$s details'), $plugin_data->update->new_version);
288 $details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>.', esc_url($details_url), esc_attr($plugin_data->Name), $details_text);
292 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
293 <td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td>
301 <td scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
302 <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></th>
306 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
314 function list_theme_updates() {
315 $themes = get_theme_updates();
316 if ( empty( $themes ) ) {
317 echo '<h3>' . __( 'Themes' ) . '</h3>';
318 echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
322 $form_action = 'update-core.php?action=do-theme-upgrade';
324 <h3><?php _e( 'Themes' ); ?></h3>
325 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p>
326 <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>
327 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
328 <?php wp_nonce_field('upgrade-core'); ?>
329 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
330 <table class="widefat" id="update-themes-table">
333 <td scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
334 <th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th>
338 <tbody class="plugins">
340 foreach ( $themes as $stylesheet => $theme ) {
343 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th>
344 <td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td>
352 <td scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
353 <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></th>
357 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
365 function list_translation_updates() {
366 $updates = wp_get_translation_updates();
368 if ( 'en_US' != get_locale() ) {
369 echo '<h3>' . __( 'Translations' ) . '</h3>';
370 echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
375 $form_action = 'update-core.php?action=do-translation-upgrade';
377 <h3><?php _e( 'Translations' ); ?></h3>
378 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
379 <p><?php _e( 'New translations are available.' ); ?></p>
380 <?php wp_nonce_field( 'upgrade-translations' ); ?>
381 <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
387 * Upgrade WordPress core display.
391 * @global WP_Filesystem_Base $wp_filesystem Subclass
393 * @param bool $reinstall
395 function do_core_upgrade( $reinstall = false ) {
396 global $wp_filesystem;
398 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
401 $url = 'update-core.php?action=do-core-reinstall';
403 $url = 'update-core.php?action=do-core-upgrade';
404 $url = wp_nonce_url($url, 'upgrade-core');
406 $version = isset( $_POST['version'] )? $_POST['version'] : false;
407 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
408 $update = find_core_update( $version, $locale );
412 // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
413 // that it's safe to do so. This only happens when there are no new files to create.
414 $allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
418 <h1><?php _e( 'Update WordPress' ); ?></h1>
421 if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {
426 if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
427 // Failed to connect, Error and request again
428 request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
433 if ( $wp_filesystem->errors->get_error_code() ) {
434 foreach ( $wp_filesystem->errors->get_error_messages() as $message )
435 show_message($message);
441 $update->response = 'reinstall';
443 add_filter( 'update_feedback', 'show_message' );
445 $upgrader = new Core_Upgrader();
446 $result = $upgrader->upgrade( $update, array(
447 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership
450 if ( is_wp_error($result) ) {
451 show_message($result);
452 if ('up_to_date' != $result->get_error_code() )
453 show_message( __('Installation Failed') );
458 show_message( __('WordPress updated successfully') );
459 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>' );
460 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>' );
463 <script type="text/javascript">
464 window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
472 function do_dismiss_core_update() {
473 $version = isset( $_POST['version'] )? $_POST['version'] : false;
474 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
475 $update = find_core_update( $version, $locale );
478 dismiss_core_update( $update );
479 wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
486 function do_undismiss_core_update() {
487 $version = isset( $_POST['version'] )? $_POST['version'] : false;
488 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
489 $update = find_core_update( $version, $locale );
492 undismiss_core_update( $version, $locale );
493 wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
497 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
499 $upgrade_error = false;
500 if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
501 && ! isset( $_POST['checked'] ) ) {
502 $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
503 $action = 'upgrade-core';
506 $title = __('WordPress Updates');
507 $parent_file = 'index.php';
509 $updates_overview = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes and plugins from the WordPress.org repositories.' ) . '</p>';
510 $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>';
512 get_current_screen()->add_help_tab( array(
514 'title' => __( 'Overview' ),
515 'content' => $updates_overview
518 $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>';
519 $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>';
521 if ( 'en_US' != get_locale() ) {
522 $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>';
525 get_current_screen()->add_help_tab( array(
526 'id' => 'how-to-update',
527 'title' => __( 'How to Update' ),
528 'content' => $updates_howto
531 get_current_screen()->set_help_sidebar(
532 '<p><strong>' . __('For more information:') . '</strong></p>' .
533 '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' .
534 '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
537 if ( 'upgrade-core' == $action ) {
538 // Force a update check when requested
539 $force_check = ! empty( $_GET['force-check'] );
540 wp_version_check( array(), $force_check );
542 require_once(ABSPATH . 'wp-admin/admin-header.php');
545 <h1><?php _e( 'WordPress Updates' ); ?></h1>
547 if ( $upgrade_error ) {
548 echo '<div class="error"><p>';
549 if ( $upgrade_error == 'themes' )
550 _e('Please select one or more themes to update.');
552 _e('Please select one or more plugins to update.');
557 /* translators: %1 date, %2 time. */
558 printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) );
559 echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
562 if ( $core = current_user_can( 'update_core' ) )
563 core_upgrade_preamble();
564 if ( $plugins = current_user_can( 'update_plugins' ) )
565 list_plugin_updates();
566 if ( $themes = current_user_can( 'update_themes' ) )
567 list_theme_updates();
568 if ( $core || $plugins || $themes )
569 list_translation_updates();
570 unset( $core, $plugins, $themes );
572 * Fires after the core, plugin, and theme update tables.
576 do_action( 'core_upgrade_preamble' );
578 include(ABSPATH . 'wp-admin/admin-footer.php');
580 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
582 if ( ! current_user_can( 'update_core' ) )
583 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
585 check_admin_referer('upgrade-core');
587 // Do the (un)dismiss actions before headers, so that they can redirect.
588 if ( isset( $_POST['dismiss'] ) )
589 do_dismiss_core_update();
590 elseif ( isset( $_POST['undismiss'] ) )
591 do_undismiss_core_update();
593 require_once(ABSPATH . 'wp-admin/admin-header.php');
594 if ( 'do-core-reinstall' == $action )
599 if ( isset( $_POST['upgrade'] ) )
600 do_core_upgrade($reinstall);
602 include(ABSPATH . 'wp-admin/admin-footer.php');
604 } elseif ( 'do-plugin-upgrade' == $action ) {
606 if ( ! current_user_can( 'update_plugins' ) )
607 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
609 check_admin_referer('upgrade-core');
611 if ( isset( $_GET['plugins'] ) ) {
612 $plugins = explode( ',', $_GET['plugins'] );
613 } elseif ( isset( $_POST['checked'] ) ) {
614 $plugins = (array) $_POST['checked'];
616 wp_redirect( admin_url('update-core.php') );
620 $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
621 $url = wp_nonce_url($url, 'bulk-update-plugins');
623 $title = __('Update Plugins');
625 require_once(ABSPATH . 'wp-admin/admin-header.php');
626 echo '<div class="wrap">';
627 echo '<h1>' . __( 'Update Plugins' ) . '</h1>';
628 echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0"></iframe>';
630 include(ABSPATH . 'wp-admin/admin-footer.php');
632 } elseif ( 'do-theme-upgrade' == $action ) {
634 if ( ! current_user_can( 'update_themes' ) )
635 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
637 check_admin_referer('upgrade-core');
639 if ( isset( $_GET['themes'] ) ) {
640 $themes = explode( ',', $_GET['themes'] );
641 } elseif ( isset( $_POST['checked'] ) ) {
642 $themes = (array) $_POST['checked'];
644 wp_redirect( admin_url('update-core.php') );
648 $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
649 $url = wp_nonce_url($url, 'bulk-update-themes');
651 $title = __('Update Themes');
653 require_once(ABSPATH . 'wp-admin/admin-header.php');
656 <h1><?php _e( 'Update Themes' ); ?></h1>
657 <iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0"></iframe>
660 include(ABSPATH . 'wp-admin/admin-footer.php');
662 } elseif ( 'do-translation-upgrade' == $action ) {
664 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )
665 wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
667 check_admin_referer( 'upgrade-translations' );
669 require_once( ABSPATH . 'wp-admin/admin-header.php' );
670 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
672 $url = 'update-core.php?action=do-translation-upgrade';
673 $nonce = 'upgrade-translations';
674 $title = __( 'Update Translations' );
675 $context = WP_LANG_DIR;
677 $upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
678 $result = $upgrader->bulk_upgrade();
680 require_once( ABSPATH . 'wp-admin/admin-footer.php' );
684 * Fires for each custom update action on the WordPress Updates screen.
686 * The dynamic portion of the hook name, `$action`, refers to the
687 * passed update action. The hook fires in lieu of all available
688 * default update actions.
692 do_action( "update-core-custom_{$action}" );