<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[25823] trunk/src: Make WP_Automatic_Upgrader a proper object that gets instantiated.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/25823">25823</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-10-17 00:54:15 +0000 (Thu, 17 Oct 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make WP_Automatic_Upgrader a proper object that gets instantiated. Renames nearly all of its methods.
Also renames wp_auto_updates_maybe_update() to wp_maybe_auto_update().
see <a href="http://core.trac.wordpress.org/ticket/22704">#22704</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswpupgraderphp">trunk/src/wp-admin/includes/class-wp-upgrader.php</a></li>
<li><a href="#trunksrcwpadminincludesupdatephp">trunk/src/wp-admin/includes/update.php</a></li>
<li><a href="#trunksrcwpadminupdatecorephp">trunk/src/wp-admin/update-core.php</a></li>
<li><a href="#trunksrcwpincludesupdatephp">trunk/src/wp-includes/update.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswpupgraderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-upgrader.php (25822 => 25823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-upgrader.php 2013-10-17 00:11:25 UTC (rev 25822)
+++ trunk/src/wp-admin/includes/class-wp-upgrader.php 2013-10-17 00:54:15 UTC (rev 25823)
</span><span class="lines">@@ -1551,33 +1551,32 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * WordPress Automatic Upgrader helper class
</del><ins>+ * WordPress automatic background upgrader.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.7.0
</span><span class="cx"> */
</span><span class="cx"> class WP_Automatic_Upgrader {
</span><span class="cx">
</span><del>- static $upgrade_results = array();
</del><ins>+ protected $update_results = array();
</ins><span class="cx">
</span><del>- static function upgrader_disabled() {
- // That's a no if you don't want files changes
</del><ins>+ function is_disabled() {
+ // Background updates are disabled if you don't want file changes.
</ins><span class="cx"> if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- // 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;
-
</del><span class="cx"> if ( defined( 'WP_INSTALLING' ) )
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- return apply_filters( 'auto_upgrader_disabled', false );
</del><ins>+ // More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters.
+ $disabled = defined( 'AUTOMATIC_UPDATES_DISABLED' ) && AUTOMATIC_UPDATES_DISABLED;
+
+ return apply_filters( 'auto_upgrader_disabled', $disabled );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Check for GIT/SVN checkouts.
</span><span class="cx"> */
</span><del>- static function is_vcs_checkout( $context ) {
</del><ins>+ function is_vcs_checkout( $context ) {
</ins><span class="cx"> $context_dirs = array( untrailingslashit( $context ) );
</span><span class="cx"> if ( $context !== ABSPATH )
</span><span class="cx"> $context_dirs[] = untrailingslashit( ABSPATH );
</span><span class="lines">@@ -1607,19 +1606,18 @@
</span><span class="cx"> /**
</span><span class="cx"> * Tests to see if we can and should upgrade a specific item.
</span><span class="cx"> */
</span><del>- static function should_auto_update( $type, $item, $context ) {
</del><ins>+ function should_upgrade( $type, $item, $context ) {
+ if ( $this->is_disabled() )
+ return false;
</ins><span class="cx">
</span><span class="cx"> // Checks to see if WP_Filesystem is set up to allow unattended upgrades.
</span><span class="cx"> $skin = new Automatic_Upgrader_Skin;
</span><span class="cx"> if ( ! $skin->request_filesystem_credentials( false, $context ) )
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if ( self::upgrader_disabled() )
</del><ins>+ if ( $this->is_vcs_checkout( $context ) )
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if ( self::is_vcs_checkout( $context ) )
- return false;
-
</del><span class="cx"> // Next up, do we actually have it enabled for this type of update?
</span><span class="cx"> switch ( $type ) {
</span><span class="cx"> case 'language':
</span><span class="lines">@@ -1657,7 +1655,7 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static function upgrade( $type, $item ) {
</del><ins>+ function upgrade( $type, $item ) {
</ins><span class="cx">
</span><span class="cx"> $skin = new Automatic_Upgrader_Skin();
</span><span class="cx">
</span><span class="lines">@@ -1683,7 +1681,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Determine whether we can and should perform this upgrade.
</span><del>- if ( ! self::should_auto_update( $type, $item, $context ) )
</del><ins>+ if ( ! $this->should_upgrade( $type, $item, $context ) )
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> switch ( $type ) {
</span><span class="lines">@@ -1724,7 +1722,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- self::$upgrade_results[ $type ][] = (object) array(
</del><ins>+ $this->update_results[ $type ][] = (object) array(
</ins><span class="cx"> 'item' => $item,
</span><span class="cx"> 'result' => $upgrade_result,
</span><span class="cx"> 'name' => $item_name,
</span><span class="lines">@@ -1737,8 +1735,7 @@
</span><span class="cx"> /**
</span><span class="cx"> * Kicks off a upgrade request for each item in the upgrade "queue"
</span><span class="cx"> */
</span><del>- static function perform_auto_updates() {
-
</del><ins>+ function run() {
</ins><span class="cx"> $lock_name = 'auto_upgrader.lock';
</span><span class="cx"> if ( get_site_option( $lock_name ) ) {
</span><span class="cx"> // Test to see if it was set more than an hour ago, if so, cleanup.
</span><span class="lines">@@ -1762,7 +1759,7 @@
</span><span class="cx"> $plugin_updates = get_site_transient( 'update_plugins' );
</span><span class="cx"> if ( $plugin_updates && !empty( $plugin_updates->response ) ) {
</span><span class="cx"> foreach ( array_keys( $plugin_updates->response ) as $plugin ) {
</span><del>- self::upgrade( 'plugin', $plugin );
</del><ins>+ $this->upgrade( 'plugin', $plugin );
</ins><span class="cx"> }
</span><span class="cx"> // Force refresh of plugin update information
</span><span class="cx"> wp_clean_plugins_cache();
</span><span class="lines">@@ -1773,7 +1770,7 @@
</span><span class="cx"> $theme_updates = get_site_transient( 'update_themes' );
</span><span class="cx"> if ( $theme_updates && !empty( $theme_updates->response ) ) {
</span><span class="cx"> foreach ( array_keys( $theme_updates->response ) as $theme ) {
</span><del>- self::upgrade( 'theme', $theme );
</del><ins>+ $this->upgrade( 'theme', $theme );
</ins><span class="cx"> }
</span><span class="cx"> // Force refresh of theme update information
</span><span class="cx"> wp_clean_themes_cache();
</span><span class="lines">@@ -1783,12 +1780,16 @@
</span><span class="cx"> wp_version_check(); // Check for Core updates
</span><span class="cx"> $extra_update_stats = array();
</span><span class="cx"> $core_update = find_core_auto_update();
</span><ins>+
</ins><span class="cx"> if ( $core_update ) {
</span><span class="cx"> $start_time = time();
</span><del>- $core_update_result = self::upgrade( 'core', $core_update );
</del><ins>+
+ $core_update_result = $this->upgrade( 'core', $core_update );
</ins><span class="cx"> delete_site_transient( 'update_core' );
</span><ins>+
</ins><span class="cx"> $extra_update_stats['success'] = is_wp_error( $core_update_result ) ? $core_update_result->get_error_code() : true;
</span><span class="cx"> $extra_update_stats['error_data'] = is_wp_error( $core_update_result ) ? $core_update_result->get_error_data() : '';
</span><ins>+
</ins><span class="cx"> if ( is_wp_error( $core_update_result ) && 'rollback_was_required' == $core_update_result->get_error_code() ) {
</span><span class="cx"> $rollback_data = $core_update_result->get_error_data();
</span><span class="cx"> $extra_update_stats['success'] = is_wp_error( $rollback_data['update'] ) ? $rollback_data['update']->get_error_code() : $rollback_data['update'];
</span><span class="lines">@@ -1796,6 +1797,7 @@
</span><span class="cx"> $extra_update_stats['rollback'] = is_wp_error( $rollback_data['rollback'] ) ? $rollback_data['rollback']->get_error_code() : true; // If it's not a WP_Error, the rollback was successful.
</span><span class="cx"> $extra_update_stats['rollback_data'] = is_wp_error( $rollback_data['rollback'] ) ? $rollback_data['rollback']->get_error_data() : '';
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> $extra_update_stats['fs_method'] = $GLOBALS['wp_filesystem']->method;
</span><span class="cx"> $extra_update_stats['fs_method_forced'] = defined( 'FS_METHOD' ) || has_filter( 'filesystem_method' );
</span><span class="cx"> $extra_update_stats['time_taken'] = ( time() - $start_time );
</span><span class="lines">@@ -1811,8 +1813,9 @@
</span><span class="cx"> $language_updates = wp_get_translation_updates();
</span><span class="cx"> if ( $language_updates ) {
</span><span class="cx"> foreach ( $language_updates as $update ) {
</span><del>- self::upgrade( 'language', $update );
</del><ins>+ $this->upgrade( 'language', $update );
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> // Clear existing caches
</span><span class="cx"> wp_clean_plugins_cache();
</span><span class="cx"> wp_clean_themes_cache();
</span><span class="lines">@@ -1823,33 +1826,20 @@
</span><span class="cx"> wp_update_plugins(); // Check for Plugin updates
</span><span class="cx"> }
</span><span class="cx">
</span><del>- /**
- * Filter whether to email an update summary to the site administrator.
- *
- * @since 3.7.0
- *
- * @param bool Whether or not email should be sent to administrator. Default true.
- * @param bool|array $core_update An array of core update data, false otherwise.
- * @param object $theme_updates Object containing theme update properties.
- * @param object $plugin_updates Object containing plugin update properties.
- * @param array $language_updates Array containing the Language updates available.
- * @param array $upgrade_results Array of the upgrade results keyed by upgrade type, and plugin/theme slug.
- */
- if ( apply_filters( 'enable_auto_upgrade_email', true, $core_update, $theme_updates, $plugin_updates, $language_updates, self::$upgrade_results ) )
- self::send_email();
</del><ins>+ $this->send_debug_email();
</ins><span class="cx">
</span><span class="cx"> // Clear the lock
</span><span class="cx"> delete_site_option( $lock_name );
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static function send_email() {
</del><ins>+ function send_debug_email() {
</ins><span class="cx">
</span><del>- if ( empty( self::$upgrade_results ) )
</del><ins>+ if ( empty( $this->update_results ) )
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> $upgrade_count = 0;
</span><del>- foreach ( self::$upgrade_results as $type => $upgrades )
</del><ins>+ foreach ( $this->update_results as $type => $upgrades )
</ins><span class="cx"> $upgrade_count += count( $upgrades );
</span><span class="cx">
</span><span class="cx"> $body = array();
</span><span class="lines">@@ -1858,8 +1848,8 @@
</span><span class="cx"> $body[] = 'WordPress site: ' . network_home_url( '/' );
</span><span class="cx">
</span><span class="cx"> // Core
</span><del>- if ( isset( self::$upgrade_results['core'] ) ) {
- $result = self::$upgrade_results['core'][0];
</del><ins>+ if ( isset( $this->update_results['core'] ) ) {
+ $result = $this->update_results['core'][0];
</ins><span class="cx"> if ( $result->result && ! is_wp_error( $result->result ) ) {
</span><span class="cx"> $body[] = sprintf( 'SUCCESS: WordPress was successfully updated to %s', $result->name );
</span><span class="cx"> } else {
</span><span class="lines">@@ -1871,18 +1861,18 @@
</span><span class="cx">
</span><span class="cx"> // Plugins, Themes, Languages
</span><span class="cx"> foreach ( array( 'plugin', 'theme', 'language' ) as $type ) {
</span><del>- if ( ! isset( self::$upgrade_results[ $type ] ) )
</del><ins>+ if ( ! isset( $this->update_results[ $type ] ) )
</ins><span class="cx"> continue;
</span><del>- $success_items = wp_list_filter( self::$upgrade_results[ $type ], array( 'result' => true ) );
</del><ins>+ $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
</ins><span class="cx"> if ( $success_items ) {
</span><span class="cx"> $body[] = "The following {$type}s were successfully updated:";
</span><span class="cx"> foreach ( wp_list_pluck( $success_items, 'name' ) as $name )
</span><span class="cx"> $body[] = ' * SUCCESS: ' . $name;
</span><span class="cx"> }
</span><del>- if ( $success_items != self::$upgrade_results[ $type ] ) {
</del><ins>+ if ( $success_items != $this->update_results[ $type ] ) {
</ins><span class="cx"> // Failed updates
</span><span class="cx"> $body[] = "The following {$type}s failed to update:";
</span><del>- foreach ( self::$upgrade_results[ $type ] as $item ) {
</del><ins>+ foreach ( $this->update_results[ $type ] as $item ) {
</ins><span class="cx"> if ( ! $item->result || is_wp_error( $item->result ) ) {
</span><span class="cx"> $body[] = ' * FAILED: ' . $item->name;
</span><span class="cx"> $failures++;
</span><span class="lines">@@ -1913,9 +1903,9 @@
</span><span class="cx"> $body[] = '';
</span><span class="cx">
</span><span class="cx"> foreach ( array( 'core', 'plugin', 'theme', 'language' ) as $type ) {
</span><del>- if ( ! isset( self::$upgrade_results[ $type ] ) )
</del><ins>+ if ( ! isset( $this->update_results[ $type ] ) )
</ins><span class="cx"> continue;
</span><del>- foreach ( self::$upgrade_results[ $type ] as $upgrade ) {
</del><ins>+ foreach ( $this->update_results[ $type ] as $upgrade ) {
</ins><span class="cx"> $body[] = $upgrade->name;
</span><span class="cx"> $body[] = str_repeat( '-', strlen( $upgrade->name ) );
</span><span class="cx"> foreach ( $upgrade->messages as $message )
</span></span></pre></div>
<a id="trunksrcwpadminincludesupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/update.php (25822 => 25823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/update.php 2013-10-17 00:11:25 UTC (rev 25822)
+++ trunk/src/wp-admin/includes/update.php 2013-10-17 00:54:15 UTC (rev 25823)
</span><span class="lines">@@ -77,11 +77,12 @@
</span><span class="cx"> include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
</span><span class="cx">
</span><span class="cx"> $auto_update = false;
</span><ins>+ $upgrader = new WP_Automatic_Upgrader;
</ins><span class="cx"> foreach ( $updates->updates as $update ) {
</span><span class="cx"> if ( 'autoupdate' != $update->response )
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- if ( ! WP_Automatic_Upgrader::should_auto_update( 'core', $update, ABSPATH ) )
</del><ins>+ if ( ! $upgrader->should_upgrade( 'core', $update, ABSPATH ) )
</ins><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) )
</span></span></pre></div>
<a id="trunksrcwpadminupdatecorephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/update-core.php (25822 => 25823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/update-core.php 2013-10-17 00:11:25 UTC (rev 25822)
+++ trunk/src/wp-admin/update-core.php 2013-10-17 00:54:15 UTC (rev 25823)
</span><span class="lines">@@ -148,13 +148,14 @@
</span><span class="cx">
</span><span class="cx"> if ( wp_http_supports( 'ssl' ) ) {
</span><span class="cx"> require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
</span><ins>+ $upgrader = new WP_Automatic_Upgrader;
</ins><span class="cx"> $future_minor_update = (object) array(
</span><span class="cx"> 'current' => $wp_version . '.1-update-core.php',
</span><span class="cx"> 'version' => $wp_version . '.1-update-core.php',
</span><span class="cx"> 'php_version' => $required_php_version,
</span><span class="cx"> 'mysql_version' => $required_mysql_version,
</span><span class="cx"> );
</span><del>- $should_auto_update = WP_Automatic_Upgrader::should_auto_update( 'core', $future_minor_update, ABSPATH );
</del><ins>+ $should_auto_update = $upgrader->should_upgrade( 'core', $future_minor_update, ABSPATH );
</ins><span class="cx"> if ( $should_auto_update )
</span><span class="cx"> echo ' ' . __( 'Future security updates will be applied automatically.' );
</span><span class="cx"> }
</span><span class="lines">@@ -171,7 +172,8 @@
</span><span class="cx">
</span><span class="cx"> if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) {
</span><span class="cx"> require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
</span><del>- if ( wp_http_supports( 'ssl' ) && WP_Automatic_Upgrader::should_auto_update( 'core', $updates[0], ABSPATH ) )
</del><ins>+ $upgrader = new WP_Automatic_Upgrader;
+ if ( wp_http_supports( 'ssl' ) && $upgrader->should_upgrade( 'core', $updates[0], ABSPATH ) )
</ins><span class="cx"> echo '<div class="updated inline"><p><strong>BETA TESTERS:</strong> This site is set up to install updates of future beta versions automatically.</p></div>';
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunksrcwpincludesupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/update.php (25822 => 25823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/update.php 2013-10-17 00:11:25 UTC (rev 25822)
+++ trunk/src/wp-includes/update.php 2013-10-17 00:54:15 UTC (rev 25823)
</span><span class="lines">@@ -406,18 +406,19 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Cron entry which runs the WordPress Automatic Updates
</del><ins>+ * Performs WordPress automatic background updates.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.7.0
</span><span class="cx"> */
</span><del>-function wp_auto_updates_maybe_update() {
</del><ins>+function wp_maybe_auto_update() {
</ins><span class="cx"> include_once ABSPATH . '/wp-admin/includes/admin.php';
</span><span class="cx"> include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
</span><span class="cx">
</span><del>- if ( WP_Automatic_Upgrader::upgrader_disabled() )
</del><ins>+ $upgrader = new WP_Automatic_Upgrader;
+ if ( $upgrader->is_disabled() )
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- WP_Automatic_Upgrader::perform_auto_updates();
</del><ins>+ $upgrader->run();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -565,9 +566,8 @@
</span><span class="cx"> if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
</span><span class="cx"> wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
</span><span class="cx">
</span><del>- if ( !wp_next_scheduled( 'wp_auto_updates_maybe_update' ) && ! defined( 'WP_INSTALLING' ) )
- wp_schedule_event( time(), 'twicedaily', 'wp_auto_updates_maybe_update' );
-
</del><ins>+ if ( !wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) )
+ wp_schedule_event( time(), 'twicedaily', 'wp_maybe_auto_update' );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
</span><span class="lines">@@ -591,7 +591,6 @@
</span><span class="cx"> add_action( 'wp_update_themes', 'wp_update_themes' );
</span><span class="cx"> add_action( 'upgrader_process_complete', 'wp_update_themes' );
</span><span class="cx">
</span><del>-// Automatic Updates - Cron callback
-add_action( 'wp_auto_updates_maybe_update', 'wp_auto_updates_maybe_update' );
</del><ins>+add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
</ins><span class="cx">
</span><span class="cx"> add_action('init', 'wp_schedule_update_checks');
</span></span></pre>
</div>
</div>
</body>
</html>