WordPress.org

Make WordPress Core

Ticket #50798: 50798.diff

File 50798.diff, 1.7 KB (added by pbiron, 12 months ago)
  • src/wp-admin/includes/update.php

    From 88c4b0c9a7d2e2d5b0fcbd297cd8b5790a6546f7 Mon Sep 17 00:00:00 2001
    From: Paul Biron <paul@sparrowhawkcomputing.com>
    Date: Tue, 28 Jul 2020 10:03:21 -0600
    Subject: [PATCH] disable the plugin/theme auto-updates UI if
     AUTOMATIC_UPDATER_DISABLED is defined & true.
    
    ---
     src/wp-admin/includes/update.php | 11 +++++++++--
     1 file changed, 9 insertions(+), 2 deletions(-)
    
    diff --git a/src/wp-admin/includes/update.php b/src/wp-admin/includes/update.php
    index 7570905548..0641b1e898 100644
    a b function wp_recovery_mode_nag() { 
    10141014 * @return bool True if auto-updates are enabled for `$type`, false otherwise.
    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':
    10191026                        /**
    function wp_is_auto_update_enabled_for_type( $type ) { 
    10231030                         *
    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                        /**
    10291036                         * Filters whether themes auto-update is enabled.
    function wp_is_auto_update_enabled_for_type( $type ) { 
    10321039                         *
    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
    10381045        return false;