diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 19520c5..2af0556 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -29,7 +29,8 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.13.*")] +[assembly: AssemblyVersion("3.14.*")] +[assembly: AssemblyInformationalVersion("3.14.0-beta")] // SQL [assembly: WebResource("InfoCaster.Umbraco.UrlTracker.SQL.MicrosoftSqlServer.create-table-1.sql", "text/plain")] diff --git a/Repositories/UrlTrackerRepository.cs b/Repositories/UrlTrackerRepository.cs index ccf426c..3e04c29 100644 --- a/Repositories/UrlTrackerRepository.cs +++ b/Repositories/UrlTrackerRepository.cs @@ -416,6 +416,12 @@ public static void UpdateUrlTrackerEntry(UrlTrackerModel urlTrackerModel) if (urlTrackerModel.ForceRedirect) ReloadForcedRedirectsCache(); } + + public static void Convert410To301(int nodeId) + { + string query = "UPDATE icUrlTracker SET RedirectHttpCode = 301 WHERE RedirectHttpCode = 410 AND RedirectNodeId = @redirectNodeId"; + _sqlHelper.ExecuteNonQuery(query, _sqlHelper.CreateParameter("redirectNodeId", nodeId)); + } #endregion #region Support diff --git a/UrlTracker.csproj b/UrlTracker.csproj index edf6b0c..d60fff9 100644 --- a/UrlTracker.csproj +++ b/UrlTracker.csproj @@ -1,5 +1,5 @@  - + Debug diff --git a/UrlTracker.nuspec b/UrlTracker.nuspec index 5032f6b..60e07d6 100644 --- a/UrlTracker.nuspec +++ b/UrlTracker.nuspec @@ -13,7 +13,10 @@ The Url Tracker is used to manage URLs within Umbraco The Url Tracker is used to manage URLs within umbraco. It automatically tracks URL changes, for instance when a node is renamed, and makes sure the old URL will redirect to the new location. This is great for SEO and great for people visiting your website via this old URL. Search engines will update the indexed URL and people won't visit the old, broken URL. You can also create your own redirects, based on a simple URL or using a Regex pattern. You can redirect to an existing node or a manually entered URL. This is great for migrating existing indexed URLs to your new website! - [Bugfix] Switched to Umbraco's EndRequest event to prevent MetaData Reader error + + [Bugfix] Only subscribe to each event once + [Bugfix] Convert 410 entries to 301 when a node is republished + urltracker umbraco diff --git a/UrlTrackerApplicationEventHandler.cs b/UrlTrackerApplicationEventHandler.cs index 3adc2c0..3eabe3f 100644 --- a/UrlTrackerApplicationEventHandler.cs +++ b/UrlTrackerApplicationEventHandler.cs @@ -46,6 +46,7 @@ protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplica ContentService.Moving += ContentService_Moving; ContentService.Publishing += ContentService_Publishing; + ContentService.Published += ContentService_Published; ContentService.Deleting += ContentService_Deleting; content.BeforeClearDocumentCache += content_BeforeClearDocumentCache; Domain.AfterDelete += Domain_AfterDelete; @@ -54,7 +55,7 @@ protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplica } } - void ContentService_Deleting(IContentService sender, DeleteEventArgs e) + void ContentService_Deleting(IContentService sender, DeleteEventArgs e) { foreach (IContent content in e.DeletedEntities) { @@ -136,7 +137,15 @@ void ContentService_Publishing(IPublishingStrategy sender, PublishEventArgs e) + void ContentService_Published(IPublishingStrategy sender, PublishEventArgs e) + { + foreach(IContent content in e.PublishedEntities) + { + UrlTrackerRepository.Convert410To301(content.Id); + } + } + + void ContentService_Moving(IContentService sender, MoveEventArgs e) { IContent content = e.Entity; #if !DEBUG