jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

De-Fusion: Site Logo

Open sdixon194 opened this issue 1 year ago • 3 comments

Impacted plugin

Jetpack

What

Site Logo

How

// `.min` and `rtl` asset files not included, because those are handled differently in wpcom and Jetpack.
// `modules/theme-tools/site-logo/inc/class-site-logo.php` not included, because of differences in how wpcom handles image sizes.
"$plugin_root/modules/theme-tools/site-logo.php"                         => "$wpcom_root/wp-content/mu-plugins/site-logo.php",
"$plugin_root/modules/theme-tools/site-logo/inc/compat.php"              => "$wpcom_root/wp-content/mu-plugins/site-logo/inc/compat.php",
"$plugin_root/modules/theme-tools/site-logo/inc/functions.php"           => "$wpcom_root/wp-content/mu-plugins/site-logo/inc/functions.php",
"$plugin_root/modules/theme-tools/site-logo/js/site-logo-header-text.js" => "$wpcom_root/wp-content/mu-plugins/site-logo/js/site-logo-header-text.js",

sdixon194 avatar Jul 22 '22 20:07 sdixon194

Putting this approach up for review:

  1. Prerequisite JP PR to require out-of-sync wpcom specific implementation: #25359
  2. Update main mu-plugin file to point to the Jetpack plugin path: D85249-code
  3. Cleanup obsolete Fusion refs: D85251-code

To test:

  • Patch D85249-code to sandbox. This will require the site-logo.php file from the jetpack-plugin dir.
  • Update the site-logo.php file in the jetpack-plugin dir with the changes in #25359
  • Place an error log in the wpcom specific/dir class-site-logo.php file.
  • On a sandboxed site navigate to Appearance > Customize > Logo. Make sure you see your error log indicating the correct paths have been updated and no other errors are generated.

samiff avatar Aug 02 '22 18:08 samiff

This all tests ok, except the error logging. That wasn't working for me so I then noticed by adding error logs in the Jetpack production site-logo.php file, it would get as far as site_logo_init() but wasn't making it into if ( current_theme_supports( 'site-logo' ) && ! class_exists( 'Site_Logo', false ) ) {, despite using themes that support site logos.

Have I added the code here - https://github.com/Automattic/jetpack/pull/25359/ - to the right file, by adding it to jetpack-plugin/production/modules/theme-tools/site-logo.php?

coder-karen avatar Aug 12 '22 11:08 coder-karen

@coder-karen

Have I added the code here - https://github.com/Automattic/jetpack/pull/25359 - to the right file, by adding it to jetpack-plugin/production/modules/theme-tools/site-logo.php?

Yes, and with D85249-code applied that file should be accessed. The theme would need to support site-logo though, and it seems like when I test with Twenty Fifteen, I can at least put an error log in the instance() method in the wpcom copy of wp-content/mu-plugins/site-logo/inc/class-site-logo.php and see that fire.

~~I did notice that I'll need to figure out the enqueue for site-logo-header-text.js though 🤔~~ Updated D85249-code to use the JP plugin path of that JS file.

samiff avatar Aug 12 '22 20:08 samiff

The moment I switched to Twenty Fifteen, the error log worked correctly. My mistake was choosing a few themes purely based on feature:site-logo in WordPress.com. Works well now.

coder-karen avatar Aug 15 '22 11:08 coder-karen

Jetpack PR merged: #25359 (and early sync to JP prod in D85943-code ) Update changeset: r250673-wpcom Cleanup changeset: r250675-wpcom Build cleanup: #25642

samiff avatar Aug 15 '22 17:08 samiff