From efdba220e6bb3875991874c7f6db75c19765cf34 Mon Sep 17 00:00:00 2001 From: TimothyBlynJacobs Date: Mon, 7 Dec 2020 15:59:04 +0000 Subject: [PATCH] App Passwords: Store the "in use" option in the main network options. Whether App Passwords are being used is a global featurel, not a per-network feature. This fixes issues on Multi Network installs if App Passwords are used on a different network from where they were created. Props spacedmonkey. Fixes #51939. See [49752]. Built from https://develop.svn.wordpress.org/trunk@49764 git-svn-id: http://core.svn.wordpress.org/trunk@49487 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/upgrade.php | 3 ++- wp-includes/class-wp-application-passwords.php | 8 +++++--- wp-includes/version.php | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 513e00b734..863454a8c2 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -2288,7 +2288,8 @@ function upgrade_560() { ); if ( ! empty( $results ) ) { - update_site_option( WP_Application_Passwords::OPTION_KEY_IN_USE, 1 ); + $network_id = get_main_network_id(); + update_network_option( $network_id, WP_Application_Passwords::OPTION_KEY_IN_USE, 1 ); } } } diff --git a/wp-includes/class-wp-application-passwords.php b/wp-includes/class-wp-application-passwords.php index 003b888b4c..f09ca1a1c9 100644 --- a/wp-includes/class-wp-application-passwords.php +++ b/wp-includes/class-wp-application-passwords.php @@ -50,7 +50,8 @@ class WP_Application_Passwords { * @return bool */ public static function is_in_use() { - return (bool) get_site_option( self::OPTION_KEY_IN_USE ); + $network_id = get_main_network_id(); + return (bool) get_network_option( $network_id, self::OPTION_KEY_IN_USE ); } /** @@ -89,8 +90,9 @@ class WP_Application_Passwords { return new WP_Error( 'db_error', __( 'Could not save application password.' ) ); } - if ( ! get_site_option( self::OPTION_KEY_IN_USE ) ) { - update_site_option( self::OPTION_KEY_IN_USE, true ); + $network_id = get_main_network_id(); + if ( ! get_network_option( $network_id, self::OPTION_KEY_IN_USE ) ) { + update_network_option( $network_id, self::OPTION_KEY_IN_USE, true ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 58c09ec25b..1174e18373 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-alpha-49763'; +$wp_version = '5.7-alpha-49764'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.