Skip to content

Commit 846f96b

Browse files
committed
Lets update the options if it has the old ips configured
1 parent 9aa74d9 commit 846f96b

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

WP_Auth0.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
define( 'WPA0_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
1111
define( 'WPA0_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
1212
define( 'WPA0_LANG', 'wp-auth0' );
13-
define( 'AUTH0_DB_VERSION', 12 );
13+
define( 'AUTH0_DB_VERSION', 13 );
1414
define( 'WPA0_VERSION', '3.2.16' );
1515

1616
/**

lib/WP_Auth0_DBManager.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,24 @@ public function install_db() {
114114

115115
if ( $this->current_db_version < 12 ) {
116116

117-
if ( strpos( $cdn_url, '10.' ) === false ) {
118-
$options->set('use_lock_10', false);
119-
} else {
120-
$options->set('use_lock_10', true);
121-
}
117+
if ( strpos( $cdn_url, '10.' ) === false ) {
118+
$options->set('use_lock_10', false);
119+
} else {
120+
$options->set('use_lock_10', true);
121+
}
122122

123-
}
123+
}
124+
125+
if ( $this->current_db_version < 13 ) {
126+
$ips = $options->get('migration_ips');
127+
$oldips = '138.91.154.99,54.221.228.15,54.183.64.135,54.67.77.38,54.67.15.170,54.183.204.205,54.173.21.107,54.85.173.28';
128+
129+
$ipCheck = new WP_Auth0_Ip_Check($options);
130+
131+
if ( $ips === $oldips ) {
132+
$options->set('migration_ips', $ipCheck->get_ip_by_region('us'));
133+
}
134+
}
124135

125136
$this->current_db_version = AUTH0_DB_VERSION;
126137
update_option( 'auth0_db_version', AUTH0_DB_VERSION );

lib/WP_Auth0_Ip_Check.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public function get_ips_by_domain( $domain ) {
2626
return null;
2727
}
2828

29+
public function get_ip_by_region($region) {
30+
return $this->valid_webtask_ips[$region];
31+
}
32+
2933
protected function get_request_ip() {
3034
$valid_proxy_ip = $this->a0_options->get( 'valid_proxy_ip' );
3135

0 commit comments

Comments
 (0)