* @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;
}
}
$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(
* @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;
}
* @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;
* @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' );
}
/**