private void RebuildRemoteSite(IPublisherSearchConfig site, CancellationToken token) { if (site?.Deployer == null || token.IsCancellationRequested) { return; } var result = site.Deployer.GetFile(site.DeployerConfig, Constants.IndexDataFilePath); if (token.IsCancellationRequested) { return; } var existingContent = result.Success ? Encoding.UTF8.GetString(result.Result) : null; var entries = !string.IsNullOrWhiteSpace(existingContent) && existingContent[0] == '[' ? JArray.Parse(existingContent)?.OfType <JObject>()?.ToList().ConvertAll(_searchIndexEntryHelper.Convert).Where(e => e != null).ToList() : new List <ISearchIndexEntry>(); if (token.IsCancellationRequested) { return; } if (entries.Count > 0) { _searchApplianceService.UpdateSearchAppliance(entries, new[] { new UpdateItemReference { ContentUdi = new GuidUdi(global::Umbraco.Core.Constants.UdiEntityType.Document, Guid.Empty), IncludeDescendents = true } }, site, true); } }
private void Publish(Guid id, ActionArguments args, IPublisherSearchConfig config, Dictionary <string, string> itemPaths) { var folder = $"{_syncRoot}/{id}"; if (config.Deployer != null && args.Options.DeleteMissing) { // Find all items being published that are publishing their children as well var roots = args.Options.Items.Select(i => i.flags.HasFlag(DependencyFlags.IncludeChildren) && itemPaths.TryGetValue(i.Udi?.ToString(), out var path) ? path : null).Where(i => i != null).ToList(); // Remove any that are sub-folders of another one in the list roots.RemoveAll(r => roots.Any(rt => r != rt && r.StartsWith(rt))); if (roots.Count > 0) { config.Deployer.RemovePathsIfExist(config.DeployerConfig, roots); } } config.LimitedDeployer.Deploy(folder, config.DeployerConfig, args.Callbacks?.Update); }
public override object BeginPublish(Guid id, string syncRoot, SyncPublisherAction action, ActionArguments args, IPublisherSearchConfig searchConfig) { var config = new ExtensionContext { Config = searchConfig, DeployedItems = args.Options.Items.ToList(), Id = id, SyncRoot = syncRoot }; return(config); }
public override object BeginPublish(Guid id, string syncRoot, SyncPublisherAction action, ActionArguments args, IPublisherSearchConfig config) { var baseUri = HttpContext.Current.Request.Url; var basePath = Path.GetFullPath(Path.Combine(syncRoot, id.ToString())); return(new Context(baseUri, basePath)); }
public virtual object BeginPublish(Guid id, string syncRoot, SyncPublisherAction action, ActionArguments args, IPublisherSearchConfig config) => null;