diff --git a/bootstrap.php b/bootstrap.php index 8ec2f3b..bed3243 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -138,29 +138,6 @@ function nfd_create_event_queue_table() { dbDelta( $sql ); } -/** - * Update affiliation code in option table - * - * @param object $container Container information - */ -function nfd_update_options_table( $container ) { - $brand_code = array( - 'bluehost' => '86241', - 'hostgator' => '57686', - 'web' => '86239', - 'crazy-domains' => '57687', - 'default' => '86240', - ); - $brand = $container->plugin()->id; - if ( is_plugin_active( 'jetpack/jetpack.php' ) ) { - if ( empty( $brand ) || ! array_key_exists( $brand, $brand_code ) ) { - $brand = 'default'; - } - $jetpack_affiliate_code = get_option( 'jetpack_affiliate_code' ); - ! $jetpack_affiliate_code && update_option( 'jetpack_affiliate_code', $brand_code[ $brand ] ); - } -} - /** * Drop the event queue table */ diff --git a/upgrades/2.4.22.php b/upgrades/2.4.22.php index 0c718d7..f0a8580 100644 --- a/upgrades/2.4.22.php +++ b/upgrades/2.4.22.php @@ -5,6 +5,20 @@ add_action( 'newfold_container_set', function ( Container $container ) { - nfd_update_options_table( $container ); + $brand_code = array( + 'bluehost' => '86241', + 'hostgator' => '57686', + 'web' => '86239', + 'crazy-domains' => '57687', + 'default' => '86240', + ); + $brand = $container->plugin()->id; + if ( is_plugin_active( 'jetpack/jetpack.php' ) ) { + if ( empty( $brand ) || ! array_key_exists( $brand, $brand_code ) ) { + $brand = 'default'; + } + $jetpack_affiliate_code = get_option( 'jetpack_affiliate_code' ); + ! $jetpack_affiliate_code && update_option( 'jetpack_affiliate_code', $brand_code[ $brand ] ); + } } );