- 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' );
+/**
+ * Clear existing update caches for plugins, themes, and core.
+ *
+ * @since 4.1.0
+ */
+function wp_clean_update_cache() {
+ if ( function_exists( 'wp_clean_plugins_cache' ) ) {
+ wp_clean_plugins_cache();
+ } else {
+ delete_site_transient( 'update_plugins' );