diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php
index c08e57f6e9..b9f6e0750d 100644
|
a
|
b
|
function core_upgrade_preamble() { |
| 306 | 306 | * @since 5.6.0 |
| 307 | 307 | */ |
| 308 | 308 | function core_auto_updates_settings() { |
| 309 | | $upgrade_major_value = ''; |
| 310 | | if ( isset( $_POST['core-auto-updates-settings'] ) && wp_verify_nonce( $_POST['set_core_auto_updates_settings'], 'core-auto-updates-nonce' ) ) { |
| 311 | | if ( isset( $_POST['core-auto-updates-major'] ) && 1 === (int) $_POST['core-auto-updates-major'] ) { |
| | 309 | if ( isset( $_GET['core-auto-updates-major'] ) ) { |
| | 310 | if ( 1 === (int) $_GET['core-auto-updates-major'] ) { |
| 312 | 311 | update_site_option( 'auto_update_core_major', 1 ); |
| 313 | 312 | } else { |
| 314 | 313 | update_site_option( 'auto_update_core_major', 0 ); |
| … |
… |
function core_auto_updates_settings() { |
| 322 | 321 | $upgrade_minor = get_site_option( 'auto_update_core_minor', true ); |
| 323 | 322 | $upgrade_major = get_site_option( 'auto_update_core_major', false ); |
| 324 | 323 | |
| | 324 | $major_optin_disabled = false; |
| 325 | 325 | // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'minor', false. |
| 326 | 326 | if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { |
| 327 | 327 | if ( false === WP_AUTO_UPDATE_CORE ) { |
| … |
… |
function core_auto_updates_settings() { |
| 343 | 343 | $upgrade_minor = true; |
| 344 | 344 | $upgrade_major = false; |
| 345 | 345 | } |
| | 346 | $major_optin_disabled = true; |
| 346 | 347 | } |
| 347 | 348 | |
| 348 | 349 | /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ |
| … |
… |
function core_auto_updates_settings() { |
| 352 | 353 | /** This filter is documented in wp-admin/includes/class-core-upgrader.php */ |
| 353 | 354 | $upgrade_major = apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); |
| 354 | 355 | |
| | 356 | $is_major_optin_disabled = apply_filters( 'allow_major_auto_core_updates', null ); |
| | 357 | if ( isset( $is_major_optin_disabled ) ) { |
| | 358 | $major_optin_disabled = true; |
| | 359 | } |
| | 360 | |
| 355 | 361 | $auto_update_settings = array( |
| 356 | 362 | 'dev' => $upgrade_dev, |
| 357 | 363 | 'minor' => $upgrade_minor, |
| 358 | 364 | 'major' => $upgrade_major, |
| 359 | 365 | ); |
| | 366 | |
| | 367 | if ( $auto_update_settings['major'] ) { |
| | 368 | $wp_version = get_bloginfo( 'version' ); |
| | 369 | $updates = get_core_updates(); |
| | 370 | if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { |
| | 371 | echo '<p>' . wp_get_auto_update_message() . '</p>'; |
| | 372 | } |
| | 373 | } |
| 360 | 374 | ?> |
| 361 | | <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" name="core-auto-updates" class="form-core-auto-updates"> |
| 362 | | <?php wp_nonce_field( 'core-auto-updates-nonce', 'set_core_auto_updates_settings' ); ?> |
| 363 | | <h2><?php _e( 'Auto-update settings' ); ?></h2> |
| | 375 | |
| | 376 | <?php if ( 0 === (int) $major_optin_disabled ) : ?> |
| 364 | 377 | <p> |
| 365 | 378 | <?php |
| 366 | | if ( $auto_update_settings['major'] ) { |
| 367 | | $wp_version = get_bloginfo( 'version' ); |
| 368 | | $updates = get_core_updates(); |
| 369 | | if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { |
| 370 | | echo wp_get_auto_update_message(); |
| 371 | | } |
| | 379 | if ( 0 === (int) $upgrade_major ) { |
| | 380 | echo sprintf( |
| | 381 | /* Translators: Action link to enable core auto-updates. */ |
| | 382 | __( 'You are invited to <a href="%s">automatically keep this site up-to-date with regular feature updates.</a>' ), |
| | 383 | esc_url( strtok( $_SERVER['REQUEST_URI'], '?' ) ) . '?core-auto-updates-major=1' |
| | 384 | ); |
| | 385 | } else { |
| | 386 | echo sprintf( |
| | 387 | /* Translators: Action link to disable core auto-updates. */ |
| | 388 | __( 'Auto-updates for regular feature updates are on. You can <a href="%s">turn them off.</a>' ), |
| | 389 | esc_url( strtok( $_SERVER['REQUEST_URI'], '?' ) ) . '?core-auto-updates-major=0' |
| | 390 | ); |
| 372 | 391 | } |
| 373 | 392 | ?> |
| 374 | 393 | </p> |
| | 394 | <?php else: ?> |
| 375 | 395 | <p> |
| 376 | | <input type="checkbox" name="core-auto-updates-major" id="core-auto-updates-major" value="1" <?php checked( $auto_update_settings['major'], 1 ); ?> /> |
| 377 | | <label for="core-auto-updates-major"> |
| 378 | | <?php _e( 'Automatically keep this site up-to-date with regular feature updates.' ); ?> |
| 379 | | </label> |
| 380 | | </p> |
| 381 | | <?php |
| 382 | | /** |
| 383 | | * Fires after the major core auto-update checkbox. |
| 384 | | * |
| 385 | | * @since 5.6.0 |
| 386 | | */ |
| 387 | | do_action( 'after_core_auto_updates_settings_fields', $auto_update_settings ); |
| 388 | | ?> |
| 389 | | <p> |
| 390 | | <input id="core-auto-updates-settings" class="button" type="submit" value="<?php esc_attr_e( 'Save' ); ?>" name="core-auto-updates-settings" /> |
| | 396 | <?php _e( 'This website is set to keep itself up-to-date with regular feature updates.' ); ?> |
| 391 | 397 | </p> |
| 392 | | </form> |
| | 398 | <?php endif; ?> |
| | 399 | |
| 393 | 400 | <?php |
| | 401 | /** |
| | 402 | * Fires after the major core auto-update option. |
| | 403 | * |
| | 404 | * @since 5.6.0 |
| | 405 | */ |
| | 406 | do_action( 'after_core_auto_updates_settings_fields', $auto_update_settings ); |
| 394 | 407 | } |
| 395 | 408 | |
| 396 | 409 | /** |
| … |
… |
if ( 'upgrade-core' === $action ) { |
| 957 | 970 | ?> |
| 958 | 971 | <div class="wrap"> |
| 959 | 972 | <h1><?php _e( 'WordPress Updates' ); ?></h1> |
| | 973 | <p><?php _e( 'Here you can find information about updates, set auto-updates and see what plugins or themes need updating.' ); ?></p> |
| | 974 | |
| 960 | 975 | <?php |
| 961 | 976 | if ( $upgrade_error ) { |
| 962 | 977 | echo '<div class="error"><p>'; |
| … |
… |
if ( 'upgrade-core' === $action ) { |
| 982 | 997 | echo '</p>'; |
| 983 | 998 | |
| 984 | 999 | if ( current_user_can( 'update_core' ) ) { |
| 985 | | core_upgrade_preamble(); |
| 986 | 1000 | core_auto_updates_settings(); |
| | 1001 | core_upgrade_preamble(); |
| 987 | 1002 | } |
| 988 | 1003 | if ( current_user_can( 'update_plugins' ) ) { |
| 989 | 1004 | list_plugin_updates(); |