'connectors_ai_openai_api_key', 'google' => 'connectors_ai_google_api_key', 'anthropic' => 'connectors_ai_anthropic_api_key', ); /** * {@inheritDoc} * * @since 0.6.0 */ public static string $version = '0.5.0'; /** * {@inheritDoc} * * Copies legacy provider credentials to the new per-provider options. * * Reads the old combined credentials option and, for each known provider, * copies the credential to the new option only when the new option is empty. * * @since 0.6.0 */ protected function upgrade(): void { $old_credentials = get_option( self::OLD_OPTION, array() ); if ( empty( $old_credentials ) || ! is_array( $old_credentials ) ) { return; } foreach ( self::PROVIDER_MAP as $provider => $new_option ) { if ( empty( $old_credentials[ $provider ] ) ) { continue; } // Only migrate if the new option slot is empty. if ( '' !== get_option( $new_option, '' ) ) { continue; } update_option( $new_option, $old_credentials[ $provider ] ); } delete_option( self::OLD_OPTION ); } }