From 95607fb761b2951119c3334099940a722cdd024b Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:28:19 +0100 Subject: [PATCH] Added: migration script for self hosters using the (old) shared link option. --- src/Admin/Upgrades.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Admin/Upgrades.php b/src/Admin/Upgrades.php index 5f31c5f1..4a8af4d0 100644 --- a/src/Admin/Upgrades.php +++ b/src/Admin/Upgrades.php @@ -193,6 +193,14 @@ private function upgrade_to_200() { $settings[ $option_name ] = 'on'; } + /** + * Migrate the shared link option for self hosters who use it. + */ + if ( ! empty( $settings[ 'self_hosted_domain' ] ) && ! empty( $settings[ 'shared_link' ] ) ) { + $settings[ 'self_hosted_shared_link' ] = $settings[ 'shared_link' ]; + $settings[ 'shared_link' ] = ''; + } + update_option( 'plausible_analytics_settings', $settings ); update_option( 'plausible_analytics_version', '2.0.0' );