Make WordPress Core

Changeset 48667


Ignore:
Timestamp:
07/28/2020 04:13:03 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Upgrade/Install: Disable the plugin/theme auto-updates UI if AUTOMATIC_UPDATER_DISABLED is defined and set as true.

Props pbiron, dd32.
Fixes #50798. See #50280.

File:
1 edited

Legend:

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

    r48660 r48667  
    10151015 */
    10161016function wp_is_auto_update_enabled_for_type( $type ) {
     1017    if ( ! class_exists( 'WP_Automatic_Updater' ) ) {
     1018        require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php';
     1019    }
     1020
     1021    $updater = new WP_Automatic_Updater();
     1022    $enabled = ! $updater->is_disabled();
     1023
    10171024    switch ( $type ) {
    10181025        case 'plugin':
     
    10241031             * @param bool $enabled True if plugins auto-update is enabled, false otherwise.
    10251032             */
    1026             return apply_filters( 'plugins_auto_update_enabled', true );
     1033            return apply_filters( 'plugins_auto_update_enabled', $enabled );
    10271034        case 'theme':
    10281035            /**
     
    10331040             * @param bool $enabled True if themes auto-update is enabled, false otherwise.
    10341041             */
    1035             return apply_filters( 'themes_auto_update_enabled', true );
     1042            return apply_filters( 'themes_auto_update_enabled', $enabled );
    10361043    }
    10371044
Note: See TracChangeset for help on using the changeset viewer.