From 3db534a9889bcd3a285ff29d42b1c13ca27b9f80 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 28 Jul 2020 16:15:03 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@48667 git-svn-id: http://core.svn.wordpress.org/trunk@48429 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/update.php | 11 +++++++++-- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index 7570905548..0641b1e898 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -1014,6 +1014,13 @@ function wp_recovery_mode_nag() { * @return bool True if auto-updates are enabled for `$type`, false otherwise. */ function wp_is_auto_update_enabled_for_type( $type ) { + if ( ! class_exists( 'WP_Automatic_Updater' ) ) { + require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php'; + } + + $updater = new WP_Automatic_Updater(); + $enabled = ! $updater->is_disabled(); + switch ( $type ) { case 'plugin': /** @@ -1023,7 +1030,7 @@ function wp_is_auto_update_enabled_for_type( $type ) { * * @param bool $enabled True if plugins auto-update is enabled, false otherwise. */ - return apply_filters( 'plugins_auto_update_enabled', true ); + return apply_filters( 'plugins_auto_update_enabled', $enabled ); case 'theme': /** * Filters whether themes auto-update is enabled. @@ -1032,7 +1039,7 @@ function wp_is_auto_update_enabled_for_type( $type ) { * * @param bool $enabled True if themes auto-update is enabled, false otherwise. */ - return apply_filters( 'themes_auto_update_enabled', true ); + return apply_filters( 'themes_auto_update_enabled', $enabled ); } return false; diff --git a/wp-includes/version.php b/wp-includes/version.php index 5d66aab86f..f371534b47 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-beta4-48666'; +$wp_version = '5.5-beta4-48667'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.