Skip to content

Commit c6dc08a

Browse files
committed
Updated mu-plugin.
1 parent b397652 commit c6dc08a

1 file changed

Lines changed: 30 additions & 10 deletions

File tree

src/Admin/Upgrades.php

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class Upgrades {
2626
/**
2727
* Constructor for Upgrades.
2828
*
29-
* @return void
3029
* @since 1.3.0
3130
* @access public
31+
* @return void
3232
*/
3333
public function __construct() {
3434
add_action( 'init', [ $this, 'run' ] );
@@ -38,13 +38,13 @@ public function __construct() {
3838
* Register routines for upgrades.
3939
* This is intended for automatic upgrade routines having less resource intensive tasks.
4040
*
41+
* @since 1.3.0
42+
* @access public
4143
* @return void
4244
*
4345
* @throws Exception
4446
*
4547
* @codeCoverageIgnore
46-
* @since 1.3.0
47-
* @access public
4848
*/
4949
public function run() {
5050
$plausible_analytics_version = get_option( 'plausible_analytics_version' );
@@ -98,17 +98,21 @@ public function run() {
9898
$this->upgrade_to_254();
9999
}
100100

101+
if ( version_compare( $plausible_analytics_version, '2.5.8', '<' ) ) {
102+
$this->upgrade_to_258();
103+
}
104+
101105
// Add required upgrade routines for future versions here.
102106
}
103107

104108
/**
105109
* Upgrade routine for 1.2.5
106110
* Cleans Custom Domain related options from database, as it was removed in this version.
107111
*
108-
* @return void
109-
* @codeCoverageIgnore
110112
* @since 1.2.5
111113
* @access public
114+
* @return void
115+
* @codeCoverageIgnore
112116
*/
113117
public function upgrade_to_125() {
114118
$old_settings = Helpers::get_settings();
@@ -138,13 +142,12 @@ public function upgrade_to_125() {
138142
/**
139143
* Get rid of the previous "example.com" default for self_hosted_domain.
140144
*
145+
* @since 1.2.6
141146
* @return void
142147
* @codeCoverageIgnore
143-
* @since 1.2.6
144148
*/
145149
public function upgrade_to_126() {
146150
$old_settings = Helpers::get_settings();
147-
$new_settings = $old_settings;
148151

149152
if ( ! empty( $old_settings['self_hosted_domain'] ) && strpos( $old_settings['self_hosted_domain'], 'example.com' ) !== false ) {
150153
Helpers::update_setting( 'self_hosted_domain', '' );
@@ -265,11 +268,11 @@ public function upgrade_to_210() {
265268
/**
266269
* If EDD is active and Ecommerce is enabled, create goals after updating the plugin.
267270
*
271+
* @since v2.3.0
272+
*
268273
* @return void
269274
*
270275
* @codeCoverageIgnore because all we'd be doing is testing the Plugins API.
271-
* @since v2.3.0
272-
*
273276
*/
274277
public function upgrade_to_230() {
275278
$settings = Helpers::get_settings();
@@ -367,7 +370,7 @@ public function upgrade_to_254() {
367370
return;
368371
}
369372

370-
// Show CE notice if self-hosted domain is set, otherwise show Cloud notice.
373+
// Show CE notice if Self-hosted Domain is set, otherwise show Cloud notice.
371374
if ( ! empty( $self_hosted_domain ) ) {
372375
add_action( 'admin_notices', [ $this, 'show_ce_api_token_notice' ] );
373376

@@ -377,6 +380,23 @@ public function upgrade_to_254() {
377380
add_action( 'admin_notices', [ $this, 'show_cloud_api_token_notice' ] );
378381
}
379382

383+
/**
384+
* Updates the Proxy Module if Proxy is enabled.
385+
*
386+
* @return void
387+
*/
388+
public function upgrade_to_258() {
389+
$proxy_enabled = Helpers::proxy_enabled();
390+
391+
if ( $proxy_enabled ) {
392+
$installer = new Module();
393+
394+
$installer->install();
395+
}
396+
397+
update_option( 'plausible_analytics_version', '2.5.8' );
398+
}
399+
380400
/**
381401
* Display a notice to CE users that haven't entered an API token yet.
382402
*

0 commit comments

Comments
 (0)