protected virtual void LoadItems(IConfiguration[] configurations, DataBlasterParameters parameters, ILogger logger) { var databaseNames = configurations .SelectMany(c => c.Resolve <PredicateRootPathResolver>().GetRootPaths().Select(rp => rp.DatabaseName)) .Distinct(); foreach (var databaseName in databaseNames) { logger.Info($"Syncing database '{databaseName}'..."); var context = CreateBulkLoadContext(BulkLoader, databaseName, configurations, parameters, logger); var bulkItems = ItemExtractor.ExtractBulkItems(context, configurations, databaseName); BulkLoader.LoadItems(context, bulkItems); if (context.AnyStageFailed) { throw new Exception($"Stage failed during bulkload of database '{databaseName}': {context.FailureMessage}"); } // Support publishing after sync. if (!IsUnicornPublishEnabled && !databaseName.Equals("core", StringComparison.OrdinalIgnoreCase)) { foreach (var itemChange in context.ItemChanges) { ManualPublishQueueHandler.AddItemToPublish(itemChange.ItemId); } } } }
public void Process(UnicornSyncCompletePipelineArgs args) { foreach (var item in args.Changes) { if (item.Id != null) { ManualPublishQueueHandler.AddItemToPublish(item.Id.Value); } } }
public void Process(UnicornSyncCompletePipelineArgs args) { foreach (var item in args.Changes) { if (item.SerializedItem != null) { ManualPublishQueueHandler.AddItemToPublish(item.SerializedItem.Id); } if (item.SourceItem != null) { ManualPublishQueueHandler.AddItemToPublish(item.SourceItem.Id); } } }
public void Process(UnicornSyncEndPipelineArgs args) { Assert.IsNotNullOrEmpty(PublishTriggerItemId, "Must set PublishTriggerItemId parameter."); if (_targetDatabases == null || _targetDatabases.Count == 0) { return; } if (!string.IsNullOrWhiteSpace(HttpContext.Current.Request.QueryString["publishDbs"])) { List <string> dbNames = HttpContext.Current.Request.QueryString["publishDbs"].Split(',').ToList(); dbNames.ForEach(AddTargetDatabase); } var dbs = _targetDatabases.Select(Factory.GetDatabase).ToArray(); string[] deepPublish = PublishTriggerItemId.Split(','); if (HttpContext.Current.Request.QueryString["fullPublish"] == "true") { foreach (string path in deepPublish) { var extractPath = path.Split(':'); var trigger = Factory.GetDatabase(extractPath[0]).GetItem(extractPath[1]); ManualPublishQueueHandler.AddItemToPublish(trigger.ID, extractPath[0]); } } Assert.IsTrue(dbs.Length > 0, "No valid databases specified to publish to."); if (ManualPublishQueueHandler.PublishQueuedItems(dbs)) { Log.Info("Unicorn: initiated publishing of synced items.", this); } }