private void OnDeletedContent(object sender, DeleteContentEventArgs e) { var isPage = e.Content is PageData; if (!isPage) { // Content is not of type PageData or BlockData, ignore return; } var configuration = StaticWebConfiguration.CurrentSite; if (configuration == null || !configuration.Enabled) { return; } bool?useTemporaryAttribute = configuration.UseTemporaryAttribute.HasValue ? false : configuration.UseTemporaryAttribute; var staticWebService = ServiceLocator.Current.GetInstance <IStaticWebService>(); staticWebService.GeneratePage(e.ContentLink, e.Content, useTemporaryAttribute, IGNORE_HTML_DEPENDENCIES); if (isPage) { // Handle renaming of pages if (e.Items["StaticWeb-OldUrl"] is string oldUrl) { var removeSubFolders = true; staticWebService.RemoveGeneratedPage(configuration, oldUrl, removeSubFolders); } } }
private static void Instance_DeletedContent(object sender, DeleteContentEventArgs e) { var contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>(); var contentTyperepository = ServiceLocator.Current.GetInstance <IContentTypeRepository>(); foreach (var cr in e.DeletedDescendents) { var content = contentRepository.Get <IContent>(cr); if (content == null) { continue; } var contentType = contentTyperepository.Load(content.ContentTypeID); var attributes = Attribute.GetCustomAttributes(contentType.ModelType); foreach (var attr in attributes) { if (!(attr is SingletonAttribute)) { continue; } var writableContentType = (ContentType)contentType.CreateWritableClone(); writableContentType.IsAvailable = true; contentTyperepository.Save(writableContentType); } } }
private void OnDeletingContent(object sender, DeleteContentEventArgs e) { Logger.Debug("OnDeletingContent raised."); ContentReference deletingContentLink = e.ContentLink; if (ContentReference.IsNullOrEmpty(deletingContentLink) || deletingContentLink.ProviderName != ReferenceConverter.CatalogProviderKey || !_contentLoader.TryGet(deletingContentLink, out CatalogContentBase catalogContentBase)) { Logger.Debug("Deleted content is not catalog content."); return; } switch (catalogContentBase) { case EntryContentBase entryContent: ICollection <EntryContentBase> entries = GetEntriesAffected(entryContent, false, true); _productExportService.DeleteProducts(entries); _productExportService.DeleteProductAssets(entries); _productExportService.DeleteProductRecommendations(entries); break; case NodeContent nodeContent: _productExportService.DeleteChildProducts(nodeContent); break; } }
public static void HandleDelete(object sender, DeleteContentEventArgs e) { var beingDeleted = new List <ContentReference>(); if (e.ContentLink != null) { beingDeleted.Add(e.ContentLink); } beingDeleted.AddRange(e.DeletedDescendents); foreach (var item in beingDeleted) { var contentMapping = DivvyContentMapping.FindFromEpiserverContent(item.ID); if (contentMapping != null) { DivvyContentMapping.Archive(contentMapping); DivvyLogManager.Log("Deleted Event Raised", new { EpiserverId = item.ID, DivvyId = DivvyContentMapping.FindFromEpiserverContent(item.ID).DivvyId }); var content = repo.Get <IContent>(new ContentReference(item.ID)); NotifyDivvy(content, Settings.DeletedStatusLabel); } } }
private void OnDeletedContent(object sender, DeleteContentEventArgs e) { if (e.Content is IDeletedContentHandler) { ((IDeletedContentHandler)e.Content).DeletedContent(sender, e); } }
public static void DeletedContent(object sender, DeleteContentEventArgs e) { var content = e.Content as IDeletedContent; if (content == null) return; content.DeletedContent(sender, e); }
private void DeletedContent(object sender, DeleteContentEventArgs e) { _htmlCache.ChildrenListingChanged(ContentReference.IsNullOrEmpty(e.TargetLink) ? e.ContentLink : e.TargetLink); foreach (var item in e.DeletedDescendents) { _htmlCache.ContentChanged(item); } }
public static (IContent Content, DeleteContentEventArgs Args) GetDeleteScenario() { var page = GetPageData(); var args = new DeleteContentEventArgs(page.ContentLink, ContentReference.WasteBasket) { Content = page }; return(page, args); }
private void ContentEventsOnDeletingContent(object sender, DeleteContentEventArgs deleteContentEventArgs) { var indexablePageData = deleteContentEventArgs.Content as IIndexablePageData; if (indexablePageData == null) return; var deleteResponse = _pageDataIndexer.Delete(indexablePageData); if (!deleteResponse.IsValid) throw new InvalidOperationException( $"Failed to delete pagedata server error {deleteResponse.ServerError}, requestInfo {deleteResponse.DebugInformation}"); }
private void ServiceOnDeletedContent(object sender, DeleteContentEventArgs deleteContentEventArgs) { try { Indexer.Service.OnContentDeleted(deleteContentEventArgs.Content); } catch { // ignored } }
private void OnDeletingContent(object sender, DeleteContentEventArgs e) { var isPage = e.Content is PageData; if (isPage) { var staticWebService = ServiceLocator.Current.GetInstance <IStaticWebService>(); var oldUrl = staticWebService.GetPageUrl(new ContentReference(e.Content.ContentLink.ID)); e.Items.Add("StaticWeb-OldUrl", oldUrl); } }
private void Service_DeletedContent(object sender, DeleteContentEventArgs e) { var deletedDescendents = e.DeletedDescendents.ToList(); if (e.ContentLink != null) { deletedDescendents.Add(e.ContentLink); } foreach (var contentRef in deletedDescendents) { _vulcanHandler.DeleteContentEveryLanguage(contentRef, string.Empty); } }
public static void Page_Deleted(object sender, DeleteContentEventArgs e) { using (var context = ServiceLocator.Current.GetInstance <RedirectDbContext>()) { foreach (ContentReference descendent in e.DeletedDescendents) { var redirects = context.RedirectRules.Where(x => x.ToContentId == descendent.ID); foreach (var r in redirects) { context.RedirectRules.Remove(r); } } context.SaveChanges(); } }
/// <summary> /// Executed when the content is being deleted. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DeleteContentEventArgs"/> instance containing the event data.</param> private static void DeletingContent(object sender, DeleteContentEventArgs e) { if (e == null) { return; } if (!(e.Content is SettingsBase) || e.Content.ParentLink != settingsService.GlobalSettingsRoot) { return; } e.CancelAction = true; e.CancelReason = localizationService.GetString("/edit/deletesetting/deletenotsupported"); }
private void OnDeletedContent(object sender, DeleteContentEventArgs contentEventArgs) { try { var contentSearchHandler = ServiceLocator.Current.GetInstance <LuceneContentSearchHandler>(); contentSearchHandler.UpdateItem(contentEventArgs.Content); } catch (Exception ex) { if (log.IsErrorEnabled) { log.Error(ex); } } }
private void DeleteSqlBlobProviderFiles(object sender, DeleteContentEventArgs e) { if (e.DeletedDescendents == null || e.DeletedDescendents.Any()) { return; } var contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>(); foreach (var descendant in e.DeletedDescendents) { if (contentRepository.TryGet(descendant, out MediaData mediaData)) { FileHelper.Delete(Blob.GetContainerIdentifier(mediaData.ContentGuid), Path); } } }
private void ContentEventsOnDeletedContent(object sender, DeleteContentEventArgs deleteContentEventArgs) { PageData page = deleteContentEventArgs.Content as PageData; if (page == null) { return; } var correctBase = page as INewsletterBase; if (correctBase != null) { Job job = Job.LoadByPageId(page.PageLink.ID); if (job != null) { // Page has been deleted, now delete job and all it's work items job.Delete(); } } }
internal static void DeleteFromIndex(object sender, DeleteContentEventArgs e) { Logger.Debug($"Raising event DeleteFromIndex for '{e?.ContentLink}'"); if (ContentReference.IsNullOrEmpty(e?.ContentLink)) { return; } DeleteFromIndex(e?.ContentLink); if (e?.DeletedDescendents != null) { foreach (var descendent in e.DeletedDescendents) { DeleteFromIndex(descendent); } } }
private void OnDeletedContent(object sender, DeleteContentEventArgs e) { Logger.Debug("OnDeletedContent raised."); ContentReference deletedContentLink = e.ContentLink; if (ContentReference.IsNullOrEmpty(deletedContentLink) || deletedContentLink.ProviderName != ReferenceConverter.CatalogProviderKey) { Logger.Debug("Deleted content is not catalog content."); return; } CatalogContentType catalogContentType = _referenceConverter.GetContentType(deletedContentLink); if (catalogContentType != CatalogContentType.CatalogNode) { Logger.Debug("Deleted content is not a catalog node."); return; } // Force a full category structure re-export. This has to be done AFTER the category has been deleted. _categoryExportService.StartFullCategoryExport(); }
/// <summary> /// Deleted the content. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DeleteContentEventArgs"/> instance containing the event data.</param> private void DeletedContent(object sender, DeleteContentEventArgs e) { UpdateContent(e, true); }
private static void ContentEventsOnDeletedContent(object sender, DeleteContentEventArgs deleteContentEventArgs) { var solrContentRepository = ServiceLocator.Current.GetInstance<ISolrContentRepository>(); StartAndWait(solrContentRepository.RemoveAsync(deleteContentEventArgs.ContentLink)); }