WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/23/2020 10:22:33 PM (18 months ago)
Author:
whyisjake
Message:

Security: Remove unnecessary DISABLE_WP_CRON check in plugin and theme automatic updates.

Fixes #50436.

Props johnbillion, audrasjb, bookdude13, pbiron, arpitgshah.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update.php

    r48097 r48147  
    985985    // Check if event exists.
    986986    if ( false === $next_update_time ) {
    987         return __( 'There may be a problem with WP-Cron. Automatic update not scheduled.' );
    988     }
    989 
    990     // See if cron is disabled
    991     $cron_disabled = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON;
    992     if ( $cron_disabled ) {
    993         return __( 'WP-Cron is disabled. Automatic updates not available.' );
    994     }
    995 
    996     $time_to_next_update = human_time_diff( intval( $next_update_time ) );
    997 
    998     // See if cron is overdue.
    999     $overdue = ( time() - $next_update_time ) > 0;
    1000     if ( $overdue ) {
    1001         return sprintf(
    1002             /* translators: Duration that WP-Cron has been overdue. */
    1003             __( 'There may be a problem with WP-Cron. Automatic update overdue by %s.' ),
    1004             $time_to_next_update
    1005         );
     987        $message = __( 'Auto-update update not scheduled. There may be a problem with WP-Cron.' );
    1006988    } else {
    1007         return sprintf(
    1008             /* translators: Time until the next update. */
    1009             __( 'Auto-update scheduled in %s.' ),
    1010             $time_to_next_update
    1011         );
    1012     }
    1013 }
     989        $time_to_next_update = human_time_diff( intval( $next_update_time ) );
     990
     991        // See if cron is overdue.
     992        $overdue = ( time() - $next_update_time ) > 0;
     993        if ( $overdue ) {
     994            $message = sprintf(
     995                /* translators: Duration that WP-Cron has been overdue. */
     996                __( 'Auto-update update overdue by %s. There may be a problem with WP-Cron.' ),
     997                $time_to_next_update
     998            );
     999        } else {
     1000            $message = sprintf(
     1001                /* translators: Time until the next update. */
     1002                __( 'Auto-update update scheduled in %s.' ),
     1003                $time_to_next_update
     1004            );
     1005        }
     1006    }
     1007
     1008    return $message;
     1009}
Note: See TracChangeset for help on using the changeset viewer.