]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/update.php
WordPress 4.4.1
[autoinstalls/wordpress.git] / wp-includes / update.php
index c39322ee46266b80586a4b691c710eea3e482da4..100f77d803d953d01330ad6dc53bfc8ff02e6a7e 100644 (file)
@@ -22,7 +22,7 @@
  * @param bool  $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set.
  */
 function wp_version_check( $extra_stats = array(), $force_check = false ) {
-       if ( defined( 'WP_INSTALLING' ) ) {
+       if ( wp_installing() ) {
                return;
        }
 
@@ -86,14 +86,15 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
        }
 
        $query = array(
-               'version'           => $wp_version,
-               'php'               => $php_version,
-               'locale'            => $locale,
-               'mysql'             => $mysql_version,
-               'local_package'     => isset( $wp_local_package ) ? $wp_local_package : '',
-               'blogs'             => $num_blogs,
-               'users'             => $user_count,
-               'multisite_enabled' => $multisite_enabled,
+               'version'            => $wp_version,
+               'php'                => $php_version,
+               'locale'             => $locale,
+               'mysql'              => $mysql_version,
+               'local_package'      => isset( $wp_local_package ) ? $wp_local_package : '',
+               'blogs'              => $num_blogs,
+               'users'              => $user_count,
+               'multisite_enabled'  => $multisite_enabled,
+               'initial_db_version' => get_site_option( 'initial_db_version' ),
        );
 
        $post_body = array(
@@ -187,7 +188,7 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
  * @param array $extra_stats Extra statistics to report to the WordPress.org API.
  */
 function wp_update_plugins( $extra_stats = array() ) {
-       if ( defined( 'WP_INSTALLING' ) ) {
+       if ( wp_installing() ) {
                return;
        }
 
@@ -344,7 +345,7 @@ function wp_update_plugins( $extra_stats = array() ) {
  * @param array $extra_stats Extra statistics to report to the WordPress.org API.
  */
 function wp_update_themes( $extra_stats = array() ) {
-       if ( defined( 'WP_INSTALLING' ) ) {
+       if ( wp_installing() ) {
                return;
        }
        global $wp_version;
@@ -636,28 +637,17 @@ function _maybe_update_themes() {
  * @since 3.1.0
  */
 function wp_schedule_update_checks() {
-       if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )
+       if ( ! wp_next_scheduled( 'wp_version_check' ) && ! wp_installing() )
                wp_schedule_event(time(), 'twicedaily', 'wp_version_check');
 
-       if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
+       if ( ! wp_next_scheduled( 'wp_update_plugins' ) && ! wp_installing() )
                wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
 
-       if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
+       if ( ! wp_next_scheduled( 'wp_update_themes' ) && ! wp_installing() )
                wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
 
-       if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {
-               // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site.
-               $next = strtotime( 'today 7am' );
-               $now = time();
-               // Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now.
-               while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) {
-                       $next += 12 * HOUR_IN_SECONDS;
-               }
-               $next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
-               // Add a random number of minutes, so we don't have all sites trying to update exactly on the hour
-               $next = $next + rand( 0, 59 ) * MINUTE_IN_SECONDS;
-               wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' );
-       }
+       if ( ( wp_next_scheduled( 'wp_maybe_auto_update' ) > ( time() + HOUR_IN_SECONDS ) ) && ! wp_installing() )
+               wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
 }
 
 /**