WordPress.org

Make WordPress Core

Changeset 25833


Ignore:
Timestamp:
10/17/13 20:28:38 (3 years ago)
Author:
nacin
Message:

Check if background core updates are supported on about.php.

see #25603, #22704.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/about.php

    r25832 r25833  
    4141            <h4><?php _e( 'Updates While You Sleep' ); ?></h4> 
    4242            <p><?php _e( 'With WordPress 3.7, you don&#8217;t have to lift a finger to apply maintenance and security updates. Most sites are now able to automatically apply these updates in the background, though some configurations may not allow it.' ); ?></p> 
    43             <p><?php _e( '&rarr; This site <strong>is</strong> able to apply these updates automatically. Cool!' ); ?></p> 
    44             <p><?php printf( __( '&rarr; This site <strong>is not</strong> able to apply these updates automatically. But we&#8217;ll email %s when there is a new security release.' ), esc_html( get_site_option( 'admin_email' ) ) ); ?></p> 
     43            <?php 
     44            require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 
     45            $upgrader = new WP_Automatic_Upgrader; 
     46 
     47            $can_auto_update = wp_http_supports( 'ssl' ); 
     48            if ( $can_auto_update ) { 
     49                require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 
     50                $upgrader = new WP_Automatic_Upgrader; 
     51                $future_minor_update = (object) array( 
     52                    'current'       => $wp_version . '.1-about.php', 
     53                    'version'       => $wp_version . '.1-about.php', 
     54                    'php_version'   => $required_php_version, 
     55                    'mysql_version' => $required_mysql_version, 
     56                ); 
     57                $can_auto_update = $upgrader->should_upgrade( 'core', $future_minor_update, ABSPATH ); 
     58            } 
     59            if ( $can_auto_update ) : ?> 
     60                <p><?php _e( '&rarr; This site <strong>is</strong> able to apply these updates automatically. Cool!' ); ?></p> 
     61            <?php else : ?> 
     62                <p><?php printf( __( '&rarr; This site <strong>is not</strong> able to apply these updates automatically. But we&#8217;ll email %s when there is a new security release.' ), esc_html( get_site_option( 'admin_email' ) ) ); ?></p> 
     63            <?php endif; ?> 
    4564        </div> 
    4665        <div class="last-feature"> 
Note: See TracChangeset for help on using the changeset viewer.