Changeset 49254
- Timestamp:
- 10/20/2020 07:33:27 PM (4 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/common.css
r49179 r49254 345 345 346 346 .update-core-php h2 { 347 margin-top: 2em;347 margin-top: 4em; 348 348 } 349 349 -
trunk/src/wp-admin/includes/class-core-upgrader.php
r49245 r49254 49 49 * @param object $current Response object for whether WordPress is current. 50 50 * @param array $args { 51 * Optional. Arguments for upgrading WordPress core. Default empty array.52 * 53 * @type bool $pre_check_md5 Whether to check the file checksums before54 * attempting the upgrade. Default true.55 * @type bool $attempt_rollback Whether to attempt to rollback the chances if56 * there is a problem. Default false.57 * @type bool $do_rollback Whether to perform this "upgrade" as a rollback.58 * Default false.51 * Optional. Arguments for upgrading WordPress core. Default empty array. 52 * 53 * @type bool $pre_check_md5 Whether to check the file checksums before 54 * attempting the upgrade. Default true. 55 * @type bool $attempt_rollback Whether to attempt to rollback the chances if 56 * there is a problem. Default false. 57 * @type bool $do_rollback Whether to perform this "upgrade" as a rollback. 58 * Default false. 59 59 * } 60 60 * @return string|false|WP_Error New WordPress version on success, false or WP_Error on failure. … … 280 280 281 281 // Defaults: 282 $upgrade_dev = true;283 $upgrade_minor = true;284 $upgrade_major = false;282 $upgrade_dev = get_site_option( 'auto_update_core_dev', true ); 283 $upgrade_minor = get_site_option( 'auto_update_core_minor', true ); 284 $upgrade_major = get_site_option( 'auto_update_core_major', false ); 285 285 286 286 // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'minor', false. -
trunk/src/wp-admin/update-core.php
r49150 r49254 302 302 303 303 /** 304 * Display WordPress auto-updates settings. 305 * 306 * @since 5.6.0 307 */ 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'] ) { 312 update_site_option( 'auto_update_core_major', 1 ); 313 } else { 314 update_site_option( 'auto_update_core_major', 0 ); 315 } 316 echo '<div class="notice notice-info is-dismissible"><p>'; 317 _e( 'WordPress auto-updates settings updated.' ); 318 echo '</p></div>'; 319 } 320 321 $upgrade_dev = get_site_option( 'auto_update_core_dev', true ); 322 $upgrade_minor = get_site_option( 'auto_update_core_minor', true ); 323 $upgrade_major = get_site_option( 'auto_update_core_major', false ); 324 325 if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { 326 if ( false === WP_AUTO_UPDATE_CORE ) { 327 // Defaults to turned off, unless a filter allows it. 328 $upgrade_dev = false; 329 $upgrade_minor = false; 330 $upgrade_major = false; 331 } elseif ( true === WP_AUTO_UPDATE_CORE ) { 332 // ALL updates for core. 333 $upgrade_dev = true; 334 $upgrade_minor = true; 335 $upgrade_major = true; 336 } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { 337 // Only minor updates for core. 338 $upgrade_dev = false; 339 $upgrade_minor = true; 340 $upgrade_major = false; 341 } 342 } 343 344 $upgrade_dev = apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ); 345 $upgrade_minor = apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); 346 $upgrade_major = apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); 347 348 $auto_update_settings = array( 349 'dev' => $upgrade_dev, 350 'minor' => $upgrade_minor, 351 'major' => $upgrade_major, 352 ); 353 ?> 354 <form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" name="core-auto-updates" class="form-core-auto-updates"> 355 <?php wp_nonce_field( 'core-auto-updates-nonce', 'set_core_auto_updates_settings' ); ?> 356 <h2><?php _e( 'Auto-update settings' ); ?></h2> 357 <p> 358 <?php 359 if ( $auto_update_settings['major'] ) { 360 $wp_version = get_bloginfo( 'version' ); 361 $updates = get_core_updates(); 362 if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { 363 echo wp_get_auto_update_message(); 364 } 365 } 366 ?> 367 </p> 368 <p> 369 <input type="checkbox" name="core-auto-updates-major" id="core-auto-updates-major" value="1" <?php checked( $auto_update_settings['major'], 1 ); ?> /> 370 <label for="core-auto-updates-major"> 371 <?php _e( 'Keep my site up-to-date with regular feature updates (major versions).' ); ?> 372 </label> 373 </p> 374 <?php 375 /** 376 * Fires after the major core auto-update checkbox. 377 * 378 * @since 5.6.0 379 */ 380 do_action( 'after_core_auto_updates_settings_fields', $auto_update_settings ); 381 ?> 382 <p> 383 <input id="core-auto-updates-settings" class="button" type="submit" value="<?php esc_attr_e( 'Save' ); ?>" name="core-auto-updates-settings" /> 384 </p> 385 <?php 386 } 387 388 /** 304 389 * Display the upgrade plugins form. 305 390 * … … 891 976 if ( current_user_can( 'update_core' ) ) { 892 977 core_upgrade_preamble(); 978 core_auto_updates_settings(); 893 979 } 894 980 if ( current_user_can( 'update_plugins' ) ) {
Note: See TracChangeset
for help on using the changeset viewer.