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

see #25603, #22704.

Built from https://develop.svn.wordpress.org/trunk@25833


git-svn-id: http://core.svn.wordpress.org/trunk@25833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-10-24 22:54:22 +00:00
parent 31ff7d5161
commit b9290e0ea3

View File

@ -40,8 +40,27 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
<div>
<h4><?php _e( 'Updates While You Sleep' ); ?></h4>
<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>
<p><?php _e( '&rarr; This site <strong>is</strong> able to apply these updates automatically. Cool!' ); ?></p>
<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>
<?php
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader = new WP_Automatic_Upgrader;
$can_auto_update = wp_http_supports( 'ssl' );
if ( $can_auto_update ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader = new WP_Automatic_Upgrader;
$future_minor_update = (object) array(
'current' => $wp_version . '.1-about.php',
'version' => $wp_version . '.1-about.php',
'php_version' => $required_php_version,
'mysql_version' => $required_mysql_version,
);
$can_auto_update = $upgrader->should_upgrade( 'core', $future_minor_update, ABSPATH );
}
if ( $can_auto_update ) : ?>
<p><?php _e( '&rarr; This site <strong>is</strong> able to apply these updates automatically. Cool!' ); ?></p>
<?php else : ?>
<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>
<?php endif; ?>
</div>
<div class="last-feature">
<h4><?php _e( 'More Reliable Than Ever' ); ?></h4>