From 0d86b04b4a626d523623766a6c9f3998cdc61a95 Mon Sep 17 00:00:00 2001 From: Candy Tsai Date: Thu, 28 Mar 2024 15:37:21 +0800 Subject: [PATCH 1/6] Load Odyssey Stats for simple sites --- .../src/class-jetpack-mu-wpcom.php | 8 ++++++++ .../wpcom-simple-odyssey-stats.php | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 projects/packages/jetpack-mu-wpcom/src/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php 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 cdaa8f1297b29..767bdd86bc128 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 @@ -46,6 +46,7 @@ public static function init() { if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { add_action( 'plugins_loaded', array( __CLASS__, 'load_verbum_comments' ) ); add_action( 'wp_loaded', array( __CLASS__, 'load_verbum_comments_admin' ) ); + add_action( 'plugins_loaded', array( __CLASS__, 'load_wpcom_simple_odyssey_stats' ) ); } // Unified navigation fix for changes in WordPress 6.2. @@ -278,4 +279,11 @@ public static function load_verbum_comments_admin() { public static function load_wpcom_command_palette() { require_once __DIR__ . '/features/wpcom-command-palette/wpcom-command-palette.php'; } + + /** + * Load Odyssey Stats in Simple sites. + */ + public static function load_wpcom_simple_odyssey_stats() { + require_once __DIR__ . '/features/wpcom-odyssey-stats/wpcom-odyssey-stats.php'; + } } diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php new file mode 100644 index 0000000000000..54ad8a8103a01 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php @@ -0,0 +1,16 @@ + Date: Thu, 28 Mar 2024 15:39:00 +0800 Subject: [PATCH 2/6] Changelog --- .../jetpack-mu-wpcom/changelog/add-wpcom-simple-odyssey-stats | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/add-wpcom-simple-odyssey-stats diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-wpcom-simple-odyssey-stats b/projects/packages/jetpack-mu-wpcom/changelog/add-wpcom-simple-odyssey-stats new file mode 100644 index 0000000000000..a7be0df23cfb5 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-wpcom-simple-odyssey-stats @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Add Odyssey Stats to wpcom Simple Site From d74145e96bddd1f74387fc1fdfafba85302013b4 Mon Sep 17 00:00:00 2001 From: Candy Tsai Date: Thu, 28 Mar 2024 18:21:34 +0800 Subject: [PATCH 3/6] Fix file name to wpcom-simple-odyssey-stats.php --- .../packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 767bdd86bc128..48c8cf8d37d89 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 @@ -284,6 +284,6 @@ public static function load_wpcom_command_palette() { * Load Odyssey Stats in Simple sites. */ public static function load_wpcom_simple_odyssey_stats() { - require_once __DIR__ . '/features/wpcom-odyssey-stats/wpcom-odyssey-stats.php'; + require_once __DIR__ . '/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php'; } } From 5852d3e6bdd6f1307e9d987fa46aecf1138268ad Mon Sep 17 00:00:00 2001 From: DustyReagan Date: Thu, 28 Mar 2024 16:24:16 -0500 Subject: [PATCH 4/6] Make Phan happy --- projects/packages/jetpack-mu-wpcom/.phan/config.php | 12 +++++++++++- .../wpcom-simple-odyssey-stats.php | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/projects/packages/jetpack-mu-wpcom/.phan/config.php b/projects/packages/jetpack-mu-wpcom/.phan/config.php index 470bc267e2f52..d12135b6a0250 100644 --- a/projects/packages/jetpack-mu-wpcom/.phan/config.php +++ b/projects/packages/jetpack-mu-wpcom/.phan/config.php @@ -10,4 +10,14 @@ // Require base config. require __DIR__ . '/../../../../.phan/config.base.php'; -return make_phan_config( dirname( __DIR__ ) ); +$root = dirname( __DIR__, 4 ); + +return make_phan_config( + dirname( __DIR__ ), + array( + 'parse_file_list' => array( + "$root/projects/packages/stats-admin/src/class-dashboard.php", + "$root/projects/plugins/jetpack/class-jetpack-stats-dashboard-widget.php", + ), + ) +); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php index 54ad8a8103a01..39592e3f70e56 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php @@ -12,5 +12,7 @@ /** * Load the Odyssey stats widget in the Dashboard. */ -require_once JETPACK_PLUGIN_LOADER_PATH . '/class-jetpack-stats-dashboard-widget.php'; -add_action( 'wp_dashboard_setup', array( new Jetpack_Stats_Dashboard_Widget(), 'init' ) ); +if ( defined( 'JETPACK_PLUGIN_LOADER_PATH' ) ) { + require_once JETPACK_PLUGIN_LOADER_PATH . '/class-jetpack-stats-dashboard-widget.php'; + add_action( 'wp_dashboard_setup', array( new Jetpack_Stats_Dashboard_Widget(), 'init' ) ); +} From d2921a86ba1f070853daacefae98256f69dacaf9 Mon Sep 17 00:00:00 2001 From: DustyReagan Date: Thu, 28 Mar 2024 16:36:51 -0500 Subject: [PATCH 5/6] Run tools/fixup-project-versions.sh to make linter happy --- projects/packages/jetpack-mu-wpcom/composer.json | 2 +- projects/packages/jetpack-mu-wpcom/package.json | 2 +- .../packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php | 2 +- .../mu-wpcom-plugin/changelog/add-wpcom-simple-odyssey-stats | 5 +++++ projects/plugins/mu-wpcom-plugin/composer.json | 2 +- projects/plugins/mu-wpcom-plugin/composer.lock | 4 ++-- projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php | 2 +- projects/plugins/mu-wpcom-plugin/package.json | 2 +- 8 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 projects/plugins/mu-wpcom-plugin/changelog/add-wpcom-simple-odyssey-stats diff --git a/projects/packages/jetpack-mu-wpcom/composer.json b/projects/packages/jetpack-mu-wpcom/composer.json index 5eef12c6b5bd2..f78ed35c946ae 100644 --- a/projects/packages/jetpack-mu-wpcom/composer.json +++ b/projects/packages/jetpack-mu-wpcom/composer.json @@ -51,7 +51,7 @@ }, "autotagger": true, "branch-alias": { - "dev-trunk": "5.21.x-dev" + "dev-trunk": "5.22.x-dev" }, "textdomain": "jetpack-mu-wpcom", "version-constants": { diff --git a/projects/packages/jetpack-mu-wpcom/package.json b/projects/packages/jetpack-mu-wpcom/package.json index 986ea39ed4e75..22c85edff1efb 100644 --- a/projects/packages/jetpack-mu-wpcom/package.json +++ b/projects/packages/jetpack-mu-wpcom/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom", - "version": "5.21.0", + "version": "5.22.0-alpha", "description": "Enhances your site with features powered by WordPress.com", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/jetpack-mu-wpcom/#readme", "bugs": { 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 48c8cf8d37d89..4ba062e00f433 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 @@ -13,7 +13,7 @@ * Jetpack_Mu_Wpcom main class. */ class Jetpack_Mu_Wpcom { - const PACKAGE_VERSION = '5.21.0'; + const PACKAGE_VERSION = '5.22.0-alpha'; const PKG_DIR = __DIR__ . '/../'; const BASE_DIR = __DIR__ . '/'; const BASE_FILE = __FILE__; diff --git a/projects/plugins/mu-wpcom-plugin/changelog/add-wpcom-simple-odyssey-stats b/projects/plugins/mu-wpcom-plugin/changelog/add-wpcom-simple-odyssey-stats new file mode 100644 index 0000000000000..9aa70e3ec1f75 --- /dev/null +++ b/projects/plugins/mu-wpcom-plugin/changelog/add-wpcom-simple-odyssey-stats @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Updated composer.lock. + + diff --git a/projects/plugins/mu-wpcom-plugin/composer.json b/projects/plugins/mu-wpcom-plugin/composer.json index 552536480e532..56c3ffe394edf 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.json +++ b/projects/plugins/mu-wpcom-plugin/composer.json @@ -46,6 +46,6 @@ ] }, "config": { - "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_1_10" + "autoloader-suffix": "d9d132a783958a00a2c7cccff60ca42d_jetpack_mu_wpcom_pluginⓥ2_1_11_alpha" } } diff --git a/projects/plugins/mu-wpcom-plugin/composer.lock b/projects/plugins/mu-wpcom-plugin/composer.lock index 2dfa7caed3467..d0f58a55b1ba1 100644 --- a/projects/plugins/mu-wpcom-plugin/composer.lock +++ b/projects/plugins/mu-wpcom-plugin/composer.lock @@ -129,7 +129,7 @@ "dist": { "type": "path", "url": "../../packages/jetpack-mu-wpcom", - "reference": "ffb0929d64dac5ad55847b4b4ed74469efaea15e" + "reference": "0b49970bdde8c3c05388592c86db00b2888f6dd4" }, "require": { "automattic/jetpack-assets": "@dev", @@ -152,7 +152,7 @@ }, "autotagger": true, "branch-alias": { - "dev-trunk": "5.21.x-dev" + "dev-trunk": "5.22.x-dev" }, "textdomain": "jetpack-mu-wpcom", "version-constants": { diff --git a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php index 9caa2b01e23a0..440efcd9bf6cb 100644 --- a/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php +++ b/projects/plugins/mu-wpcom-plugin/mu-wpcom-plugin.php @@ -3,7 +3,7 @@ * * Plugin Name: WordPress.com Features * Description: Test plugin for the jetpack-mu-wpcom package - * Version: 2.1.10 + * Version: 2.1.11-alpha * Author: Automattic * License: GPLv2 or later * Text Domain: jetpack-mu-wpcom-plugin diff --git a/projects/plugins/mu-wpcom-plugin/package.json b/projects/plugins/mu-wpcom-plugin/package.json index 3242b670708b3..1ba776776ed9e 100644 --- a/projects/plugins/mu-wpcom-plugin/package.json +++ b/projects/plugins/mu-wpcom-plugin/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-mu-wpcom-plugin", - "version": "2.1.10", + "version": "2.1.11-alpha", "description": "Test plugin for the jetpack-mu-wpcom package", "homepage": "https://jetpack.com", "bugs": { From 024cb38b502a396c11bbb5edf15b4b2f94a3d652 Mon Sep 17 00:00:00 2001 From: Candy Tsai Date: Fri, 29 Mar 2024 15:31:55 +0800 Subject: [PATCH 6/6] Add wpcom_is_nav_redesign_enabled check --- .../packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 4ba062e00f433..4df3757a742ba 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 @@ -284,6 +284,8 @@ public static function load_wpcom_command_palette() { * Load Odyssey Stats in Simple sites. */ public static function load_wpcom_simple_odyssey_stats() { - require_once __DIR__ . '/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php'; + if ( function_exists( 'wpcom_is_nav_redesign_enabled' ) && wpcom_is_nav_redesign_enabled() ) { + require_once __DIR__ . '/features/wpcom-simple-odyssey-stats/wpcom-simple-odyssey-stats.php'; + } } }