migrate_option( 'ai_experiments_enabled', 'wpai_features_enabled' ); $this->migrate_option( 'ai_experiment_enabled', 'wpai_features_enabled' ); // Loop through the features and migrate them. // We don't use the classes to protect for future compatibility. $features = array( 'abilities-explorer', 'alt-text-generation', 'example-experiment', 'excerpt-generation', 'image-generation', 'review-notes', 'summarization', 'title-generation', ); foreach ( $features as $feature ) { $this->migrate_option( "ai_experiment_{$feature}_enabled", "wpai_feature_{$feature}_enabled" ); } } /** * Migrates an individual option from the old name. * * Will skip migration if the new option already has a value. * * @param string $old_option The old option name. * @param string $new_option The new option name. */ private function migrate_option( string $old_option, string $new_option ): void { $old_value = get_option( $old_option, '' ); if ( '' === $old_value || '' !== get_option( $new_option, '' ) ) { return; } update_option( $new_option, $old_value ); delete_option( $old_option ); } }