diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/RemoveCachedRecycleMediaXml.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/RemoveCachedRecycleMediaXml.cs new file mode 100644 index 0000000000..d0945db957 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/RemoveCachedRecycleMediaXml.cs @@ -0,0 +1,31 @@ +using Umbraco.Core.Configuration; +using Umbraco.Core.Services; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero +{ + /// + /// Due to this bug: http://issues.umbraco.org/issue/U4-3820 we need to remove the cached media + /// xml found in the cmsContentXml table for any media that has been recycled. + /// + [Migration("6.2.0", 1, GlobalSettings.UmbracoMigrationName)] + public class RemoveCachedRecycleMediaXml : MigrationBase + { + public override void Up() + { + //now that the controlId column is renamed and now a string we need to convert + if (Context == null || Context.Database == null) return; + + Execute.Code(database => + { + var mediasvc = (MediaService)ApplicationContext.Current.Services.MediaService; + mediasvc.RebuildXmlStructures(); + + return string.Empty; + }); + } + + public override void Down() + { + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 021ae04633..d9ff8081c2 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -189,6 +189,7 @@ +