From 20542a3696dbc1aa726cac512e2aa49350dc7f23 Mon Sep 17 00:00:00 2001 From: Matthew Reishus Date: Thu, 19 Sep 2024 10:13:28 -0500 Subject: [PATCH] wpcomsh: Remove Gutenberg site logo hotfix from 2021 (#39462) --- projects/plugins/wpcomsh/.phan/baseline.php | 3 +- .../plugins/wpcomsh/changelog/remove-logo-bug | 5 +++ .../feature-plugins/gutenberg-mods.php | 41 ------------------- 3 files changed, 6 insertions(+), 43 deletions(-) create mode 100644 projects/plugins/wpcomsh/changelog/remove-logo-bug diff --git a/projects/plugins/wpcomsh/.phan/baseline.php b/projects/plugins/wpcomsh/.phan/baseline.php index ec3c7ec2901b9..844b52eb31f0d 100644 --- a/projects/plugins/wpcomsh/.phan/baseline.php +++ b/projects/plugins/wpcomsh/.phan/baseline.php @@ -20,7 +20,6 @@ // PhanImpossibleCondition : 3 occurrences // PhanTypeArraySuspiciousNullable : 3 occurrences // PhanUndeclaredClassMethod : 3 occurrences - // PhanUndeclaredFunctionInCallable : 3 occurrences // PhanNoopNew : 2 occurrences // PhanTypeVoidArgument : 2 occurrences // PhanUndeclaredProperty : 2 occurrences @@ -35,6 +34,7 @@ // PhanTypeObjectUnsetDeclaredProperty : 1 occurrence // PhanUndeclaredClassConstant : 1 occurrence // PhanUndeclaredClassStaticProperty : 1 occurrence + // PhanUndeclaredFunctionInCallable : 1 occurrence // PhanUndeclaredMethod : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions @@ -47,7 +47,6 @@ 'endpoints/class-marketplace-webhook-response.php' => ['PhanPluginMixedKeyNoKey'], 'feature-plugins/autosave-revision.php' => ['PhanPluginRedundantAssignment', 'PhanTypeMismatchArgumentNullable'], 'feature-plugins/coblocks-mods.php' => ['PhanUndeclaredClassConstant', 'PhanUndeclaredClassMethod'], - 'feature-plugins/gutenberg-mods.php' => ['PhanUndeclaredFunctionInCallable'], 'feature-plugins/managed-plugins.php' => ['PhanRedundantCondition', 'PhanUndeclaredClassMethod', 'PhanUndeclaredFunctionInCallable'], 'feature-plugins/sensei-pro-mods.php' => ['PhanUndeclaredClassMethod'], 'footer-credit/theme-optimizations.php' => ['PhanUndeclaredConstant', 'PhanUndeclaredStaticMethod'], diff --git a/projects/plugins/wpcomsh/changelog/remove-logo-bug b/projects/plugins/wpcomsh/changelog/remove-logo-bug new file mode 100644 index 0000000000000..e1950e43965ef --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/remove-logo-bug @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Removed outdated Gutenberg hotfix from 2021 related to site logos + + diff --git a/projects/plugins/wpcomsh/feature-plugins/gutenberg-mods.php b/projects/plugins/wpcomsh/feature-plugins/gutenberg-mods.php index 064214f26f0cc..0ea0c242a2fbc 100644 --- a/projects/plugins/wpcomsh/feature-plugins/gutenberg-mods.php +++ b/projects/plugins/wpcomsh/feature-plugins/gutenberg-mods.php @@ -41,47 +41,6 @@ function wpcomsh_remove_gutenberg_experimental_menu() { remove_submenu_page( 'gutenberg', 'gutenberg-experiments' ); } -/** - * Updates the site_logo option when the custom_logo theme-mod gets updated. - * - * Registered on the `pre_set_theme_mod_custom_logo` hook. - * - * @param mixed $value Attachment ID of the custom logo or an empty value. - * @return mixed - */ -function wpcomsh_sync_custom_logo_to_site_logo( $value ) { - if ( empty( $value ) ) { - delete_option( 'site_logo' ); - } else { - update_option( 'site_logo', $value ); - } - - return $value; -} - -/** - * Hotfix a Gutenberg bug that prevents updating a logo from the Customizer. - * - * These fixes are from https://github.com/WordPress/gutenberg/pull/33179, and can be - * removed when that change is released in Gutenberg and all Atomic sites are updated. - * - * Ported from wpcom hotfix: D63662-code - */ -function wpcomsh_hotfix_gutenberg_logo_bug() { - // Only add the filter if Gutenberg is active and the current version is missing the filter. - if ( - ( defined( 'GUTENBERG_VERSION' ) || defined( 'GUTENBERG_DEVELOPMENT_MODE' ) ) && - false === has_action( 'pre_set_theme_mod_custom_logo', 'gutenberg__sync_custom_logo_to_site_logo' ) - ) { - add_filter( 'pre_set_theme_mod_custom_logo', 'wpcomsh_sync_custom_logo_to_site_logo' ); - } - - // Remove a function that can inadvertently delete your logo. - remove_action( 'update_option_site_logo', 'gutenberg__sync_site_logo_to_custom_logo', 10 ); -} -// Wait until after Gutenberg has registered the Site Logo block on the `init` action, priority 10. -add_action( 'init', 'wpcomsh_hotfix_gutenberg_logo_bug', 11 ); - /** * Hotfix a Gutenberg bug that inadvertently loads wp-reset-editor-syles stylesheet in the * iframed site editor.