do_not_run_on_fresh_install( $version ); } /** * @throws Migration_Exception */ public function up() { try { $oauth_storage = $this->storage->get_oauth(); $token = $oauth_storage->retrieveToken( TokenType::WORDPRESS ); $integration_id = $token->getIntegrationId(); if ( ! $this->api_wrapper->can_integration_upgrade( $integration_id ) ) { throw new Migration_Exception( self::MIGRATION_ERROR ); } $this->api_wrapper->upgrade_integration( $integration_id ); delete_option( 'twofas_login' ); delete_option( 'twofas_key' ); } catch ( TokenNotFoundException $e ) { throw new Migration_Exception( Notification::get( 'oauth-token-not-found' ) ); } catch ( Account_Exception $e ) { throw new Migration_Exception( self::MIGRATION_ERROR ); } } }