X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..6c8f14c09105d0afa4c1574215c59b5021040e76:/wp-includes/update.php diff --git a/wp-includes/update.php b/wp-includes/update.php index 7fdaede3..b6205063 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -58,6 +58,7 @@ function wp_version_check() { $multisite_enabled = 1; } else { $user_count = count_users( ); + $user_count = $user_count['total_users']; $multisite_enabled = 0; $num_blogs = 1; $wp_install = home_url( '/' ); @@ -70,7 +71,7 @@ function wp_version_check() { 'mysql' => $mysql_version, 'local_package' => isset( $wp_local_package ) ? $wp_local_package : '', 'blogs' => $num_blogs, - 'users' => $user_count['total_users'], + 'users' => $user_count, 'multisite_enabled' => $multisite_enabled ); @@ -154,14 +155,14 @@ function wp_update_plugins() { // Check for update on a different schedule, depending on the page. switch ( current_filter() ) { case 'load-update-core.php' : - $timeout = 60; // 1 min + $timeout = MINUTE_IN_SECONDS; break; case 'load-plugins.php' : case 'load-update.php' : - $timeout = 3600; // 1 hour + $timeout = HOUR_IN_SECONDS; break; default : - $timeout = 43200; // 12 hours + $timeout = 12 * HOUR_IN_SECONDS; } $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); @@ -263,14 +264,14 @@ function wp_update_themes() { // Check for update on a different schedule, depending on the page. switch ( current_filter() ) { case 'load-update-core.php' : - $timeout = 60; // 1 min + $timeout = MINUTE_IN_SECONDS; break; case 'load-themes.php' : case 'load-update.php' : - $timeout = 3600; // 1 hour + $timeout = HOUR_IN_SECONDS; break; default : - $timeout = 43200; // 12 hours + $timeout = 12 * HOUR_IN_SECONDS; } $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time( ) - $last_update->last_checked ); @@ -278,8 +279,6 @@ function wp_update_themes() { if ( $time_not_changed ) { $theme_changed = false; foreach ( $checked as $slug => $v ) { - $update_request->checked[ $slug ] = $v; - if ( !isset( $last_update->checked[ $slug ] ) || strval($last_update->checked[ $slug ]) !== strval($v) ) $theme_changed = true; } @@ -353,17 +352,17 @@ function wp_get_update_data() { } $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress']; - $update_title = array(); + $titles = array(); if ( $counts['wordpress'] ) - $update_title[] = sprintf(__('%d WordPress Update'), $counts['wordpress']); + $titles['wordpress'] = sprintf( __( '%d WordPress Update'), $counts['wordpress'] ); if ( $counts['plugins'] ) - $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $counts['plugins']), $counts['plugins']); + $titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] ); if ( $counts['themes'] ) - $update_title[] = sprintf(_n('%d Theme Update', '%d Theme Updates', $counts['themes']), $counts['themes']); + $titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] ); - $update_title = ! empty( $update_title ) ? esc_attr( implode( ', ', $update_title ) ) : ''; + $update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : ''; - return array( 'counts' => $counts, 'title' => $update_title ); + return apply_filters( 'wp_get_update_data', array( 'counts' => $counts, 'title' => $update_title ), $titles ); } function _maybe_update_core() { @@ -372,7 +371,7 @@ function _maybe_update_core() { $current = get_site_transient( 'update_core' ); if ( isset( $current->last_checked ) && - 43200 > ( time() - $current->last_checked ) && + 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) && isset( $current->version_checked ) && $current->version_checked == $wp_version ) return; @@ -391,7 +390,7 @@ function _maybe_update_core() { */ function _maybe_update_plugins() { $current = get_site_transient( 'update_plugins' ); - if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) ) + if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) ) return; wp_update_plugins(); } @@ -407,7 +406,7 @@ function _maybe_update_plugins() { */ function _maybe_update_themes( ) { $current = get_site_transient( 'update_themes' ); - if ( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) ) + if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time( ) - $current->last_checked ) ) return; wp_update_themes();