From afa2d8c796d6fe162e441b233915c33a3a151458 Mon Sep 17 00:00:00 2001
From: Paul Biron <paul@sparrowhawkcomputing.com>
Date: Sun, 21 Jun 2020 10:09:29 -0600
Subject: [PATCH] Remove unnecessary check for `DISABLE_WP_CRON` being true
 from `wp_get_auto_update_message()`.

Also changes all returned strings so they begin with `Automatic update...` and so the function has a single return.
---
 src/wp-admin/includes/update.php | 44 +++++++++++++++-----------------
 1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/src/wp-admin/includes/update.php b/src/wp-admin/includes/update.php
index 29d5261212..469b383323 100644
--- a/src/wp-admin/includes/update.php
+++ b/src/wp-admin/includes/update.php
@@ -984,30 +984,26 @@ function wp_get_auto_update_message() {
 
 	// Check if event exists.
 	if ( false === $next_update_time ) {
-		return __( 'There may be a problem with WP-Cron. Automatic update not scheduled.' );
-	}
-
-	// See if cron is disabled
-	$cron_disabled = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON;
-	if ( $cron_disabled ) {
-		return __( 'WP-Cron is disabled. Automatic updates not available.' );
-	}
-
-	$time_to_next_update = human_time_diff( intval( $next_update_time ) );
-
-	// See if cron is overdue.
-	$overdue = ( time() - $next_update_time ) > 0;
-	if ( $overdue ) {
-		return sprintf(
-			/* translators: Duration that WP-Cron has been overdue. */
-			__( 'There may be a problem with WP-Cron. Automatic update overdue by %s.' ),
-			$time_to_next_update
-		);
+		$message = __( 'Automatic update not scheduled. There may be a problem with WP-Cron.' );
 	} else {
-		return sprintf(
-			/* translators: Time until the next update. */
-			__( 'Auto-update scheduled in %s.' ),
-			$time_to_next_update
-		);
+		$time_to_next_update = human_time_diff( intval( $next_update_time ) );
+
+		// See if cron is overdue.
+		$overdue = ( time() - $next_update_time ) > 0;
+		if ( $overdue ) {
+			$message = sprintf(
+				/* translators: Duration that WP-Cron has been overdue. */
+				__( 'Automatic update overdue by %s. There may be a problem with WP-Cron.' ),
+				$time_to_next_update
+			);
+		} else {
+			$message = sprintf(
+				/* translators: Time until the next update. */
+				__( 'Automatic update scheduled in %s.' ),
+				$time_to_next_update
+			);
+		}
 	}
+
+	return $message;
 }
-- 
2.26.2.windows.1

