Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Obsolete APIs #15939

Merged
merged 5 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using OrchardCore.Data.Migration;
using OrchardCore.Layers.Indexes;
using OrchardCore.Layers.Services;
using OrchardCore.Rules;
using OrchardCore.Rules.Services;
using YesSql.Sql;

Expand All @@ -12,16 +11,13 @@ public class Migrations : DataMigration
{
private readonly ILayerService _layerService;
private readonly IConditionIdGenerator _conditionIdGenerator;
private readonly IRuleMigrator _ruleMigrator;

public Migrations(
ILayerService layerService,
IConditionIdGenerator conditionIdGenerator,
IRuleMigrator ruleMigrator)
IConditionIdGenerator conditionIdGenerator)
{
_layerService = layerService;
_conditionIdGenerator = conditionIdGenerator;
_ruleMigrator = ruleMigrator;
}

public async Task<int> CreateAsync()
Expand Down Expand Up @@ -49,22 +45,8 @@ await SchemaBuilder.AlterIndexTableAsync<LayerMetadataIndex>(table => table
"Zone")
);

return 2;
}

public async Task<int> UpdateFrom2Async()
{
var layers = await _layerService.LoadLayersAsync();
foreach (var layer in layers.Layers)
{
layer.LayerRule = new Rule();
_conditionIdGenerator.GenerateUniqueId(layer.LayerRule);

_ruleMigrator.Migrate(layer.LayerRule.Name, layer.LayerRule);
}

await _layerService.UpdateAsync(layers);

// Migration was cleaned up in version 2.0.
// Jump to step 3 during create.
return 3;
}
}
Expand Down
10 changes: 0 additions & 10 deletions src/OrchardCore.Modules/OrchardCore.Layers/Recipes/LayerStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@ namespace OrchardCore.Layers.Recipes
public class LayerStep : IRecipeStepHandler
{
private readonly ILayerService _layerService;
private readonly IRuleMigrator _ruleMigrator;
private readonly IConditionIdGenerator _conditionIdGenerator;
private readonly IEnumerable<IConditionFactory> _factories;
private readonly JsonSerializerOptions _serializationOptions;

public LayerStep(
ILayerService layerService,
IRuleMigrator ruleMigrator,
IConditionIdGenerator conditionIdGenerator,
IEnumerable<IConditionFactory> factories,
IOptions<DocumentJsonSerializerOptions> serializationOptions)
{
_layerService = layerService;
_ruleMigrator = ruleMigrator;
_conditionIdGenerator = conditionIdGenerator;
_factories = factories;
_serializationOptions = serializationOptions.Value.SerializerOptions;
Expand Down Expand Up @@ -107,13 +104,6 @@ public async Task ExecuteAsync(RecipeExecutionContext context)
}
}

// Migrate any old rule in a recipe to the new rule format.
// Do not import the old rule.
if (!string.IsNullOrEmpty(layerStep.Rule))
{
_ruleMigrator.Migrate(layerStep.Rule, layer.LayerRule);
}

if (!string.IsNullOrEmpty(layerStep.Description))
{
layer.Description = layerStep.Description;
Expand Down
72 changes: 0 additions & 72 deletions src/OrchardCore.Modules/OrchardCore.Rules/Services/RuleMigrator.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/OrchardCore.Modules/OrchardCore.Rules/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public override void ConfigureServices(IServiceCollection services)
.AddTransient<IConfigureOptions<ConditionOperatorOptions>, ConditionOperatorConfigureOptions>()
.AddScoped<IConditionResolver, ConditionResolver>()
.AddScoped<IConditionOperatorResolver, ConditionOperatorResolver>()
.AddScoped<IRuleService, RuleService>()
.AddScoped<IRuleMigrator, RuleMigrator>();
.AddScoped<IRuleService, RuleService>();

// All condition.
services.AddRule<AllConditionGroup, AllConditionEvaluator, AllConditionDisplayDriver>();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ public async Task<bool> CreateIndexAsync(ElasticIndexSettings elasticIndexSettin
var analyzersDescriptor = new AnalyzersDescriptor();
var indexSettingsDescriptor = new IndexSettingsDescriptor();

// The name "standardanalyzer" is a legacy used prior OC 1.6 release. It can be removed in future releases.
var analyzerName = (elasticIndexSettings.AnalyzerName == "standardanalyzer" ? null : elasticIndexSettings.AnalyzerName) ?? "standard";
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
var analyzerName = elasticIndexSettings.AnalyzerName ?? "standard";

if (_elasticsearchOptions.Analyzers.TryGetValue(analyzerName, out var analyzerProperties))
{
Expand All @@ -123,7 +122,7 @@ public async Task<bool> CreateIndexAsync(ElasticIndexSettings elasticIndexSettin
.Map(m => m
.SourceField(s => s
.Enabled(elasticIndexSettings.StoreSourceData)
.Excludes(new string[] { IndexingConstants.DisplayTextAnalyzedKey }))
.Excludes([IndexingConstants.DisplayTextAnalyzedKey]))
.Meta(me => IndexingState));

var response = await _elasticClient.Indices.CreateAsync(createIndexDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ public async Task DeleteIndexAsync(string indexName)
// Returns the name of the analyzer configured for the given index name.
private static string GetAnalyzerName(ElasticIndexSettingsDocument document, string indexName)
{
// The name "standardanalyzer" is a legacy used prior OC 1.6 release. It can be removed in future releases.
if (document.ElasticIndexSettings.TryGetValue(indexName, out var settings) && settings.AnalyzerName != "standardanalyzer")
if (document.ElasticIndexSettings.TryGetValue(indexName, out var settings))
{
return settings.AnalyzerName;
}
Expand Down