From 5cc8dfcaff89c75419f3492c148e1a876ce51e60 Mon Sep 17 00:00:00 2001 From: Griffith Chen Date: Thu, 23 Jan 2025 15:12:46 +0800 Subject: [PATCH] MU WPCOM: Add more defensive checks when loading the Coming Soon feature (#41273) --- ...ack-mu-wpcom-load-coming-soon-remove-etk-version-check | 4 ++++ .../jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/update-jetpack-mu-wpcom-load-coming-soon-remove-etk-version-check diff --git a/projects/packages/jetpack-mu-wpcom/changelog/update-jetpack-mu-wpcom-load-coming-soon-remove-etk-version-check b/projects/packages/jetpack-mu-wpcom/changelog/update-jetpack-mu-wpcom-load-coming-soon-remove-etk-version-check new file mode 100644 index 0000000000000..3af6159f761de --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/update-jetpack-mu-wpcom-load-coming-soon-remove-etk-version-check @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Coming Soon: Add more checks to the ETK version comparison. diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 2c75170257510..deed61cbc4bdf 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -276,9 +276,13 @@ public static function load_coming_soon() { * Explicitly pass $markup = false in get_plugin_data to avoid indirectly calling wptexturize that could cause unintended side effects. * See: https://developer.wordpress.org/reference/functions/get_plugin_data/ */ + $fse_plugin = 'full-site-editing/full-site-editing-plugin.php'; + $fse_plugin_path = WP_PLUGIN_DIR . '/' . $fse_plugin; $invalid_fse_version_active = - is_plugin_active( 'full-site-editing/full-site-editing-plugin.php' ) && - version_compare( get_plugin_data( WP_PLUGIN_DIR . '/full-site-editing/full-site-editing-plugin.php', false )['Version'], '3.56084', '<' ); + file_exists( $fse_plugin_path ) && + is_file( $fse_plugin_path ) && + is_plugin_active( $fse_plugin ) && + version_compare( get_plugin_data( $fse_plugin_path, false )['Version'], '3.56084', '<' ); if ( $invalid_fse_version_active ) { return;