WordPress 3.7 Beta – Automatic updates are coming

WordPress 3.7 Beta

WordPress 3.7 Beta

WordPress 3.7 Beta 1 is available for testing. Just few days ago we got WordPress 3.6.1 maintenance and security update. Did you update your WordPress site to version 3.6.1? No? This update is available from September, 16th. So it’s time to install it, sure. The list of fixes is available here.
Less than after a month of 3.6.1 release, WordPress developers team announced WordPress version 3.7 availability – October, 2013. Good speed.

The most impressive new feature included into version 3.7 is the automatic background update of WordPress core. That’s cool. You may sleep, have a good vacations, but your lovely WordPress will be always up-to-date, and all security vulnerabilities found will be fixed automatically. Fantastics which becomes the reality! But this is the one side of the coin only.


What is about the second one? Automatic update of the production system could be dangerous in relation of its operation continuity and reliability. What will be if you have some customized code on site which could be broken with new update installed automatically?

For such case I need special setting which allows me to prohibit any automatic update. I installed WordPress 3.7 Beta 1 today. The installation process is easy and transparent as always. You need just confirm the database upgrade. My test site works well after upgrade to 3.7 Beta 1. No bugs were found for this moment.
But return to the automatic updates. I went through the Settings and Update pages twice, but I did not find any settings responsible for automatic updates management. Do you? That could become the real problem, but thanks to WordPress developers, they are thinking about us :).

If you are in the situation, when you can not allow automatic WordPress core updates in background, if you should install any updates under manual control and any updates should go live only after successful tests in a test environment, then you may disable WordPress automatic core updates. Define 'AUTOMATIC_UPDATER_DISABLED' PHP constant for that. You may do it by adding this line into wp-config.php:

define('AUTOMATIC_UPDATER_DISABLED', 1);

I found this information at the WordPress source code, file wp-admin/includes/class-wp-upgrader.php:

1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
static function upgrader_disabled() {
		// That's a no if you don't want files changes
		if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
			return true;
 
		// More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters
		if ( defined( 'AUTOMATIC_UPDATER_DISABLED' ) && AUTOMATIC_UPDATER_DISABLED )
			return true;
 
		if ( defined( 'WP_INSTALLING' ) )
			return true;
 
		return apply_filters( 'auto_upgrader_disabled', false );
	}

As you see, it is possible to disable auto updates for WordPress core via ‘auto_upgrader_disabled’ filter too, just return true from it.
Function 'upgrader_disabled()' is called at the same file:

1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
	/**
	 * Tests to see if we should upgrade a specific item, does not test to see if we CAN update the item.
	 */
	static function should_auto_update( $type, $item, $context ) {
 
		if ( self::upgrader_disabled() )
			return false;
 
		if ( self::is_vcs_checkout( $context ) )
			return false;

Function should_auto_update() is called at file wp-admin/includes/update.php:

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
 * Gets the best available (and enabled) Auto-Update for WordPress Core.
 *
 * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the install allows it, else, 1.2.3
 *
 * @since 3.7.0
 *
 * @return bool|array False on failure, otherwise the core update offering.
 */
function find_core_auto_update() {
	$updates = get_site_transient( 'update_core' );
	if ( ! $updates || empty( $updates->updates ) )
		return false;
 
	include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
 
	$auto_update = false;
	foreach ( $updates->updates as $update ) {
		if ( 'autoupdate' != $update->response )
			continue;
 
		if ( ! WP_Automatic_Upgrader::should_auto_update( 'core', $update, ABSPATH ) )
			continue;
 
		if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) )
			$auto_update = $update;
	}
	return $auto_update;
}