Fixes installation issue with rebuilding media cache
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenZeroOne
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
[Migration("7.0.1", 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
[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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,10 +337,8 @@
|
||||
<Compile Include="Models\PublishedContent\PublishedContentModel.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedContentModelFactoryResolver.cs" />
|
||||
<Compile Include="Models\TaggableObjectTypes.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSixTwoZero\RemoveCachedRecycleMediaXml.cs" />
|
||||
<Compile Include="Models\TemplateNode.cs" />
|
||||
<Compile Include="Packaging\PackageBinaryInspector.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenZeroOne\RemoveCachedRecycleMediaXml.cs" />
|
||||
<Compile Include="PropertyEditors\DefaultPropertyValueConverterAttribute.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSeven\UpdateRelatedLinksData.cs" />
|
||||
<Compile Include="PropertyEditors\IValueEditor.cs" />
|
||||
|
||||
@@ -39,4 +39,5 @@
|
||||
<!-- Custom -->
|
||||
<!--<add application="myApplication" alias="myTree" title="Me Tree" type="MyNamespace.myTree, MyAssembly"
|
||||
iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="10" />-->
|
||||
<add initialize="true" sortOrder="0" alias="peopleTree" application="settings" title="People" iconClosed="icon-folder" iconOpen="icon-folder-open" type="MyCustomTreeController, App_Code.ogsb-s7l" />
|
||||
</trees>
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Persistence.Migrations;
|
||||
using Umbraco.Core.Services;
|
||||
using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Web.Strategies.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// This will execute after upgrading to rebuild the xml cache
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This cannot execute as part of a db migration since we need access to the services/repos.
|
||||
///
|
||||
/// This will execute for specific versions -
|
||||
///
|
||||
/// * If current is less than or equal to 7.0.0
|
||||
/// </remarks>
|
||||
public class RebuildMediaXmlCacheAfterUpgrade : IApplicationStartupHandler
|
||||
{
|
||||
public RebuildMediaXmlCacheAfterUpgrade()
|
||||
{
|
||||
MigrationRunner.Migrated += MigrationRunner_Migrated;
|
||||
}
|
||||
|
||||
void MigrationRunner_Migrated(MigrationRunner sender, Core.Events.MigrationEventArgs e)
|
||||
{
|
||||
var target70 = new Version(7, 0, 0);
|
||||
|
||||
if (e.ConfiguredVersion <= target70)
|
||||
{
|
||||
var mediasvc = (MediaService)ApplicationContext.Current.Services.MediaService;
|
||||
mediasvc.RebuildXmlStructures();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,6 +405,7 @@
|
||||
<Compile Include="PropertyEditors\PropertyValueEditorWrapper.cs" />
|
||||
<Compile Include="PublishedContentQuery.cs" />
|
||||
<Compile Include="Routing\UrlProviderExtensions.cs" />
|
||||
<Compile Include="Strategies\Migrations\RebuildMediaXmlCacheAfterUpgrade.cs" />
|
||||
<Compile Include="TagQuery.cs" />
|
||||
<Compile Include="Trees\CoreTreeAttribute.cs" />
|
||||
<Compile Include="Trees\DataTypeTreeController.cs" />
|
||||
|
||||
Reference in New Issue
Block a user