52 |
52 |
53 $current = false; |
53 $current = false; |
54 if ( ! isset( $update->response ) || 'latest' === $update->response ) { |
54 if ( ! isset( $update->response ) || 'latest' === $update->response ) { |
55 $current = true; |
55 $current = true; |
56 } |
56 } |
57 $submit = __( 'Update Now' ); |
57 |
|
58 $message = ''; |
58 $form_action = 'update-core.php?action=do-core-upgrade'; |
59 $form_action = 'update-core.php?action=do-core-upgrade'; |
59 $php_version = phpversion(); |
60 $php_version = phpversion(); |
60 $mysql_version = $wpdb->db_version(); |
61 $mysql_version = $wpdb->db_version(); |
61 $show_buttons = true; |
62 $show_buttons = true; |
|
63 |
|
64 // Nightly build versions have two hyphens and a commit number. |
|
65 if ( preg_match( '/-\w+-\d+/', $update->current ) ) { |
|
66 // Retrieve the major version number. |
|
67 preg_match( '/^\d+.\d+/', $update->current, $update_major ); |
|
68 /* translators: %s: WordPress version. */ |
|
69 $submit = sprintf( __( 'Update to latest %s nightly' ), $update_major[0] ); |
|
70 } else { |
|
71 /* translators: %s: WordPress version. */ |
|
72 $submit = sprintf( __( 'Update to version %s' ), $version_string ); |
|
73 } |
|
74 |
62 if ( 'development' === $update->response ) { |
75 if ( 'development' === $update->response ) { |
63 $message = __( 'You are using a development version of WordPress. You can update to the latest nightly build automatically:' ); |
76 $message = __( 'You can update to the latest nightly build manually:' ); |
64 } else { |
77 } else { |
65 if ( $current ) { |
78 if ( $current ) { |
66 /* translators: %s: WordPress version. */ |
79 /* translators: %s: WordPress version. */ |
67 $message = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string ); |
80 $submit = sprintf( __( 'Re-install version %s' ), $version_string ); |
68 $submit = __( 'Re-install Now' ); |
|
69 $form_action = 'update-core.php?action=do-core-reinstall'; |
81 $form_action = 'update-core.php?action=do-core-reinstall'; |
70 } else { |
82 } else { |
71 $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
83 $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
72 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
84 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
73 $mysql_compat = true; |
85 $mysql_compat = true; |
122 $update->mysql_version, |
134 $update->mysql_version, |
123 $mysql_version |
135 $mysql_version |
124 ); |
136 ); |
125 } else { |
137 } else { |
126 $message = sprintf( |
138 $message = sprintf( |
127 /* translators: 1: URL to WordPress release notes, 2: WordPress version number including locale if necessary. */ |
139 /* translators: 1: Installed WordPress version number, 2: URL to WordPress release notes, 3: New WordPress version number, including locale if necessary. */ |
128 __( 'You can update to <a href="%1$s">WordPress %2$s</a> automatically:' ), |
140 __( 'You can update from WordPress %1$s to <a href="%2$s">WordPress %3$s</a> manually:' ), |
|
141 $wp_version, |
129 $version_url, |
142 $version_url, |
130 $version_string |
143 $version_string |
131 ); |
144 ); |
132 } |
145 } |
|
146 |
133 if ( ! $mysql_compat || ! $php_compat ) { |
147 if ( ! $mysql_compat || ! $php_compat ) { |
134 $show_buttons = false; |
148 $show_buttons = false; |
135 } |
149 } |
136 } |
150 } |
137 } |
151 } |
138 |
152 |
139 echo '<p>'; |
153 echo '<p>'; |
140 echo $message; |
154 echo $message; |
141 echo '</p>'; |
155 echo '</p>'; |
|
156 |
142 echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">'; |
157 echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">'; |
143 wp_nonce_field( 'upgrade-core' ); |
158 wp_nonce_field( 'upgrade-core' ); |
|
159 |
144 echo '<p>'; |
160 echo '<p>'; |
145 echo '<input name="version" value="' . esc_attr( $update->current ) . '" type="hidden"/>'; |
161 echo '<input name="version" value="' . esc_attr( $update->current ) . '" type="hidden" />'; |
146 echo '<input name="locale" value="' . esc_attr( $update->locale ) . '" type="hidden"/>'; |
162 echo '<input name="locale" value="' . esc_attr( $update->locale ) . '" type="hidden" />'; |
147 if ( $show_buttons ) { |
163 if ( $show_buttons ) { |
148 if ( $first_pass ) { |
164 if ( $first_pass ) { |
149 submit_button( $submit, $current ? '' : 'primary regular', 'upgrade', false ); |
165 submit_button( $submit, $current ? '' : 'primary regular', 'upgrade', false ); |
150 $first_pass = false; |
166 $first_pass = false; |
151 } else { |
167 } else { |
158 } else { |
174 } else { |
159 submit_button( __( 'Bring back this update' ), '', 'undismiss', false ); |
175 submit_button( __( 'Bring back this update' ), '', 'undismiss', false ); |
160 } |
176 } |
161 } |
177 } |
162 echo '</p>'; |
178 echo '</p>'; |
|
179 |
163 if ( 'en_US' !== $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package != $update->locale ) ) { |
180 if ( 'en_US' !== $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package != $update->locale ) ) { |
164 echo '<p class="hint">' . __( 'This localized version contains both the translation and various other localization fixes.' ) . '</p>'; |
181 echo '<p class="hint">' . __( 'This localized version contains both the translation and various other localization fixes.' ) . '</p>'; |
165 } elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
182 } elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
166 // Partial builds don't need language-specific warnings. |
183 // Partial builds don't need language-specific warnings. |
167 echo '<p class="hint">' . sprintf( |
184 echo '<p class="hint">' . sprintf( |
168 /* translators: %s: WordPress version. */ |
185 /* translators: %s: WordPress version. */ |
169 __( '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.' ), |
186 __( '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.' ), |
170 'development' !== $update->response ? $update->current : '' |
187 'development' !== $update->response ? $update->current : '' |
171 ) . '</p>'; |
188 ) . '</p>'; |
172 } |
189 } |
|
190 |
173 echo '</form>'; |
191 echo '</form>'; |
174 |
192 |
175 } |
193 } |
176 |
194 |
177 /** |
195 /** |
219 * @global string $required_mysql_version The required MySQL version string. |
237 * @global string $required_mysql_version The required MySQL version string. |
220 */ |
238 */ |
221 function core_upgrade_preamble() { |
239 function core_upgrade_preamble() { |
222 global $required_php_version, $required_mysql_version; |
240 global $required_php_version, $required_mysql_version; |
223 |
241 |
224 $wp_version = get_bloginfo( 'version' ); |
242 $updates = get_core_updates(); |
225 $updates = get_core_updates(); |
243 |
226 |
244 // Include an unmodified $wp_version. |
227 if ( ! isset( $updates[0]->response ) || 'latest' === $updates[0]->response ) { |
245 require ABSPATH . WPINC . '/version.php'; |
228 echo '<h2>'; |
246 |
229 _e( 'You have the latest version of WordPress.' ); |
247 $is_development_version = preg_match( '/alpha|beta|RC/', $wp_version ); |
230 |
248 |
231 if ( wp_http_supports( array( 'ssl' ) ) ) { |
249 if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { |
232 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
250 echo '<h2 class="response">'; |
233 $upgrader = new WP_Automatic_Updater; |
251 _e( 'An updated version of WordPress is available.' ); |
234 $future_minor_update = (object) array( |
|
235 'current' => $wp_version . '.1.next.minor', |
|
236 'version' => $wp_version . '.1.next.minor', |
|
237 'php_version' => $required_php_version, |
|
238 'mysql_version' => $required_mysql_version, |
|
239 ); |
|
240 $should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH ); |
|
241 if ( $should_auto_update ) { |
|
242 echo ' ' . __( 'Future security updates will be applied automatically.' ); |
|
243 } |
|
244 } |
|
245 echo '</h2>'; |
252 echo '</h2>'; |
246 } |
253 |
247 |
254 echo '<div class="notice notice-warning inline"><p>'; |
248 if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { |
|
249 echo '<div class="notice notice-warning"><p>'; |
|
250 printf( |
255 printf( |
251 /* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */ |
256 /* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */ |
252 __( '<strong>Important:</strong> Before updating, please <a href="%1$s">back up your database and files</a>. For help with updates, visit the <a href="%2$s">Updating WordPress</a> documentation page.' ), |
257 __( '<strong>Important:</strong> Before updating, please <a href="%1$s">back up your database and files</a>. For help with updates, visit the <a href="%2$s">Updating WordPress</a> documentation page.' ), |
253 __( 'https://wordpress.org/support/article/wordpress-backups/' ), |
258 __( 'https://wordpress.org/support/article/wordpress-backups/' ), |
254 __( 'https://wordpress.org/support/article/updating-wordpress/' ) |
259 __( 'https://wordpress.org/support/article/updating-wordpress/' ) |
255 ); |
260 ); |
256 echo '</p></div>'; |
261 echo '</p></div>'; |
257 |
262 } elseif ( $is_development_version ) { |
258 echo '<h2 class="response">'; |
263 echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>'; |
259 _e( 'An updated version of WordPress is available.' ); |
264 } else { |
260 echo '</h2>'; |
265 echo '<h2 class="response">' . __( 'You have the latest version of WordPress.' ) . '</h2>'; |
261 } |
|
262 |
|
263 if ( isset( $updates[0] ) && 'development' === $updates[0]->response ) { |
|
264 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
265 $upgrader = new WP_Automatic_Updater; |
|
266 if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) { |
|
267 echo '<div class="updated inline"><p>'; |
|
268 echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' ); |
|
269 echo '</p></div>'; |
|
270 } |
|
271 } |
266 } |
272 |
267 |
273 echo '<ul class="core-updates">'; |
268 echo '<ul class="core-updates">'; |
274 foreach ( (array) $updates as $update ) { |
269 foreach ( (array) $updates as $update ) { |
275 echo '<li>'; |
270 echo '<li>'; |
276 list_core_update( $update ); |
271 list_core_update( $update ); |
277 echo '</li>'; |
272 echo '</li>'; |
278 } |
273 } |
279 echo '</ul>'; |
274 echo '</ul>'; |
|
275 |
280 // Don't show the maintenance mode notice when we are only showing a single re-install option. |
276 // Don't show the maintenance mode notice when we are only showing a single re-install option. |
281 if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) { |
277 if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) { |
282 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>'; |
278 echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>'; |
283 } elseif ( ! $updates ) { |
279 } elseif ( ! $updates ) { |
284 list( $normalized_version ) = explode( '-', $wp_version ); |
280 list( $normalized_version ) = explode( '-', $wp_version ); |
287 __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ), |
283 __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ), |
288 esc_url( self_admin_url( 'about.php' ) ), |
284 esc_url( self_admin_url( 'about.php' ) ), |
289 $normalized_version |
285 $normalized_version |
290 ) . '</p>'; |
286 ) . '</p>'; |
291 } |
287 } |
|
288 |
292 dismissed_updates(); |
289 dismissed_updates(); |
|
290 } |
|
291 |
|
292 /** |
|
293 * Display WordPress auto-updates settings. |
|
294 * |
|
295 * @since 5.6.0 |
|
296 */ |
|
297 function core_auto_updates_settings() { |
|
298 if ( isset( $_GET['core-major-auto-updates-saved'] ) ) { |
|
299 if ( 'enabled' === $_GET['core-major-auto-updates-saved'] ) { |
|
300 $notice_text = __( 'Automatic updates for all WordPress versions have been enabled. Thank you!' ); |
|
301 echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>'; |
|
302 } elseif ( 'disabled' === $_GET['core-major-auto-updates-saved'] ) { |
|
303 $notice_text = __( 'WordPress will only receive automatic security and maintenance releases from now on.' ); |
|
304 echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>'; |
|
305 } |
|
306 } |
|
307 |
|
308 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
309 $updater = new WP_Automatic_Updater(); |
|
310 |
|
311 // Defaults: |
|
312 $upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled'; |
|
313 $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; |
|
314 $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; |
|
315 |
|
316 $can_set_update_option = true; |
|
317 // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'development', 'branch-development', 'minor', false. |
|
318 if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { |
|
319 if ( false === WP_AUTO_UPDATE_CORE ) { |
|
320 // Defaults to turned off, unless a filter allows it. |
|
321 $upgrade_dev = false; |
|
322 $upgrade_minor = false; |
|
323 $upgrade_major = false; |
|
324 } elseif ( true === WP_AUTO_UPDATE_CORE |
|
325 || in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) |
|
326 ) { |
|
327 // ALL updates for core. |
|
328 $upgrade_dev = true; |
|
329 $upgrade_minor = true; |
|
330 $upgrade_major = true; |
|
331 } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { |
|
332 // Only minor updates for core. |
|
333 $upgrade_dev = false; |
|
334 $upgrade_minor = true; |
|
335 $upgrade_major = false; |
|
336 } |
|
337 |
|
338 // The UI is overridden by the `WP_AUTO_UPDATE_CORE` constant. |
|
339 $can_set_update_option = false; |
|
340 } |
|
341 |
|
342 if ( $updater->is_disabled() ) { |
|
343 $upgrade_dev = false; |
|
344 $upgrade_minor = false; |
|
345 $upgrade_major = false; |
|
346 |
|
347 /* |
|
348 * The UI is overridden by the `AUTOMATIC_UPDATER_DISABLED` constant |
|
349 * or the `automatic_updater_disabled` filter, |
|
350 * or by `wp_is_file_mod_allowed( 'automatic_updater' )`. |
|
351 * See `WP_Automatic_Updater::is_disabled()`. |
|
352 */ |
|
353 $can_set_update_option = false; |
|
354 } |
|
355 |
|
356 // Is the UI overridden by a plugin using the `allow_major_auto_core_updates` filter? |
|
357 if ( has_filter( 'allow_major_auto_core_updates' ) ) { |
|
358 $can_set_update_option = false; |
|
359 } |
|
360 |
|
361 /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ |
|
362 $upgrade_dev = apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ); |
|
363 /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ |
|
364 $upgrade_minor = apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); |
|
365 /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ |
|
366 $upgrade_major = apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); |
|
367 |
|
368 $auto_update_settings = array( |
|
369 'dev' => $upgrade_dev, |
|
370 'minor' => $upgrade_minor, |
|
371 'major' => $upgrade_major, |
|
372 ); |
|
373 |
|
374 if ( $upgrade_major ) { |
|
375 $wp_version = get_bloginfo( 'version' ); |
|
376 $updates = get_core_updates(); |
|
377 |
|
378 if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { |
|
379 echo '<p>' . wp_get_auto_update_message() . '</p>'; |
|
380 } |
|
381 } |
|
382 |
|
383 $action_url = self_admin_url( 'update-core.php?action=core-major-auto-updates-settings' ); |
|
384 ?> |
|
385 |
|
386 <p class="auto-update-status"> |
|
387 <?php |
|
388 |
|
389 if ( $updater->is_vcs_checkout( ABSPATH ) ) { |
|
390 _e( 'This site appears to be under version control. Automatic updates are disabled.' ); |
|
391 } elseif ( $upgrade_major ) { |
|
392 _e( 'This site is automatically kept up to date with each new version of WordPress.' ); |
|
393 |
|
394 if ( $can_set_update_option ) { |
|
395 echo '<br>'; |
|
396 printf( |
|
397 '<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-disable">%s</a>', |
|
398 wp_nonce_url( add_query_arg( 'value', 'disable', $action_url ), 'core-major-auto-updates-nonce' ), |
|
399 __( 'Switch to automatic updates for maintenance and security releases only.' ) |
|
400 ); |
|
401 } |
|
402 } elseif ( $upgrade_minor ) { |
|
403 _e( 'This site is automatically kept up to date with maintenance and security releases of WordPress only.' ); |
|
404 |
|
405 if ( $can_set_update_option ) { |
|
406 echo '<br>'; |
|
407 printf( |
|
408 '<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-enable">%s</a>', |
|
409 wp_nonce_url( add_query_arg( 'value', 'enable', $action_url ), 'core-major-auto-updates-nonce' ), |
|
410 __( 'Enable automatic updates for all new versions of WordPress.' ) |
|
411 ); |
|
412 } |
|
413 } else { |
|
414 _e( 'This site will not receive automatic updates for new versions of WordPress.' ); |
|
415 } |
|
416 ?> |
|
417 </p> |
|
418 |
|
419 <?php |
|
420 /** |
|
421 * Fires after the major core auto-update settings. |
|
422 * |
|
423 * @since 5.6.0 |
|
424 * |
|
425 * @param array $auto_update_settings { |
|
426 * Array of core auto-update settings. |
|
427 * |
|
428 * @type bool $dev Whether to enable automatic updates for development versions. |
|
429 * @type bool $minor Whether to enable minor automatic core updates. |
|
430 * @type bool $major Whether to enable major automatic core updates. |
|
431 * } |
|
432 */ |
|
433 do_action( 'after_core_auto_updates_settings', $auto_update_settings ); |
293 } |
434 } |
294 |
435 |
295 /** |
436 /** |
296 * Display the upgrade plugins form. |
437 * Display the upgrade plugins form. |
297 * |
438 * |
314 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, '=' ) ) { |
455 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, '=' ) ) { |
315 $core_update_version = false; |
456 $core_update_version = false; |
316 } else { |
457 } else { |
317 $core_update_version = $core_updates[0]->current; |
458 $core_update_version = $core_updates[0]->current; |
318 } |
459 } |
319 ?> |
460 |
320 <h2><?php _e( 'Plugins' ); ?></h2> |
461 $plugins_count = count( $plugins ); |
|
462 ?> |
|
463 <h2> |
|
464 <?php |
|
465 printf( |
|
466 '%s <span class="count">(%d)</span>', |
|
467 __( 'Plugins' ), |
|
468 number_format_i18n( $plugins_count ) |
|
469 ); |
|
470 ?> |
|
471 </h2> |
321 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
472 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
322 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> |
473 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> |
323 <?php wp_nonce_field( 'upgrade-core' ); ?> |
474 <?php wp_nonce_field( 'upgrade-core' ); ?> |
324 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p> |
475 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p> |
325 <table class="widefat updates-table" id="update-plugins-table"> |
476 <table class="widefat updates-table" id="update-plugins-table"> |
806 'title' => __( 'Overview' ), |
967 'title' => __( 'Overview' ), |
807 'content' => $updates_overview, |
968 'content' => $updates_overview, |
808 ) |
969 ) |
809 ); |
970 ); |
810 |
971 |
811 $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>'; |
972 $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>'; |
812 $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>'; |
973 $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>'; |
813 |
974 |
814 if ( 'en_US' !== get_locale() ) { |
975 if ( 'en_US' !== get_locale() ) { |
815 $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>'; |
976 $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>'; |
816 } |
977 } |
872 |
1035 |
873 if ( $current && isset( $current->last_checked ) ) { |
1036 if ( $current && isset( $current->last_checked ) ) { |
874 $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; |
1037 $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; |
875 } |
1038 } |
876 |
1039 |
877 echo '<p>'; |
1040 echo '<h2 class="wp-current-version">'; |
|
1041 /* translators: Current version of WordPress. */ |
|
1042 printf( __( 'Current version: %s' ), get_bloginfo( 'version' ) ); |
|
1043 echo '</h2>'; |
|
1044 |
|
1045 echo '<p class="update-last-checked">'; |
878 /* translators: 1: Date, 2: Time. */ |
1046 /* translators: 1: Date, 2: Time. */ |
879 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 ) ); |
1047 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 ) ); |
880 echo ' <a class="button" href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check Again' ) . '</a>'; |
1048 echo ' <a href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check again.' ) . '</a>'; |
881 echo '</p>'; |
1049 echo '</p>'; |
882 |
1050 |
883 if ( current_user_can( 'update_core' ) ) { |
1051 if ( current_user_can( 'update_core' ) ) { |
|
1052 core_auto_updates_settings(); |
884 core_upgrade_preamble(); |
1053 core_upgrade_preamble(); |
885 } |
1054 } |
886 if ( current_user_can( 'update_plugins' ) ) { |
1055 if ( current_user_can( 'update_plugins' ) ) { |
887 list_plugin_updates(); |
1056 list_plugin_updates(); |
888 } |
1057 } |
1052 ) |
1223 ) |
1053 ); |
1224 ); |
1054 |
1225 |
1055 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
1226 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
1056 |
1227 |
|
1228 } elseif ( 'core-major-auto-updates-settings' === $action ) { |
|
1229 |
|
1230 if ( ! current_user_can( 'update_core' ) ) { |
|
1231 wp_die( __( 'Sorry, you are not allowed to update this site.' ) ); |
|
1232 } |
|
1233 |
|
1234 $redirect_url = self_admin_url( 'update-core.php' ); |
|
1235 |
|
1236 if ( isset( $_GET['value'] ) ) { |
|
1237 check_admin_referer( 'core-major-auto-updates-nonce' ); |
|
1238 |
|
1239 if ( 'enable' === $_GET['value'] ) { |
|
1240 update_site_option( 'auto_update_core_major', 'enabled' ); |
|
1241 $redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'enabled', $redirect_url ); |
|
1242 } elseif ( 'disable' === $_GET['value'] ) { |
|
1243 update_site_option( 'auto_update_core_major', 'disabled' ); |
|
1244 $redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'disabled', $redirect_url ); |
|
1245 } |
|
1246 } |
|
1247 |
|
1248 wp_redirect( $redirect_url ); |
|
1249 exit; |
1057 } else { |
1250 } else { |
1058 /** |
1251 /** |
1059 * Fires for each custom update action on the WordPress Updates screen. |
1252 * Fires for each custom update action on the WordPress Updates screen. |
1060 * |
1253 * |
1061 * The dynamic portion of the hook name, `$action`, refers to the |
1254 * The dynamic portion of the hook name, `$action`, refers to the |