mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.1 KiB
68 lines
2.1 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Options;
|
|
using Migrate_01.Migrations;
|
|
using Squidex.Infrastructure;
|
|
using Squidex.Infrastructure.Commands;
|
|
|
|
namespace Migrate_01
|
|
{
|
|
public sealed class RebuildRunner
|
|
{
|
|
private readonly Rebuilder rebuilder;
|
|
private readonly PopulateGrainIndexes populateGrainIndexes;
|
|
private readonly RebuildOptions rebuildOptions;
|
|
|
|
public RebuildRunner(Rebuilder rebuilder, IOptions<RebuildOptions> rebuildOptions, PopulateGrainIndexes populateGrainIndexes)
|
|
{
|
|
Guard.NotNull(rebuilder);
|
|
Guard.NotNull(rebuildOptions);
|
|
Guard.NotNull(populateGrainIndexes);
|
|
|
|
this.rebuilder = rebuilder;
|
|
this.rebuildOptions = rebuildOptions.Value;
|
|
this.populateGrainIndexes = populateGrainIndexes;
|
|
}
|
|
|
|
public async Task RunAsync(CancellationToken ct)
|
|
{
|
|
if (rebuildOptions.Apps)
|
|
{
|
|
await rebuilder.RebuildAppsAsync(ct);
|
|
}
|
|
|
|
if (rebuildOptions.Schemas)
|
|
{
|
|
await rebuilder.RebuildSchemasAsync(ct);
|
|
}
|
|
|
|
if (rebuildOptions.Rules)
|
|
{
|
|
await rebuilder.RebuildRulesAsync(ct);
|
|
}
|
|
|
|
if (rebuildOptions.Assets)
|
|
{
|
|
await rebuilder.RebuildAssetsAsync(ct);
|
|
await rebuilder.RebuildAssetFoldersAsync(ct);
|
|
}
|
|
|
|
if (rebuildOptions.Contents)
|
|
{
|
|
await rebuilder.RebuildContentAsync(ct);
|
|
}
|
|
|
|
if (rebuildOptions.Indexes)
|
|
{
|
|
await populateGrainIndexes.UpdateAsync();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|