Compare commits

..

1 Commits

Author SHA1 Message Date
Stephan d0ab80bfde Support clearing all datatype cache 2019-02-08 11:40:49 +01:00
669 changed files with 9859 additions and 7036 deletions
+158 -161
View File
@@ -1,163 +1,160 @@
#
# Umbraco Cms Git Ignore
#
# common files
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.orig
*.suo
*.vs10x
*.ndproj
#
# Umbraco Cms Git Ignore
#
# common files
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.orig
*.suo
*.vs10x
*.ndproj
*.ignorer.*
# common directories
.DS_Store
._.DS_Store
.vs/
/local/
# build directories
[Bb]in/
[Db]ebug*/
[Rr]elease*/
obj/
# tools
_ReSharper*/
_NCrunch_*/
*.ncrunchsolution
*.ncrunchsolution.user
*.ncrunchproject
*.crunchsolution.cache
tools/NDepend/
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
[sS]ource
[sS]andbox
umbraco.config
App_Data/TEMP/*
[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/*
[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/*
[Uu]mbraco/[Pp]resentation/[Ss]cripts/*
[Uu]mbraco/[Pp]resentation/[Ff]onts/*
[Uu]mbraco/[Pp]resentation/[Cc]ss/*
src/Umbraco.Web.UI/[Cc]ss/*
src/Umbraco.Web.UI/App_Code/*
src/Umbraco.Web.UI/App_Data/*
src/Umbraco.Tests/App_Data/*
src/Umbraco.Web.UI/[Mm]edia/*
src/Umbraco.Web.UI/[Mm]aster[Pp]ages/*
src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/*
!src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/[Ww]eb.[Cc]onfig
src/Umbraco.Web.UI/[Xx]slt/*
src/Umbraco.Web.UI/[Ii]mages/*
src/Umbraco.Web.UI/[Ss]cripts/*
src/Umbraco.Web.UI/Web.*.config.transformed
umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx
umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx
src/Umbraco.Tests/config/applications.config
src/Umbraco.Tests/config/trees.config
src/Umbraco.Web.UI/web.config
src/Umbraco.Web.UI/[Cc]onfig/ClientDependency.config
src/Umbraco.Web.UI/[Cc]onfig/serilog.config
src/Umbraco.Web.UI/[Cc]onfig/serilog.user.config
src/Umbraco.Tests/config/404handlers.config
src/Umbraco.Web.UI/[Vv]iews/*.cshtml
src/Umbraco.Web.UI/[Vv]iews/*.vbhtml
src/Umbraco.Tests/[Cc]onfig/umbracoSettings.config
src/Umbraco.Web.UI/[Vv]iews/*
src/packages/
src/packages/repositories.config
src/Umbraco.Web.UI/[Ww]eb.config
*.transformed
node_modules
lib-bower
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/*.loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/init.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/canvasdesigner.*.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.css
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
src/Umbraco.Web.UI.Client/[Bb]uild/*
src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/
src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/
src/Umbraco.Web.UI.Client/src/[Ll]ess/*.css
src/Umbraco.Web.UI.Client/vwd.webinfo
src/Umbraco.Web.UI/App_Plugins/*
src/*.psess
src/*.vspx
NDependOut/*
QueryResult.htm
src/Umbraco.Web.UI/[Cc]onfig/appSettings.config
src/Umbraco.Web.UI/[Cc]onfig/connectionStrings.config
src/Umbraco.Web.UI/[Uu]mbraco/plugins/*
build/ApiDocs/*
build/ApiDocs/Output/*
src/Umbraco.Web.UI.Client/bower_components/*
/src/Umbraco.Web.UI/[Uu]mbraco/preview
/src/Umbraco.Web.UI/[Uu]mbraco/preview.old
# ignore rule for clearing out Belle (avoid rebuilding all the time)
preserve.belle
#Ignore Rule for output of generated documentation files from Grunt docserve
src/Umbraco.Web.UI.Client/docs/api
src/*.boltdata/
src/umbraco.sln.ide/*
src/.vs/
src/Umbraco.Web.UI/[Jj]s/*
src/Umbraco.Tests/[Mm]edia
tools/docfx/*
apidocs/_site/*
src/*/project.lock.json
src/.idea/*
apidocs/api/*
build/docs.zip
build/ui-docs.zip
build/csharp-docs.zip
src/packages/
src/PrecompiledWeb/*
# build
build.out/
build.tmp/
build/hooks/
build/temp/
# common directories
.DS_Store
._.DS_Store
.vs/
/local/
# build directories
[Bb]in/
[Db]ebug*/
[Rr]elease*/
obj/
# tools
_ReSharper*/
_NCrunch_*/
*.ncrunchsolution
*.ncrunchsolution.user
*.ncrunchproject
*.crunchsolution.cache
tools/NDepend/
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
[sS]ource
[sS]andbox
umbraco.config
App_Data/TEMP/*
[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/*
[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/*
[Uu]mbraco/[Pp]resentation/[Ss]cripts/*
[Uu]mbraco/[Pp]resentation/[Ff]onts/*
[Uu]mbraco/[Pp]resentation/[Cc]ss/*
src/Umbraco.Web.UI/[Cc]ss/*
src/Umbraco.Web.UI/App_Code/*
src/Umbraco.Web.UI/App_Data/*
src/Umbraco.Tests/App_Data/*
src/Umbraco.Web.UI/[Mm]edia/*
src/Umbraco.Web.UI/[Mm]aster[Pp]ages/*
src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/*
!src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/[Ww]eb.[Cc]onfig
src/Umbraco.Web.UI/[Xx]slt/*
src/Umbraco.Web.UI/[Ii]mages/*
src/Umbraco.Web.UI/[Ss]cripts/*
src/Umbraco.Web.UI/Web.*.config.transformed
umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx
umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx
src/Umbraco.Tests/config/applications.config
src/Umbraco.Tests/config/trees.config
src/Umbraco.Web.UI/web.config
src/Umbraco.Web.UI/[Cc]onfig/ClientDependency.config
src/Umbraco.Tests/config/404handlers.config
src/Umbraco.Web.UI/[Vv]iews/*.cshtml
src/Umbraco.Web.UI/[Vv]iews/*.vbhtml
src/Umbraco.Tests/[Cc]onfig/umbracoSettings.config
src/Umbraco.Web.UI/[Vv]iews/*
src/packages/
src/packages/repositories.config
src/Umbraco.Web.UI/[Ww]eb.config
*.transformed
node_modules
lib-bower
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/*.loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/init.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/canvasdesigner.*.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.css
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
src/Umbraco.Web.UI.Client/[Bb]uild/*
src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/
src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/
src/Umbraco.Web.UI.Client/src/[Ll]ess/*.css
src/Umbraco.Web.UI.Client/vwd.webinfo
src/Umbraco.Web.UI/App_Plugins/*
src/*.psess
src/*.vspx
NDependOut/*
QueryResult.htm
src/Umbraco.Web.UI/[Cc]onfig/appSettings.config
src/Umbraco.Web.UI/[Cc]onfig/connectionStrings.config
src/Umbraco.Web.UI/[Uu]mbraco/plugins/*
build/ApiDocs/*
build/ApiDocs/Output/*
src/Umbraco.Web.UI.Client/bower_components/*
/src/Umbraco.Web.UI/[Uu]mbraco/preview
/src/Umbraco.Web.UI/[Uu]mbraco/preview.old
# ignore rule for clearing out Belle (avoid rebuilding all the time)
preserve.belle
#Ignore Rule for output of generated documentation files from Grunt docserve
src/Umbraco.Web.UI.Client/docs/api
src/*.boltdata/
src/umbraco.sln.ide/*
src/.vs/
src/Umbraco.Web.UI/[Jj]s/*
src/Umbraco.Tests/[Mm]edia
tools/docfx/*
apidocs/_site/*
src/*/project.lock.json
src/.idea/*
apidocs/api/*
build/docs.zip
build/ui-docs.zip
build/csharp-docs.zip
src/packages/
src/PrecompiledWeb/*
# build
build.out/
build.tmp/
build/hooks/
build/temp/
# eof
/src/Umbraco.Web.UI.Client/TESTS-*.xml
+2 -2
View File
@@ -27,9 +27,9 @@
<dependency id="ClientDependency" version="[1.9.7,1.999999)" />
<dependency id="ClientDependency-Mvc5" version="[1.8.0,1.999999)" />
<dependency id="CSharpTest.Net.Collections" version="[14.906.1403.1082,14.999999)" />
<dependency id="Examine" version="[1.0.0,1.999999)" />
<dependency id="Examine" version="[1.0.0-beta078,1.999999)" />
<dependency id="HtmlAgilityPack" version="[1.8.14,1.999999)" />
<dependency id="ImageProcessor" version="[2.7.0.100,2.999999)" />
<dependency id="ImageProcessor" version="[2.6.2.25,2.999999)" />
<dependency id="LightInject.Mvc" version="[2.0.0,2.999999)" />
<dependency id="LightInject.WebApi" version="[2.0.0,2.999999)" />
<dependency id="Markdown" version="[2.2.1,2.999999)" />
+4 -4
View File
@@ -25,15 +25,15 @@
not want this to happen as the alpha of the next major is, really, the next major already.
-->
<dependency id="Microsoft.AspNet.SignalR.Core" version="[2.4.0, 2.999999)" />
<dependency id="Umbraco.ModelsBuilder.Ui" version="[8.0.0-alpha.38]" />
<dependency id="ImageProcessor.Web" version="[4.10.0.100,4.999999)" />
<dependency id="ImageProcessor.Web.Config" version="[2.5.0.100,2.999999)" />
<dependency id="Umbraco.ModelsBuilder.Ui" version="[8.0.0-alpha.37]" />
<dependency id="ImageProcessor.Web" version="[4.9.3.25,4.999999)" />
<dependency id="ImageProcessor.Web.Config" version="[2.4.1.19,2.999999)" />
<dependency id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="[2.0.1,2.999999)" />
<dependency id="Microsoft.Net.Compilers" version="[2.10.0,2.999999)" />
</group>
</dependencies>
</metadata>
<files>
+7 -13
View File
@@ -2,7 +2,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
namespace Umbraco.Core.Cache
@@ -111,7 +110,7 @@ namespace Umbraco.Core.Cache
#region Lock
private const string ContextItemsLockKey = "Umbraco.Core.Cache.HttpRequestCache::LockEntered";
private bool _entered;
protected override void EnterReadLock() => EnterWriteLock();
@@ -119,13 +118,7 @@ namespace Umbraco.Core.Cache
{
if (HasContextItems)
{
// note: cannot keep 'entered' as a class variable here,
// since there is one per request - so storing it within
// ContextItems - which is locked, so this should be safe
var entered = false;
Monitor.Enter(ContextItems.SyncRoot, ref entered);
ContextItems[ContextItemsLockKey] = entered;
System.Threading.Monitor.Enter(ContextItems.SyncRoot, ref _entered);
}
}
@@ -133,10 +126,11 @@ namespace Umbraco.Core.Cache
protected override void ExitWriteLock()
{
var entered = (bool?) ContextItems[ContextItemsLockKey] ?? false;
if (entered)
Monitor.Exit(ContextItems.SyncRoot);
ContextItems.Remove(ContextItemsLockKey);
if (_entered)
{
_entered = false;
System.Threading.Monitor.Exit(ContextItems.SyncRoot);
}
}
#endregion
@@ -3,7 +3,6 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Web;
using Umbraco.Core.Composing;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
@@ -11,7 +10,7 @@ using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
namespace Umbraco.Core.Compose
namespace Umbraco.Core.Components
{
public sealed class AuditEventsComponent : IComponent
{
@@ -1,6 +1,4 @@
using Umbraco.Core.Composing;
namespace Umbraco.Core.Compose
namespace Umbraco.Core.Components
{
public sealed class AuditEventsComposer : ComponentComposer<AuditEventsComponent>, ICoreComposer
{ }
@@ -1,8 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Represents the collection of <see cref="IComponent"/> implementations.
@@ -23,7 +24,7 @@ namespace Umbraco.Core.Composing
{
using (_logger.DebugDuration<ComponentCollection>($"Initializing. (log components when >{LogThresholdMilliseconds}ms)", "Initialized."))
{
foreach (var component in this)
foreach (var component in this.Reverse()) // terminate components in reverse order
{
var componentType = component.GetType();
using (_logger.DebugDuration<ComponentCollection>($"Initializing {componentType.FullName}.", $"Initialized {componentType.FullName}.", thresholdMilliseconds: LogThresholdMilliseconds))
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Builds a <see cref="ComponentCollection"/>.
@@ -1,6 +1,4 @@
using Umbraco.Core.Compose;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Provides a base class for composers which compose a component.
@@ -1,6 +1,6 @@
using System;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Indicates that a composer requires another composer.
@@ -1,6 +1,6 @@
using System;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Indicates that a component is required by another composer.
@@ -6,7 +6,7 @@ using System.Text;
using Umbraco.Core.Collections;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
// note: this class is NOT thread-safe in any ways
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Represents a composition.
@@ -1,22 +1,23 @@
using System;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging.Viewer;
using Umbraco.Core.Migrations;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PackageActions;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Strings;
using Umbraco.Core.Sync;
using Umbraco.Core.Logging.Viewer;
using Umbraco.Core.PackageActions;
namespace Umbraco.Core
namespace Umbraco.Core.Components
{
/// <summary>
/// Provides extension methods to the <see cref="Composition"/> class.
/// </summary>
public static partial class CompositionExtensions
public static class CompositionExtensions
{
#region FileSystems
@@ -109,6 +110,13 @@ namespace Umbraco.Core
internal static ManifestValueValidatorCollectionBuilder Validators(this Composition composition)
=> composition.WithCollectionBuilder<ManifestValueValidatorCollectionBuilder>();
/// <summary>
/// Gets the post-migrations collection builder.
/// </summary>
/// <param name="composition">The composition.</param>
internal static PostMigrationCollectionBuilder PostMigrations(this Composition composition)
=> composition.WithCollectionBuilder<PostMigrationCollectionBuilder>();
/// <summary>
/// Gets the components collection builder.
/// </summary>
@@ -1,6 +1,6 @@
using System;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Indicates that a composer should be disabled.
@@ -1,6 +1,6 @@
using System;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Indicates that a composer should be disabled.
@@ -1,6 +1,6 @@
using System;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Indicates that a composer should be enabled.
@@ -1,6 +1,6 @@
using System;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Indicates that a composer should be enabled.
@@ -1,4 +1,4 @@
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Represents a component.
@@ -1,4 +1,6 @@
namespace Umbraco.Core.Composing
using Umbraco.Core.Composing;
namespace Umbraco.Core.Components
{
/// <summary>
/// Represents a composer.
@@ -1,4 +1,4 @@
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Represents a core <see cref="IComposer"/>.
@@ -1,4 +1,4 @@
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Represents a runtime <see cref="IComposer"/>.
@@ -1,4 +1,4 @@
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Represents a user <see cref="IComposer"/>.
@@ -1,10 +1,9 @@
using System.IO;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
namespace Umbraco.Core.Compose
namespace Umbraco.Core.Components
{
public sealed class ManifestWatcherComponent : IComponent
{
@@ -1,6 +1,4 @@
using Umbraco.Core.Composing;
namespace Umbraco.Core.Compose
namespace Umbraco.Core.Components
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class ManifestWatcherComposer : ComponentComposer<ManifestWatcherComponent>, ICoreComposer
@@ -3,7 +3,7 @@ using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
namespace Umbraco.Core.Compose
namespace Umbraco.Core.Components
{
// TODO: This should just exist in the content service/repo!
public sealed class RelateOnCopyComponent : IComponent
@@ -1,6 +1,4 @@
using Umbraco.Core.Composing;
namespace Umbraco.Core.Compose
namespace Umbraco.Core.Components
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public sealed class RelateOnCopyComposer : ComponentComposer<RelateOnCopyComponent>, ICoreComposer
@@ -5,7 +5,7 @@ using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
namespace Umbraco.Core.Compose
namespace Umbraco.Core.Components
{
public sealed class RelateOnTrashComponent : IComponent
{
@@ -1,6 +1,4 @@
using Umbraco.Core.Composing;
namespace Umbraco.Core.Compose
namespace Umbraco.Core.Components
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public sealed class RelateOnTrashComposer : ComponentComposer<RelateOnTrashComponent>, ICoreComposer
@@ -1,6 +1,7 @@
using System;
using Umbraco.Core.Composing;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Components
{
/// <summary>
/// Marks a composer to indicate a minimum and/or maximum runtime level for which the composer would compose.
@@ -1,11 +1,13 @@
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Components;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
namespace Umbraco.Core.Composing.CompositionExtensions
namespace Umbraco.Core.Composing.Composers
{
/// <summary>
/// Compose configurations.
/// </summary>
public static class Configuration
public static class ConfigurationComposer
{
public static Composition ComposeConfiguration(this Composition composition)
{
@@ -1,10 +1,11 @@
using AutoMapper;
using Umbraco.Core.Components;
using Umbraco.Core.Models.Identity;
namespace Umbraco.Core.Composing.CompositionExtensions
namespace Umbraco.Core.Composing.Composers
{
public static class CoreMappingProfiles
public static class CoreMappingProfilesComposer
{
public static Composition ComposeCoreMappingProfiles(this Composition composition)
{
@@ -1,10 +1,10 @@
using Umbraco.Core.Compose;
using Umbraco.Core.Components;
using Umbraco.Core.IO;
using Umbraco.Core.IO.MediaPathSchemes;
namespace Umbraco.Core.Composing.CompositionExtensions
namespace Umbraco.Core.Composing.Composers
{
public static class FileSystems
public static class FileSystemsComposer
{
/*
* HOW TO REPLACE THE MEDIA UNDERLYING FILESYSTEM
@@ -73,10 +73,10 @@ namespace Umbraco.Core.Composing.CompositionExtensions
// it needs to be registered (not only the interface) because it provides additional
// functionality eg for scoping, and is injected in the scope provider - whereas the
// interface is really for end-users to get access to filesystems.
composition.RegisterUnique(factory => factory.CreateInstance<IO.FileSystems>(factory));
composition.RegisterUnique(factory => factory.CreateInstance<FileSystems>(factory));
// register IFileSystems, which gives access too all filesystems
composition.RegisterUnique<IFileSystems>(factory => factory.GetInstance<IO.FileSystems>());
composition.RegisterUnique<IFileSystems>(factory => factory.GetInstance<FileSystems>());
// register the scheme for media paths
composition.RegisterUnique<IMediaPathScheme, TwoGuidsMediaPathScheme>();
@@ -1,12 +1,13 @@
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Components;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Persistence.Repositories.Implement;
namespace Umbraco.Core.Composing.CompositionExtensions
namespace Umbraco.Core.Composing.Composers
{
/// <summary>
/// Composes repositories.
/// </summary>
public static class Repositories
public static class RepositoriesComposer
{
public static Composition ComposeRepositories(this Composition composition)
{
@@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using Umbraco.Core.Cache;
using Umbraco.Core.Components;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -9,9 +10,9 @@ using Umbraco.Core.Packaging;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
namespace Umbraco.Core.Composing.CompositionExtensions
namespace Umbraco.Core.Composing.Composers
{
public static class Services
public static class ServicesComposer
{
public static Composition ComposeServices(this Composition composition)
{
@@ -1,14 +1,14 @@
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Components;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
namespace Umbraco.Core
namespace Umbraco.Core.Composing
{
/// <summary>
/// Provides extension methods to the <see cref="Composition"/> class.
/// </summary>
public static partial class CompositionExtensions
public static class CompositionExtensions
{
#region Essentials
@@ -1,9 +1,8 @@
using System;
using System.Linq;
using System.Reflection;
using Umbraco.Core.Composing;
namespace Umbraco.Core
namespace Umbraco.Core.Composing
{
/// <summary>
/// Provides extension methods to the <see cref="IFactory"/> class.
@@ -1,6 +1,4 @@
using Umbraco.Core.Composing;
namespace Umbraco.Core
namespace Umbraco.Core.Composing
{
/// <summary>
/// Provides extension methods to the <see cref="IRegister"/> class.
+26 -8
View File
@@ -42,30 +42,30 @@ namespace Umbraco.Core.Composing
private string _currentAssembliesHash;
private IEnumerable<Assembly> _assemblies;
private bool _reportedChange;
private static string _localTempPath;
private static LocalTempStorage _localTempStorage;
private static string _fileBasePath;
/// <summary>
/// Initializes a new instance of the <see cref="TypeLoader"/> class.
/// </summary>
/// <param name="runtimeCache">The application runtime cache.</param>
/// <param name="localTempPath">Files storage location.</param>
/// <param name="localTempStorage">Files storage mode.</param>
/// <param name="logger">A profiling logger.</param>
public TypeLoader(IAppPolicyCache runtimeCache, string localTempPath, IProfilingLogger logger)
: this(runtimeCache, localTempPath, logger, true)
public TypeLoader(IAppPolicyCache runtimeCache, LocalTempStorage localTempStorage, IProfilingLogger logger)
: this(runtimeCache, localTempStorage, logger, true)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="TypeLoader"/> class.
/// </summary>
/// <param name="runtimeCache">The application runtime cache.</param>
/// <param name="localTempPath">Files storage location.</param>
/// <param name="localTempStorage">Files storage mode.</param>
/// <param name="logger">A profiling logger.</param>
/// <param name="detectChanges">Whether to detect changes using hashes.</param>
internal TypeLoader(IAppPolicyCache runtimeCache, string localTempPath, IProfilingLogger logger, bool detectChanges)
internal TypeLoader(IAppPolicyCache runtimeCache, LocalTempStorage localTempStorage, IProfilingLogger logger, bool detectChanges)
{
_runtimeCache = runtimeCache ?? throw new ArgumentNullException(nameof(runtimeCache));
_localTempPath = localTempPath;
_localTempStorage = localTempStorage == LocalTempStorage.Unknown ? LocalTempStorage.Default : localTempStorage;
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
if (detectChanges)
@@ -388,7 +388,25 @@ namespace Umbraco.Core.Composing
if (_fileBasePath != null)
return _fileBasePath;
_fileBasePath = Path.Combine(_localTempPath, "TypesCache", "umbraco-types." + NetworkHelper.FileSafeMachineName);
switch (_localTempStorage)
{
case LocalTempStorage.AspNetTemp:
_fileBasePath = Path.Combine(HttpRuntime.CodegenDir, "UmbracoData", "umbraco-types");
break;
case LocalTempStorage.EnvironmentTemp:
// include the appdomain hash is just a safety check, for example if a website is moved from worker A to worker B and then back
// to worker A again, in theory the %temp% folder should already be empty but we really want to make sure that its not
// utilizing an old path - assuming we cannot have SHA1 collisions on AppDomainAppId
var appDomainHash = HttpRuntime.AppDomainAppId.ToSHA1();
var cachePath = Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "UmbracoData", appDomainHash);
_fileBasePath = Path.Combine(cachePath, "umbraco-types");
break;
case LocalTempStorage.Default:
default:
var tempFolder = IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "TypesCache");
_fileBasePath = Path.Combine(tempFolder, "umbraco-types." + NetworkHelper.FileSafeMachineName);
break;
}
// ensure that the folder exists
var directory = Path.GetDirectoryName(_fileBasePath);
@@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.PackageActions;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core
namespace Umbraco.Core.Composing
{
internal static class TypeLoaderExtensions
{
@@ -4,8 +4,15 @@ using System.Linq;
using System.Net.Configuration;
using System.Web;
using System.Web.Configuration;
using System.Web.Hosting;
using System.Web.Security;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Security;
namespace Umbraco.Core.Configuration
{
@@ -270,7 +277,12 @@ namespace Umbraco.Core.Configuration
}
}
/// <inheritdoc />
/// <summary>
/// This is the location type to store temporary files such as cache files or other localized files for a given machine
/// </summary>
/// <remarks>
/// Currently used for the xml cache file and the plugin cache files
/// </remarks>
public LocalTempStorage LocalTempStorageLocation
{
get
@@ -283,30 +295,6 @@ namespace Umbraco.Core.Configuration
}
}
/// <inheritdoc />
public string LocalTempPath
{
get
{
switch (LocalTempStorageLocation)
{
case LocalTempStorage.AspNetTemp:
return System.IO.Path.Combine(HttpRuntime.CodegenDir, "UmbracoData");
case LocalTempStorage.EnvironmentTemp:
// include the appdomain hash is just a safety check, for example if a website is moved from worker A to worker B and then back
// to worker A again, in theory the %temp% folder should already be empty but we really want to make sure that its not
// utilizing an old path - assuming we cannot have SHA1 collisions on AppDomainAppId
var appDomainHash = HttpRuntime.AppDomainAppId.GenerateHash();
return System.IO.Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "UmbracoData", appDomainHash);
//case LocalTempStorage.Default:
//case LocalTempStorage.Unknown:
default:
return IOHelper.MapPath("~/App_Data/TEMP");
}
}
}
/// <summary>
/// Gets the default UI language.
/// </summary>
@@ -360,5 +348,10 @@ namespace Umbraco.Core.Configuration
}
}
}
}
}
@@ -1,4 +1,6 @@
namespace Umbraco.Core.Configuration
using System;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// Contains general settings information for the entire Umbraco instance based on information from web.config appsettings
@@ -59,13 +61,11 @@
int VersionCheckPeriod { get; }
/// <summary>
/// Gets the configuration for the location of temporary files.
/// This is the location type to store temporary files such as cache files or other localized files for a given machine
/// </summary>
/// <remarks>
/// Used for some cache files and for specific environments such as Azure
/// </remarks>
LocalTempStorage LocalTempStorageLocation { get; }
/// <summary>
/// Gets the location of temporary files.
/// </summary>
string LocalTempPath { get; }
}
}
+3 -3
View File
@@ -77,7 +77,7 @@
/// alias for the macro tree.
/// </summary>
public const string Macros = "macros";
/// <summary>
/// alias for the datatype tree.
/// </summary>
@@ -92,7 +92,7 @@
/// alias for the dictionary tree.
/// </summary>
public const string Dictionary = "dictionary";
public const string Stylesheets = "stylesheets";
/// <summary>
@@ -121,7 +121,7 @@
public const string Templates = "templates";
public const string RelationTypes = "relationTypes";
public const string Languages = "languages";
/// <summary>
+6 -6
View File
@@ -219,7 +219,7 @@ namespace Umbraco.Core
},
{
FailedPasswordAttempts,
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Integer, true, FailedPasswordAttempts)
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Integer, true, FailedPasswordAttempts)
{
Name = FailedPasswordAttemptsLabel
}
@@ -240,35 +240,35 @@ namespace Umbraco.Core
},
{
LastLockoutDate,
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastLockoutDate)
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, true, LastLockoutDate)
{
Name = LastLockoutDateLabel
}
},
{
LastLoginDate,
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastLoginDate)
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, true, LastLoginDate)
{
Name = LastLoginDateLabel
}
},
{
LastPasswordChangeDate,
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastPasswordChangeDate)
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Date, true, LastPasswordChangeDate)
{
Name = LastPasswordChangeDateLabel
}
},
{
PasswordAnswer,
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar, true, PasswordAnswer)
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Nvarchar, true, PasswordAnswer)
{
Name = PasswordAnswerLabel
}
},
{
PasswordQuestion,
new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar, true, PasswordQuestion)
new PropertyType(PropertyEditors.Aliases.NoEdit, ValueStorageType.Nvarchar, true, PasswordQuestion)
{
Name = PasswordQuestionLabel
}
+11 -7
View File
@@ -34,7 +34,11 @@ namespace Umbraco.Core
/// </summary>
public const string ContentPicker = "Umbraco.ContentPicker";
/// <summary>
/// Date.
/// </summary>
public const string Date = "Umbraco.Date";
/// <summary>
/// DateTime.
/// </summary>
@@ -44,7 +48,7 @@ namespace Umbraco.Core
/// DropDown List.
/// </summary>
public const string DropDownListFlexible = "Umbraco.DropDown.Flexible";
/// <summary>
/// Grid.
/// </summary>
@@ -101,9 +105,9 @@ namespace Umbraco.Core
public const string MultipleTextstring = "Umbraco.MultipleTextstring";
/// <summary>
/// Label.
/// NoEdit.
/// </summary>
public const string Label = "Umbraco.Label";
public const string NoEdit = "Umbraco.NoEdit";
/// <summary>
/// Picker Relations.
@@ -114,7 +118,7 @@ namespace Umbraco.Core
/// RadioButton list.
/// </summary>
public const string RadioButtonList = "Umbraco.RadioButtonList";
/// <summary>
/// Slider.
/// </summary>
@@ -138,7 +142,7 @@ namespace Umbraco.Core
/// <summary>
/// TinyMCE
/// </summary>
public const string TinyMce = "Umbraco.TinyMCE";
public const string TinyMce = "Umbraco.TinyMCEv3";
/// <summary>
/// Boolean.
@@ -159,7 +163,7 @@ namespace Umbraco.Core
/// Upload Field.
/// </summary>
public const string UploadField = "Umbraco.UploadField";
/// <summary>
/// Email Address.
/// </summary>
+64
View File
@@ -0,0 +1,64 @@
using System;
namespace Umbraco.Core
{
/// <summary>
/// Abstract implementation of IDisposable.
/// </summary>
/// <remarks>
/// This is for objects that DO have unmanaged resources. Use <see cref="DisposableObjectSlim"/>
/// for objects that do NOT have unmanaged resources, and avoid creating a finalizer.
///
/// Can also be used as a pattern for when inheriting is not possible.
///
/// See also: https://msdn.microsoft.com/en-us/library/b1yfkh5e%28v=vs.110%29.aspx
/// See also: https://lostechies.com/chrispatterson/2012/11/29/idisposable-done-right/
///
/// Note: if an object's ctor throws, it will never be disposed, and so if that ctor
/// has allocated disposable objects, it should take care of disposing them.
/// </remarks>
public abstract class DisposableObject : IDisposable
{
private readonly object _locko = new object();
// gets a value indicating whether this instance is disposed.
// for internal tests only (not thread safe)
public bool Disposed { get; private set; }
// implements IDisposable
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
// finalizer
~DisposableObject()
{
Dispose(false);
}
private void Dispose(bool disposing)
{
// can happen if the object construction failed
if (_locko == null)
return;
lock (_locko)
{
if (Disposed) return;
Disposed = true;
}
DisposeUnmanagedResources();
if (disposing)
DisposeResources();
}
protected abstract void DisposeResources();
protected virtual void DisposeUnmanagedResources()
{ }
}
}
+20 -2
View File
@@ -1,4 +1,6 @@
using System.IO;
using System;
using System.IO;
using System.Web;
using Umbraco.Core.Configuration;
namespace Umbraco.Core.IO
@@ -10,7 +12,23 @@ namespace Umbraco.Core.IO
// TODO: Kill this off we don't have umbraco.config XML cache we now have NuCache
public static string GetContentCacheXml(IGlobalSettings globalSettings)
{
return Path.Combine(globalSettings.LocalTempPath, "umbraco.config");
switch (globalSettings.LocalTempStorageLocation)
{
case LocalTempStorage.AspNetTemp:
return Path.Combine(HttpRuntime.CodegenDir, @"UmbracoData\umbraco.config");
case LocalTempStorage.EnvironmentTemp:
var appDomainHash = HttpRuntime.AppDomainAppId.ToSHA1();
var cachePath = Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "UmbracoData",
//include the appdomain hash is just a safety check, for example if a website is moved from worker A to worker B and then back
// to worker A again, in theory the %temp% folder should already be empty but we really want to make sure that its not
// utilizing an old path
appDomainHash);
return Path.Combine(cachePath, "umbraco.config");
case LocalTempStorage.Default:
return IOHelper.ReturnPath(Constants.AppSettings.ContentXML, "~/App_Data/umbraco.config");
default:
throw new ArgumentOutOfRangeException();
}
}
}
}
+1 -1
View File
@@ -41,7 +41,7 @@ namespace Umbraco.Core.Logging
}
// a lightweight disposable timer
private class LightDisposableTimer : DisposableObjectSlim
private class LightDisposableTimer : DisposableObject
{
private readonly Action<long> _callback;
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
@@ -22,7 +22,6 @@ namespace Umbraco.Core.Logging.Serilog
//Set this environment variable - so that it can be used in external config file
//add key="serilog:write-to:RollingFile.pathFormat" value="%BASEDIR%\logs\log.txt" />
Environment.SetEnvironmentVariable("BASEDIR", AppDomain.CurrentDomain.BaseDirectory, EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("MACHINENAME", Environment.MachineName, EnvironmentVariableTarget.Process);
logConfig.MinimumLevel.Verbose() //Set to highest level of logging (as any sinks may want to restrict it to Errors only)
.Enrich.WithProcessId()
@@ -41,6 +41,8 @@ namespace Umbraco.Core.Logging.Serilog
var loggerConfig = new LoggerConfiguration();
loggerConfig
.MinimalConfiguration()
.OutputDefaultTextFile(LogEventLevel.Debug)
.OutputDefaultJsonFile()
.ReadFromConfigFile()
.ReadFromUserConfigFile();
@@ -1,5 +1,4 @@
using Umbraco.Core.Compose;
using Umbraco.Core.Composing;
using Umbraco.Core.Components;
namespace Umbraco.Core.Logging.Viewer
{
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Umbraco.Core.Logging
public void Stop(bool discardResults = false)
{ }
private class VoidDisposable : DisposableObjectSlim
private class VoidDisposable : DisposableObject
{
protected override void DisposeResources()
{ }
@@ -1,10 +1,10 @@
using System.Runtime.Serialization;
using Umbraco.Core.Models.Sections;
using Umbraco.Core.Models.Trees;
namespace Umbraco.Core.Manifest
{
[DataContract(Name = "section", Namespace = "")]
public class ManifestSection : ISection
public class ManifestBackOfficeSection : IBackOfficeSection
{
[DataMember(Name = "alias")]
public string Alias { get; set; }
+1 -1
View File
@@ -101,7 +101,7 @@ namespace Umbraco.Core.Manifest
var gridEditors = new List<GridEditor>();
var contentApps = new List<ManifestContentAppDefinition>();
var dashboards = new List<ManifestDashboard>();
var sections = new List<ManifestSection>();
var sections = new List<ManifestBackOfficeSection>();
foreach (var manifest in manifests)
{
+1 -1
View File
@@ -55,6 +55,6 @@ namespace Umbraco.Core.Manifest
/// Gets or sets the sections listed in the manifest.
/// </summary>
[JsonProperty("sections")]
public ManifestSection[] Sections { get; set; } = Array.Empty<ManifestSection>();
public ManifestBackOfficeSection[] Sections { get; set; } = Array.Empty<ManifestBackOfficeSection>();
}
}
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Logging;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
namespace Umbraco.Core.Migrations
@@ -34,11 +32,5 @@ namespace Umbraco.Core.Migrations
/// Gets or sets a value indicating whether an expression is being built.
/// </summary>
bool BuildingExpression { get; set; }
/// <summary>
/// Adds a post-migrations.
/// </summary>
void AddPostMigration<TMigration>()
where TMigration : IMigration;
}
}
@@ -0,0 +1,12 @@
using Semver;
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Scoping;
namespace Umbraco.Core.Migrations
{
public interface IPostMigration : IDiscoverable
{
void Execute(string name, IScope scope, SemVersion originVersion, SemVersion targetVersion, ILogger logger);
}
}
@@ -27,6 +27,7 @@ namespace Umbraco.Core.Migrations.Install
private readonly IRuntimeState _runtime;
private readonly IMigrationBuilder _migrationBuilder;
private readonly IKeyValueService _keyValueService;
private readonly PostMigrationCollection _postMigrations;
private readonly ILogger _logger;
private DatabaseSchemaResult _databaseSchemaValidationResult;
@@ -34,7 +35,7 @@ namespace Umbraco.Core.Migrations.Install
/// <summary>
/// Initializes a new instance of the <see cref="DatabaseBuilder"/> class.
/// </summary>
public DatabaseBuilder(IScopeProvider scopeProvider, IGlobalSettings globalSettings, IUmbracoDatabaseFactory databaseFactory, IRuntimeState runtime, ILogger logger, IMigrationBuilder migrationBuilder, IKeyValueService keyValueService)
public DatabaseBuilder(IScopeProvider scopeProvider, IGlobalSettings globalSettings, IUmbracoDatabaseFactory databaseFactory, IRuntimeState runtime, ILogger logger, IMigrationBuilder migrationBuilder, IKeyValueService keyValueService, PostMigrationCollection postMigrations)
{
_scopeProvider = scopeProvider;
_globalSettings = globalSettings;
@@ -43,6 +44,7 @@ namespace Umbraco.Core.Migrations.Install
_logger = logger;
_migrationBuilder = migrationBuilder;
_keyValueService = keyValueService;
_postMigrations = postMigrations;
}
#region Status
@@ -481,7 +483,7 @@ namespace Umbraco.Core.Migrations.Install
/// configured and it is possible to connect to the database.</para>
/// <para>Runs whichever migrations need to run.</para>
/// </remarks>
public Result UpgradeSchemaAndData(MigrationPlan plan)
public Result UpgradeSchemaAndData()
{
try
{
@@ -494,8 +496,8 @@ namespace Umbraco.Core.Migrations.Install
_logger.Info<DatabaseBuilder>("Database upgrade started");
// upgrade
var upgrader = new Upgrader(plan);
upgrader.Execute(_scopeProvider, _migrationBuilder, _keyValueService, _logger);
var upgrader = new UmbracoUpgrader();
upgrader.Execute(_scopeProvider, _migrationBuilder, _keyValueService, _logger, _postMigrations);
var message = "<p>Upgrade completed!</p>";
@@ -271,17 +271,17 @@ namespace Umbraco.Core.Migrations.Install
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -88, EditorAlias = Constants.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -89, EditorAlias = Constants.PropertyEditors.Aliases.TextArea, DbType = "Ntext" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -90, EditorAlias = Constants.PropertyEditors.Aliases.UploadField, DbType = "Nvarchar" });
InsertDataTypeDto(Constants.DataTypes.LabelString, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"STRING\"}");
InsertDataTypeDto(Constants.DataTypes.LabelInt, Constants.PropertyEditors.Aliases.Label, "Integer", "{\"umbracoDataValueType\":\"INT\"}");
InsertDataTypeDto(Constants.DataTypes.LabelBigint, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}");
InsertDataTypeDto(Constants.DataTypes.LabelDateTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}");
InsertDataTypeDto(Constants.DataTypes.LabelDecimal, Constants.PropertyEditors.Aliases.Label, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}");
InsertDataTypeDto(Constants.DataTypes.LabelTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"TIME\"}");
InsertDataTypeDto(Constants.DataTypes.LabelString, Constants.PropertyEditors.Aliases.NoEdit, "Nvarchar", "{\"umbracoDataValueType\":\"STRING\"}");
InsertDataTypeDto(Constants.DataTypes.LabelInt, Constants.PropertyEditors.Aliases.NoEdit, "Integer", "{\"umbracoDataValueType\":\"INT\"}");
InsertDataTypeDto(Constants.DataTypes.LabelBigint, Constants.PropertyEditors.Aliases.NoEdit, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}");
InsertDataTypeDto(Constants.DataTypes.LabelDateTime, Constants.PropertyEditors.Aliases.NoEdit, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}");
InsertDataTypeDto(Constants.DataTypes.LabelDecimal, Constants.PropertyEditors.Aliases.NoEdit, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}");
InsertDataTypeDto(Constants.DataTypes.LabelTime, Constants.PropertyEditors.Aliases.NoEdit, "Date", "{\"umbracoDataValueType\":\"TIME\"}");
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -36, EditorAlias = Constants.PropertyEditors.Aliases.DateTime, DbType = "Date" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -37, EditorAlias = Constants.PropertyEditors.Aliases.ColorPicker, DbType = "Nvarchar" });
InsertDataTypeDto(Constants.DataTypes.DropDownSingle, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":false}");
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -40, EditorAlias = Constants.PropertyEditors.Aliases.RadioButtonList, DbType = "Nvarchar" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -41, EditorAlias = "Umbraco.Date", DbType = "Date" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -41, EditorAlias = Constants.PropertyEditors.Aliases.Date, DbType = "Date" });
InsertDataTypeDto(Constants.DataTypes.DropDownMultiple, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":true}");
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -43, EditorAlias = Constants.PropertyEditors.Aliases.CheckBoxList, DbType = "Nvarchar" });
_database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1041, EditorAlias = Constants.PropertyEditors.Aliases.Tags, DbType = "Ntext",
@@ -321,7 +321,7 @@ namespace Umbraco.Core.Migrations.Install
{
// on install, initialize the umbraco migration plan with the final state
var upgrader = new Upgrader(new UmbracoPlan());
var upgrader = new UmbracoUpgrader();
var stateValueKey = upgrader.StateValueKey;
var finalState = upgrader.Plan.FinalState;
@@ -50,6 +50,8 @@ namespace Umbraco.Core.Migrations.Install
typeof (MemberTypeDto),
typeof (MemberDto),
typeof (Member2MemberGroupDto),
typeof (ContentXmlDto),
typeof (PreviewXmlDto),
typeof (PropertyTypeGroupDto),
typeof (PropertyTypeDto),
typeof (PropertyDataDto),
@@ -137,18 +139,13 @@ namespace Umbraco.Core.Migrations.Install
/// Validates the schema of the current database.
/// </summary>
internal DatabaseSchemaResult ValidateSchema()
{
return ValidateSchema(OrderedTables);
}
internal DatabaseSchemaResult ValidateSchema(IEnumerable<Type> orderedTables)
{
var result = new DatabaseSchemaResult(SqlSyntax);
result.IndexDefinitions.AddRange(SqlSyntax.GetDefinedIndexes(_database)
.Select(x => new DbIndexDefinition(x)));
result.TableDefinitions.AddRange(orderedTables
result.TableDefinitions.AddRange(OrderedTables
.Select(x => DefinitionFactory.GetTableDefinition(x, SqlSyntax)));
ValidateDbTables(result);
@@ -96,12 +96,6 @@ namespace Umbraco.Core.Migrations
return tables.Any(x => x.InvariantEquals(tableName));
}
protected bool IndexExists(string indexName)
{
var indexes = SqlSyntax.GetDefinedIndexes(Context.Database);
return indexes.Any(x => x.Item2.InvariantEquals(indexName));
}
protected bool ColumnExists(string tableName, string columnName)
{
var columns = SqlSyntax.GetColumnsInSchema(Context.Database).Distinct().ToArray();
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
namespace Umbraco.Core.Migrations
{
/// <summary>
/// Implements <see cref="IMigrationContext"/>.
/// Represents a migration context.
/// </summary>
internal class MigrationContext : IMigrationContext
{
@@ -33,15 +32,5 @@ namespace Umbraco.Core.Migrations
/// <inheritdoc />
public bool BuildingExpression { get; set; }
// this is only internally exposed
public List<Type> PostMigrations { get; } = new List<Type>();
/// <inheritdoc />
public void AddPostMigration<TMigration>()
where TMigration : IMigration
{
PostMigrations.Add(typeof(TMigration));
}
}
}
@@ -14,7 +14,6 @@ namespace Umbraco.Core.Migrations
public class MigrationPlan
{
private readonly Dictionary<string, Transition> _transitions = new Dictionary<string, Transition>();
private readonly List<Type> _postMigrationTypes = new List<Type>();
private string _prevState;
private string _finalState;
@@ -167,25 +166,6 @@ namespace Umbraco.Core.Migrations
return this;
}
/// <summary>
/// Prepares post-migrations.
/// </summary>
/// <remarks>
/// <para>This can be overriden to filter, complement, and/or re-order post-migrations.</para>
/// </remarks>
protected virtual IEnumerable<Type> PreparePostMigrations(IEnumerable<Type> types)
=> types;
/// <summary>
/// Adds a post-migration to the plan.
/// </summary>
public virtual MigrationPlan AddPostMigration<TMigration>()
where TMigration : IMigration
{
_postMigrationTypes.Add(typeof(TMigration));
return this;
}
/// <summary>
/// Creates a random, unique state.
/// </summary>
@@ -290,7 +270,6 @@ namespace Umbraco.Core.Migrations
throw new Exception($"Unknown state \"{origState}\".");
var context = new MigrationContext(scope.Database, logger);
context.PostMigrations.AddRange(_postMigrationTypes);
while (transition != null)
{
@@ -306,20 +285,6 @@ namespace Umbraco.Core.Migrations
throw new Exception($"Unknown state \"{origState}\".");
}
// prepare and de-duplicate post-migrations, only keeping the 1st occurence
var temp = new HashSet<Type>();
var postMigrationTypes = PreparePostMigrations(context.PostMigrations)
.Where(x => !temp.Contains(x))
.Select(x => { temp.Add(x); return x; });
// run post-migrations
foreach (var postMigrationType in postMigrationTypes)
{
logger.Info<MigrationPlan>($"PostMigration: {postMigrationType.FullName}.");
var postMigration = migrationBuilder.Build(postMigrationType, context);
postMigration.Migrate();
}
logger.Info<MigrationPlan>("Done (pending scope completion).");
// safety check
@@ -0,0 +1,12 @@
using System.Collections.Generic;
using Umbraco.Core.Composing;
namespace Umbraco.Core.Migrations
{
public class PostMigrationCollection : BuilderCollectionBase<IPostMigration>
{
public PostMigrationCollection(IEnumerable<IPostMigration> items)
: base(items)
{ }
}
}
@@ -0,0 +1,11 @@
using Umbraco.Core.Composing;
namespace Umbraco.Core.Migrations
{
public class PostMigrationCollectionBuilder : LazyCollectionBuilderBase<PostMigrationCollectionBuilder, PostMigrationCollection, IPostMigration>
{
protected override PostMigrationCollectionBuilder This => this;
protected override Lifetime CollectionLifetime => Lifetime.Transient;
}
}
@@ -1,18 +0,0 @@
namespace Umbraco.Core.Migrations.PostMigrations
{
/// <summary>
/// Rebuilds the published snapshot.
/// </summary>
/// <remarks>
/// <para>This interface exists because the entire published snapshot lives in Umbraco.Web
/// but we may want to trigger rebuilds from Umbraco.Core. These two assemblies should
/// be refactored, really.</para>
/// </remarks>
public interface IPublishedSnapshotRebuilder
{
/// <summary>
/// Rebuilds.
/// </summary>
void Rebuild();
}
}
@@ -1,12 +0,0 @@
namespace Umbraco.Core.Migrations.PostMigrations
{
/// <summary>
/// Implements <see cref="IPublishedSnapshotRebuilder"/> in Umbraco.Core (doing nothing).
/// </summary>
public class PublishedSnapshotRebuilder : IPublishedSnapshotRebuilder
{
/// <inheritdoc />
public void Rebuild()
{ }
}
}
@@ -1,24 +0,0 @@
namespace Umbraco.Core.Migrations.PostMigrations
{
/// <summary>
/// Rebuilds the published snapshot.
/// </summary>
public class RebuildPublishedSnapshot : IMigration
{
private readonly IPublishedSnapshotRebuilder _rebuilder;
/// <summary>
/// Initializes a new instance of the <see cref="RebuildPublishedSnapshot"/> class.
/// </summary>
public RebuildPublishedSnapshot(IPublishedSnapshotRebuilder rebuilder)
{
_rebuilder = rebuilder;
}
/// <inheritdoc />
public void Migrate()
{
_rebuilder.Rebuild();
}
}
}
@@ -56,7 +56,7 @@ namespace Umbraco.Core.Migrations.Upgrade
}
}
// define the plan
// define the plan
protected void DefinePlan()
{
// MODIFYING THE PLAN
@@ -127,16 +127,8 @@ namespace Umbraco.Core.Migrations.Upgrade
To<ConvertRelatedLinksToMultiUrlPicker>("{ED28B66A-E248-4D94-8CDB-9BDF574023F0}");
To<UpdatePickerIntegerValuesToUdi>("{38C809D5-6C34-426B-9BEA-EFD39162595C}");
To<RenameUmbracoDomainsTable>("{6017F044-8E70-4E10-B2A3-336949692ADD}");
To<AddUserLoginDtoDateIndex>("{98339BEF-E4B2-48A8-B9D1-D173DC842BBE}");
Merge()
.To<DropXmlTables>("{CDBEDEE4-9496-4903-9CF2-4104E00FF960}")
.With()
.To<RadioAndCheckboxAndDropdownPropertyEditorsMigration>("{940FD19A-00A8-4D5C-B8FF-939143585726}")
.As("{0576E786-5C30-4000-B969-302B61E90CA3}");
To<RenameLabelAndRichTextPropertyEditorAliases>("{E0CBE54D-A84F-4A8F-9B13-900945FD7ED9}");
To<MergeDateAndDateTimePropertyEditor>("{78BAF571-90D0-4D28-8175-EF96316DA789}");
//FINAL
@@ -0,0 +1,48 @@
using System;
using System.Configuration;
using Semver;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
namespace Umbraco.Core.Migrations.Upgrade
{
/// <summary>
/// Represents the Umbraco upgrader.
/// </summary>
public class UmbracoUpgrader : Upgrader
{
private PostMigrationCollection _postMigrations;
/// <summary>
/// Initializes a new instance of the <see ref="UmbracoUpgrader" /> class.
/// </summary>
public UmbracoUpgrader()
: base(new UmbracoPlan())
{ }
/// <summary>
/// Executes.
/// </summary>
public void Execute(IScopeProvider scopeProvider, IMigrationBuilder migrationBuilder, IKeyValueService keyValueService, ILogger logger, PostMigrationCollection postMigrations)
{
_postMigrations = postMigrations;
Execute(scopeProvider, migrationBuilder, keyValueService, logger);
}
/// <inheritdoc />
public override void AfterMigrations(IScope scope, ILogger logger)
{
// assume we have something in web.config that makes some sense = the origin version
if (!SemVersion.TryParse(ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus], out var originVersion))
throw new InvalidOperationException($"Could not get current version from web.config {Constants.AppSettings.ConfigurationStatus} appSetting.");
// target version is the code version
var targetVersion = UmbracoVersion.SemanticVersion;
foreach (var postMigration in _postMigrations)
postMigration.Execute(Name, scope, originVersion, targetVersion, logger);
}
}
}
@@ -53,7 +53,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
var dataTypeDto = new DataTypeDto
{
NodeId = id,
EditorAlias = Constants.PropertyEditors.Aliases.Label,
EditorAlias = Constants.PropertyEditors.Aliases.NoEdit,
DbType = dbType
};
@@ -1,22 +0,0 @@
using Umbraco.Core.Persistence.Dtos;
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class AddUserLoginDtoDateIndex : MigrationBase
{
public AddUserLoginDtoDateIndex(IMigrationContext context)
: base(context)
{ }
public override void Migrate()
{
if (!IndexExists("IX_umbracoUserLogin_lastValidatedUtc"))
Create.Index("IX_umbracoUserLogin_lastValidatedUtc")
.OnTable(UserLoginDto.TableName)
.OnColumn("lastValidatedUtc")
.Ascending()
.WithOptions().NonClustered()
.Do();
}
}
}
@@ -99,6 +99,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
if (requiresCacheRebuild)
{
var dataTypeCacheRefresher = _cacheRefreshers[Guid.Parse("35B16C25-A17E-45D7-BC8F-EDAB1DCC28D2")];
// TODO: this should use DistributedCache not messengers, alas DistributedCache lives in Umbraco.Web
_serverMessenger.PerformRefreshAll(dataTypeCacheRefresher);
}
}
@@ -1,5 +1,6 @@
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class DropTaskTables : MigrationBase
{
public DropTaskTables(IMigrationContext context)
@@ -1,17 +0,0 @@
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class DropXmlTables : MigrationBase
{
public DropXmlTables(IMigrationContext context)
: base(context)
{ }
public override void Migrate()
{
if (TableExists("cmsContentXml"))
Delete.Table("cmsContentXml").Do();
if (TableExists("cmsPreviewXml"))
Delete.Table("cmsPreviewXml").Do();
}
}
}
@@ -1,66 +0,0 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class MergeDateAndDateTimePropertyEditor : MigrationBase
{
public MergeDateAndDateTimePropertyEditor(IMigrationContext context)
: base(context)
{
}
public override void Migrate()
{
var dataTypes = GetDataTypes("Umbraco.Date");
foreach (var dataType in dataTypes)
{
DateTimeConfiguration config;
try
{
config = (DateTimeConfiguration) new CustomDateTimeConfigurationEditor().FromDatabase(
dataType.Configuration);
}
catch (Exception ex)
{
Logger.Error<DropDownPropertyEditorsMigration>(
ex,
"Invalid property editor configuration detected: \"{Configuration}\", cannot convert editor, values will be cleared",
dataType.Configuration);
continue;
}
config.OffsetTime = false;
dataType.EditorAlias = Constants.PropertyEditors.Aliases.DateTime;
dataType.Configuration = ConfigurationEditor.ToDatabase(config);
Database.Update(dataType);
}
}
private List<DataTypeDto> GetDataTypes(string editorAlias)
{
//need to convert the old drop down data types to use the new one
var dataTypes = Database.Fetch<DataTypeDto>(Sql()
.Select<DataTypeDto>()
.From<DataTypeDto>()
.Where<DataTypeDto>(x => x.EditorAlias == editorAlias));
return dataTypes;
}
private class CustomDateTimeConfigurationEditor : ConfigurationEditor<DateTimeConfiguration>
{
}
}
}
@@ -1,183 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Umbraco.Core.Logging;
using Umbraco.Core.Migrations.PostMigrations;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class RadioAndCheckboxAndDropdownPropertyEditorsMigration : MigrationBase
{
public RadioAndCheckboxAndDropdownPropertyEditorsMigration(IMigrationContext context)
: base(context)
{
}
public override void Migrate()
{
var refreshCache = false;
refreshCache |= Migrate(Constants.PropertyEditors.Aliases.RadioButtonList, (dto, configuration) => UpdateRadioOrCheckboxPropertyDataDto(dto, configuration, true));
refreshCache |= Migrate(Constants.PropertyEditors.Aliases.CheckBoxList, (dto, configuration) => UpdateRadioOrCheckboxPropertyDataDto(dto, configuration, false));
refreshCache |= Migrate(Constants.PropertyEditors.Aliases.DropDownListFlexible, UpdateDropDownPropertyDataDto);
if (refreshCache)
{
Context.AddPostMigration<RebuildPublishedSnapshot>();
}
}
private bool Migrate(string editorAlias, Func<PropertyDataDto, ValueListConfiguration, bool> updateRadioPropertyDataFunc)
{
var refreshCache = false;
var dataTypes = GetDataTypes(editorAlias);
foreach (var dataType in dataTypes)
{
ValueListConfiguration config;
if (dataType.Configuration.IsNullOrWhiteSpace())
continue;
// parse configuration, and update everything accordingly
try
{
config = (ValueListConfiguration) new ValueListConfigurationEditor().FromDatabase(
dataType.Configuration);
}
catch (Exception ex)
{
Logger.Error<DropDownPropertyEditorsMigration>(
ex,
"Invalid property editor configuration detected: \"{Configuration}\", cannot convert editor, values will be cleared",
dataType.Configuration);
continue;
}
// get property data dtos
var propertyDataDtos = Database.Fetch<PropertyDataDto>(Sql()
.Select<PropertyDataDto>()
.From<PropertyDataDto>()
.InnerJoin<PropertyTypeDto>()
.On<PropertyTypeDto, PropertyDataDto>((pt, pd) => pt.Id == pd.PropertyTypeId)
.InnerJoin<DataTypeDto>()
.On<DataTypeDto, PropertyTypeDto>((dt, pt) => dt.NodeId == pt.DataTypeId)
.Where<PropertyTypeDto>(x => x.DataTypeId == dataType.NodeId));
// update dtos
var updatedDtos = propertyDataDtos.Where(x => updateRadioPropertyDataFunc(x, config));
// persist changes
foreach (var propertyDataDto in updatedDtos) Database.Update(propertyDataDto);
UpdateDataType(dataType);
refreshCache = true;
}
return refreshCache;
}
private List<DataTypeDto> GetDataTypes(string editorAlias)
{
//need to convert the old drop down data types to use the new one
var dataTypes = Database.Fetch<DataTypeDto>(Sql()
.Select<DataTypeDto>()
.From<DataTypeDto>()
.Where<DataTypeDto>(x => x.EditorAlias == editorAlias));
return dataTypes;
}
private void UpdateDataType(DataTypeDto dataType)
{
dataType.DbType = ValueStorageType.Nvarchar.ToString();
Database.Update(dataType);
}
private bool UpdateRadioOrCheckboxPropertyDataDto(PropertyDataDto propData, ValueListConfiguration config, bool singleValue)
{
//Get the INT ids stored for this property/drop down
int[] ids = null;
if (!propData.VarcharValue.IsNullOrWhiteSpace())
{
ids = ConvertStringValues(propData.VarcharValue);
}
else if (!propData.TextValue.IsNullOrWhiteSpace())
{
ids = ConvertStringValues(propData.TextValue);
}
else if (propData.IntegerValue.HasValue)
{
ids = new[] {propData.IntegerValue.Value};
}
//if there are INT ids, convert them to values based on the configuration
if (ids == null || ids.Length <= 0) return false;
//map the ids to values
var values = new List<string>();
var canConvert = true;
foreach (var id in ids)
{
var val = config.Items.FirstOrDefault(x => x.Id == id);
if (val != null)
values.Add(val.Value);
else
{
Logger.Warn<DropDownPropertyEditorsMigration>(
"Could not find associated data type configuration for stored Id {DataTypeId}", id);
canConvert = false;
}
}
if (!canConvert) return false;
//The radio button only supports selecting a single value, so if there are multiple for some insane reason we can only use the first
propData.VarcharValue = singleValue ? values[0] : JsonConvert.SerializeObject(values);
propData.TextValue = null;
propData.IntegerValue = null;
return true;
}
private bool UpdateDropDownPropertyDataDto(PropertyDataDto propData, ValueListConfiguration config)
{
//Get the INT ids stored for this property/drop down
var values = propData.VarcharValue.Split(new []{","}, StringSplitOptions.RemoveEmptyEntries);
//if there are INT ids, convert them to values based on the configuration
if (values == null || values.Length <= 0) return false;
//The radio button only supports selecting a single value, so if there are multiple for some insane reason we can only use the first
propData.VarcharValue = JsonConvert.SerializeObject(values);
propData.TextValue = null;
propData.IntegerValue = null;
return true;
}
private int[] ConvertStringValues(string val)
{
var splitVals = val.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
var intVals = splitVals
.Select(x => int.TryParse(x, out var i) ? i : int.MinValue)
.Where(x => x != int.MinValue)
.ToArray();
//only return if the number of values are the same (i.e. All INTs)
if (splitVals.Length == intVals.Length)
return intVals;
return null;
}
private class ValueListConfigurationEditor : ConfigurationEditor<ValueListConfiguration>
{
}
}
}
@@ -1,41 +0,0 @@
using System.Collections.Generic;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Dtos;
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class RenameLabelAndRichTextPropertyEditorAliases : MigrationBase
{
public RenameLabelAndRichTextPropertyEditorAliases(IMigrationContext context)
: base(context)
{
}
public override void Migrate()
{
MigratePropertyEditorAlias("Umbraco.TinyMCEv3", Constants.PropertyEditors.Aliases.TinyMce);
MigratePropertyEditorAlias("Umbraco.NoEdit", Constants.PropertyEditors.Aliases.Label);
}
private void MigratePropertyEditorAlias(string oldAlias, string newAlias)
{
var dataTypes = GetDataTypes(oldAlias);
foreach (var dataType in dataTypes)
{
dataType.EditorAlias = newAlias;
Database.Update(dataType);
}
}
private List<DataTypeDto> GetDataTypes(string editorAlias)
{
var dataTypes = Database.Fetch<DataTypeDto>(Sql()
.Select<DataTypeDto>()
.From<DataTypeDto>()
.Where<DataTypeDto>(x => x.EditorAlias == editorAlias));
return dataTypes;
}
}
}
@@ -22,7 +22,6 @@ namespace Umbraco.Core.Models.Packaging
public RequirementsType UmbracoVersionRequirementsType { get; set; }
public string Author { get; set; }
public string AuthorUrl { get; set; }
public IList<string> Contributors { get; set; }
public string Readme { get; set; }
public string PackageView { get; set; }
public string IconUrl { get; set; }
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Models.Packaging
{
@@ -13,7 +12,6 @@ namespace Umbraco.Core.Models.Packaging
Version UmbracoVersion { get; }
string Author { get; }
string AuthorUrl { get; }
IList<string> Contributors { get; }
string Readme { get; }
/// <summary>
@@ -25,7 +25,6 @@ namespace Umbraco.Core.Models.Packaging
Actions = compiled.Actions,
Author = compiled.Author,
AuthorUrl = compiled.AuthorUrl,
Contributors = compiled.Contributors,
PackageView = compiled.PackageView,
IconUrl = compiled.IconUrl,
License = compiled.License,
@@ -80,9 +79,6 @@ namespace Umbraco.Core.Models.Packaging
[Url]
public string AuthorUrl { get; set; } = string.Empty;
[DataMember(Name = "contributors")]
public IList<string> Contributors { get; set; } = new List<string>();
[DataMember(Name = "license")]
public string License { get; set; } = "MIT License";
@@ -87,6 +87,10 @@ namespace Umbraco.Core.Models.PublishedContent
{
lock (_publishedDataTypesLocker)
{
// no ids = force-refresh all
if (ids.Length == 0)
_publishedDataTypes = null;
if (_publishedDataTypes == null)
{
var dataTypes = _dataTypeService.GetAll();
@@ -1,9 +1,9 @@
namespace Umbraco.Core.Models.Sections
namespace Umbraco.Core.Models.Trees
{
/// <summary>
/// Defines a back office section.
/// </summary>
public interface ISection
public interface IBackOfficeSection
{
/// <summary>
/// Gets the alias of the section.
@@ -43,7 +43,6 @@ namespace Umbraco.Core.Packaging
Name = package.Element("name")?.Value,
Author = author.Element("name")?.Value,
AuthorUrl = author.Element("website")?.Value,
Contributors = info.Element("contributors")?.Elements("contributor").Select(x => x.Value).ToList() ?? new List<string>(),
Version = package.Element("version")?.Value,
Readme = info.Element("readme")?.Value,
License = package.Element("license")?.Value,
@@ -102,8 +102,8 @@ namespace Umbraco.Core.Packaging
{
// TODO: I don't think this ordering is necessary
var orderedTypes = (from contentType in contentTypes
orderby contentType.ParentId descending, contentType.Id descending
select contentType).ToList();
orderby contentType.ParentId descending, contentType.Id descending
select contentType).ToList();
removedContentTypes.AddRange(orderedTypes);
contentTypeService.Delete(orderedTypes, userId);
}
@@ -157,7 +157,7 @@ namespace Umbraco.Core.Packaging
DictionaryItemsUninstalled = removedDictionaryItems,
DataTypesUninstalled = removedDataTypes,
LanguagesUninstalled = removedLanguages,
};
return summary;
@@ -188,8 +188,8 @@ namespace Umbraco.Core.Packaging
var element = packageDocument.XmlData;
var roots = from doc in element.Elements()
where (string)doc.Attribute("isDoc") == ""
select doc;
where (string)doc.Attribute("isDoc") == ""
select doc;
var contents = ParseDocumentRootXml(roots, parentId, importedDocumentTypes).ToList();
if (contents.Any())
@@ -289,26 +289,13 @@ namespace Umbraco.Core.Packaging
var nodeName = element.Attribute("nodeName").Value;
var path = element.Attribute("path").Value;
var templateId = element.AttributeValue<int?>("template");
var properties = from property in element.Elements()
where property.Attribute("isDoc") == null
select property;
//TODO: This will almost never work, we can't reference a template by an INT Id within a package manifest, we need to change the
// packager to package templates by UDI and resolve by the same, in 98% of cases, this isn't going to work, or it will resolve the wrong template.
var template = templateId.HasValue ? _fileService.GetTemplate(templateId.Value) : null;
//now double check this is correct since its an INT it could very well be pointing to an invalid template :/
if (template != null)
{
if (!contentType.IsAllowedTemplate(template.Alias))
{
//well this is awkward, we'll set the template to null and it will be wired up to the default template
// when it's persisted in the document repository
template = null;
}
}
IContent content = parent == null
? new Content(nodeName, parentId, contentType)
{
@@ -325,12 +312,6 @@ namespace Umbraco.Core.Packaging
Key = key
};
//Here we make sure that we take composition properties in account as well
//otherwise we would skip them and end up losing content
var propTypes = contentType.CompositionPropertyTypes.Any()
? contentType.CompositionPropertyTypes.ToDictionary(x => x.Alias, x => x)
: contentType.PropertyTypes.ToDictionary(x => x.Alias, x => x);
foreach (var property in properties)
{
string propertyTypeAlias = property.Name.LocalName;
@@ -338,11 +319,10 @@ namespace Umbraco.Core.Packaging
{
var propertyValue = property.Value;
if (propTypes.TryGetValue(propertyTypeAlias, out var propertyType))
{
//set property value
content.SetValue(propertyTypeAlias, propertyValue);
}
var propertyType = contentType.PropertyTypes.FirstOrDefault(pt => pt.Alias == propertyTypeAlias);
//set property value
content.SetValue(propertyTypeAlias, propertyValue);
}
}
@@ -355,7 +335,7 @@ namespace Umbraco.Core.Packaging
public IEnumerable<IContentType> ImportDocumentType(XElement docTypeElement, int userId)
{
return ImportDocumentTypes(new[] { docTypeElement }, userId);
return ImportDocumentTypes(new []{ docTypeElement }, userId);
}
/// <summary>
@@ -379,7 +359,7 @@ namespace Umbraco.Core.Packaging
public IEnumerable<IContentType> ImportDocumentTypes(IReadOnlyCollection<XElement> unsortedDocumentTypes, bool importStructure, int userId)
{
var importedContentTypes = new Dictionary<string, IContentType>();
//When you are importing a single doc type we have to assume that the dependencies are already there.
//Otherwise something like uSync won't work.
var graph = new TopoGraph<string, TopoGraph.Node<string, XElement>>(x => x.Key, x => x.Dependencies);
@@ -472,7 +452,7 @@ namespace Umbraco.Core.Packaging
if (updatedContentTypes.Any())
_contentTypeService.Save(updatedContentTypes, userId);
}
return list;
}
@@ -735,7 +715,7 @@ namespace Umbraco.Core.Packaging
property.Element("Name").Value, dataTypeDefinitionId, property.Element("Type").Value.Trim());
//convert to a label!
dataTypeDefinition = _dataTypeService.GetByEditorAlias(Constants.PropertyEditors.Aliases.Label).FirstOrDefault();
dataTypeDefinition = _dataTypeService.GetByEditorAlias(Constants.PropertyEditors.Aliases.NoEdit).FirstOrDefault();
//if for some odd reason this isn't there then ignore
if (dataTypeDefinition == null) continue;
}
@@ -874,7 +854,7 @@ namespace Umbraco.Core.Packaging
{
_dataTypeService.Save(dataTypes, userId, true);
}
return dataTypes;
}
@@ -957,7 +937,7 @@ namespace Umbraco.Core.Packaging
var items = new List<IDictionaryItem>();
foreach (var dictionaryItemElement in dictionaryItemElementList)
items.AddRange(ImportDictionaryItem(dictionaryItemElement, languages, parentId, userId));
return items;
}
@@ -1044,7 +1024,7 @@ namespace Umbraco.Core.Packaging
_localizationService.Save(langauge, userId);
list.Add(langauge);
}
return list;
}
@@ -1207,7 +1187,7 @@ namespace Umbraco.Core.Packaging
public IEnumerable<ITemplate> ImportTemplate(XElement templateElement, int userId)
{
return ImportTemplates(new[] { templateElement }, userId);
return ImportTemplates(new[] {templateElement}, userId);
}
/// <summary>
@@ -1254,7 +1234,7 @@ namespace Umbraco.Core.Packaging
var alias = templateElement.Element("Alias").Value;
var design = templateElement.Element("Design").Value;
var masterElement = templateElement.Element("Master");
var existingTemplate = _fileService.GetTemplate(alias) as Template;
var template = existingTemplate ?? new Template(templateName, alias);
template.Content = design;
@@ -39,7 +39,6 @@ namespace Umbraco.Core.Packaging
LicenseUrl = xml.Element("license")?.AttributeValue<string>("url") ?? string.Empty,
Author = xml.Element("author")?.Value ?? string.Empty,
AuthorUrl = xml.Element("author")?.AttributeValue<string>("url") ?? string.Empty,
Contributors = xml.Element("contributors")?.Elements("contributor").Select(x => x.Value).ToList() ?? new List<string>(),
Readme = xml.Element("readme")?.Value ?? string.Empty,
Actions = xml.Element("actions")?.ToString(SaveOptions.None) ?? "<actions></actions>", //take the entire outer xml value
ContentNodeId = xml.Element("content")?.AttributeValue<string>("nodeId") ?? string.Empty,
@@ -88,8 +87,6 @@ namespace Umbraco.Core.Packaging
new XCData(def.Author ?? string.Empty),
new XAttribute("url", def.AuthorUrl ?? string.Empty)),
new XElement("contributors", (def.Contributors ?? Array.Empty<string>()).Where(x => !x.IsNullOrWhiteSpace()).Select(x => new XElement("contributor", x))),
new XElement("readme", new XCData(def.Readme ?? string.Empty)),
actionsXml,
new XElement("datatypes", string.Join(",", def.DataTypes ?? Array.Empty<string>())),
@@ -573,25 +573,12 @@ namespace Umbraco.Core.Packaging
package.Add(requirements);
info.Add(package);
// Author
//Author
var author = new XElement("author", "");
author.Add(new XElement("name", definition.Author));
author.Add(new XElement("website", definition.AuthorUrl));
info.Add(author);
// Contributors
var contributors = new XElement("contributors", "");
if (definition.Contributors != null && definition.Contributors.Any())
{
foreach (var contributor in definition.Contributors)
{
contributors.Add(new XElement("contributor", contributor));
}
}
info.Add(contributors);
info.Add(new XElement("readme", new XCData(definition.Readme)));
return info;
@@ -621,5 +608,10 @@ namespace Umbraco.Core.Packaging
var packagesXml = XDocument.Load(packagesFile);
return packagesXml;
}
}
}
@@ -5,16 +5,17 @@ namespace Umbraco.Core
{
public static class DatabaseSchema
{
//TODO: Why aren't all table names with the same prefix?
public const string TableNamePrefix = "umbraco";
public static class Tables
{
public const string Lock = TableNamePrefix + "Lock";
public const string Log = TableNamePrefix + "Log";
public const string Lock = /*TableNamePrefix*/ "umbraco" + "Lock";
public const string Log = /*TableNamePrefix*/ "umbraco" + "Log";
public const string Node = TableNamePrefix + "Node";
public const string Node = /*TableNamePrefix*/ "umbraco" + "Node";
public const string NodeData = /*TableNamePrefix*/ "cms" + "ContentNu";
public const string NodeXml = /*TableNamePrefix*/ "cms" + "ContentXml"; // TODO: get rid of these with the xml cache
public const string NodePreviewXml = /*TableNamePrefix*/ "cms" + "PreviewXml"; // TODO: get rid of these with the xml cache
public const string ContentType = /*TableNamePrefix*/ "cms" + "ContentType";
public const string ContentChildType = /*TableNamePrefix*/ "cms" + "ContentTypeAllowedContentType";
@@ -36,22 +37,22 @@ namespace Umbraco.Core
public const string PropertyTypeGroup = /*TableNamePrefix*/ "cms" + "PropertyTypeGroup";
public const string PropertyData = TableNamePrefix + "PropertyData";
public const string RelationType = TableNamePrefix + "RelationType";
public const string Relation = TableNamePrefix + "Relation";
public const string RelationType = /*TableNamePrefix*/ "umbraco" + "RelationType";
public const string Relation = /*TableNamePrefix*/ "umbraco" + "Relation";
public const string Domain = TableNamePrefix + "Domain";
public const string Language = TableNamePrefix + "Language";
public const string Domain = /*TableNamePrefix*/ "umbraco" + "Domain";
public const string Language = /*TableNamePrefix*/ "umbraco" + "Language";
public const string DictionaryEntry = /*TableNamePrefix*/ "cms" + "Dictionary";
public const string DictionaryValue = /*TableNamePrefix*/ "cms" + "LanguageText";
public const string User = TableNamePrefix + "User";
public const string UserGroup = TableNamePrefix + "UserGroup";
public const string UserStartNode = TableNamePrefix + "UserStartNode";
public const string User2UserGroup = TableNamePrefix + "User2UserGroup";
public const string User2NodeNotify = TableNamePrefix + "User2NodeNotify";
public const string UserGroup2App = TableNamePrefix + "UserGroup2App";
public const string UserGroup2NodePermission = TableNamePrefix + "UserGroup2NodePermission";
public const string ExternalLogin = TableNamePrefix + "ExternalLogin";
public const string User = /*TableNamePrefix*/ "umbraco" + "User";
public const string UserGroup = /*TableNamePrefix*/ "umbraco" + "UserGroup";
public const string UserStartNode = /*TableNamePrefix*/ "umbraco" + "UserStartNode";
public const string User2UserGroup = /*TableNamePrefix*/ "umbraco" + "User2UserGroup";
public const string User2NodeNotify = /*TableNamePrefix*/ "umbraco" + "User2NodeNotify";
public const string UserGroup2App = /*TableNamePrefix*/ "umbraco" + "UserGroup2App";
public const string UserGroup2NodePermission = /*TableNamePrefix*/ "umbraco" + "UserGroup2NodePermission";
public const string ExternalLogin = /*TableNamePrefix*/ "umbraco" + "ExternalLogin";
public const string Macro = /*TableNamePrefix*/ "cms" + "Macro";
public const string MacroProperty = /*TableNamePrefix*/ "cms" + "MacroProperty";
@@ -60,21 +61,21 @@ namespace Umbraco.Core
public const string MemberType = /*TableNamePrefix*/ "cms" + "MemberType";
public const string Member2MemberGroup = /*TableNamePrefix*/ "cms" + "Member2MemberGroup";
public const string Access = TableNamePrefix + "Access";
public const string AccessRule = TableNamePrefix + "AccessRule";
public const string RedirectUrl = TableNamePrefix + "RedirectUrl";
public const string Access = /*TableNamePrefix*/ "umbraco" + "Access";
public const string AccessRule = /*TableNamePrefix*/ "umbraco" + "AccessRule";
public const string RedirectUrl = /*TableNamePrefix*/ "umbraco" + "RedirectUrl";
public const string CacheInstruction = TableNamePrefix + "CacheInstruction";
public const string Server = TableNamePrefix + "Server";
public const string CacheInstruction = /*TableNamePrefix*/ "umbraco" + "CacheInstruction";
public const string Server = /*TableNamePrefix*/ "umbraco" + "Server";
public const string Tag = /*TableNamePrefix*/ "cms" + "Tags";
public const string TagRelationship = /*TableNamePrefix*/ "cms" + "TagRelationship";
public const string KeyValue = TableNamePrefix + "KeyValue";
public const string AuditEntry = TableNamePrefix + "Audit";
public const string Consent = TableNamePrefix + "Consent";
public const string UserLogin = TableNamePrefix + "UserLogin";
public const string AuditEntry = /*TableNamePrefix*/ "umbraco" + "Audit";
public const string Consent = /*TableNamePrefix*/ "umbraco" + "Consent";
public const string UserLogin = /*TableNamePrefix*/ "umbraco" + "UserLogin";
}
}
}
@@ -1,10 +1,9 @@
using NPoco;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.Dtos;
namespace Umbraco.Tests.LegacyXmlPublishedCache
namespace Umbraco.Core.Persistence.Dtos
{
[TableName("cmsContentXml")]
[TableName(Constants.DatabaseSchema.Tables.NodeXml)]
[PrimaryKey("nodeId", AutoIncrement = false)]
[ExplicitColumns]
internal class ContentXmlDto
@@ -21,4 +20,4 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
[Column("rv")]
public long Rv { get; set; }
}
}
}
@@ -1,10 +1,9 @@
using NPoco;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.Dtos;
namespace Umbraco.Tests.LegacyXmlPublishedCache
namespace Umbraco.Core.Persistence.Dtos
{
[TableName("cmsPreviewXml")]
[TableName(Constants.DatabaseSchema.Tables.NodePreviewXml)]
[PrimaryKey("nodeId", AutoIncrement = false)]
[ExplicitColumns]
internal class PreviewXmlDto
@@ -21,4 +20,4 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
[Column("rv")]
public long Rv { get; set; }
}
}
}
@@ -30,14 +30,11 @@ namespace Umbraco.Core.Persistence.Dtos
/// Updated every time a user's session is validated
/// </summary>
/// <remarks>
/// <para>This allows us to guess if a session is timed out if a user doesn't actively
/// log out and also allows us to trim the data in the table.</para>
/// <para>The index is IMPORTANT as it prevents deadlocks during deletion of
/// old sessions (DELETE ... WHERE lastValidatedUtc &lt; date).</para>
/// This allows us to guess if a session is timed out if a user doesn't actively log out
/// and also allows us to trim the data in the table
/// </remarks>
[Column("lastValidatedUtc")]
[NullSetting(NullSetting = NullSettings.NotNull)]
[Index(IndexTypes.NonClustered, Name = "IX_userLoginDto_lastValidatedUtc")]
public DateTime LastValidatedUtc { get; set; }
/// <summary>
@@ -15,7 +15,7 @@ namespace Umbraco.Core.Persistence.Factories
{
if (!editors.TryGet(dto.EditorAlias, out var editor))
{
logger.Warn(typeof(DataTypeFactory), "Could not find an editor with alias {EditorAlias}, converting to label", dto.EditorAlias);
logger.Warn(typeof(DataTypeFactory), "Could not find an editor with alias {dto.EditorAlias}, converting to label", dto.EditorAlias);
//convert to label
editor = new LabelPropertyEditor(logger);
}
@@ -202,8 +202,10 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
"DELETE FROM " + Constants.DatabaseSchema.Tables.DocumentCultureVariation + " WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.DocumentVersion + " WHERE id IN (SELECT id FROM " + Constants.DatabaseSchema.Tables.ContentVersion + " WHERE nodeId = @id)",
"DELETE FROM " + Constants.DatabaseSchema.Tables.PropertyData + " WHERE versionId IN (SELECT id FROM " + Constants.DatabaseSchema.Tables.ContentVersion + " WHERE nodeId = @id)",
"DELETE FROM cmsPreviewXml WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.ContentVersionCultureVariation + " WHERE versionId IN (SELECT id FROM " + Constants.DatabaseSchema.Tables.ContentVersion + " WHERE nodeId = @id)",
"DELETE FROM " + Constants.DatabaseSchema.Tables.ContentVersion + " WHERE nodeId = @id",
"DELETE FROM cmsContentXml WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Content + " WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Access + " WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Node + " WHERE id = @id"
@@ -66,22 +66,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
//no matter what we always must have node id ordered at the end
sql = ordering.Direction == Direction.Ascending ? sql.OrderBy("NodeId") : sql.OrderByDescending("NodeId");
// for content we must query for ContentEntityDto entities to produce the correct culture variant entity names
var pageIndexToFetch = pageIndex + 1;
IEnumerable<BaseDto> dtos;
if(isContent)
{
var page = Database.Page<ContentEntityDto>(pageIndexToFetch, pageSize, sql);
dtos = page.Items;
totalRecords = page.TotalItems;
}
else
{
var page = Database.Page<BaseDto>(pageIndexToFetch, pageSize, sql);
dtos = page.Items;
totalRecords = page.TotalItems;
}
var page = Database.Page<BaseDto>(pageIndex + 1, pageSize, sql);
var dtos = page.Items;
var entities = dtos.Select(x => BuildEntity(isContent, isMedia, x)).ToArray();
if (isContent)
@@ -89,8 +75,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media
if (isMedia)
BuildProperties(entities, dtos.ToList());
BuildProperties(entities, dtos);
totalRecords = page.TotalItems;
return entities;
}
@@ -212,7 +199,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
private IEnumerable<TreeEntityPath> PerformGetAllPaths(Guid objectType, Action<Sql<ISqlContext>> filter = null)
{
// NodeId is named Id on TreeEntityPath = use an alias
var sql = Sql().Select<NodeDto>(x => Alias(x.NodeId, nameof(TreeEntityPath.Id)), x => x.Path).From<NodeDto>().Where<NodeDto>(x => x.NodeObjectType == objectType);
var sql = Sql().Select<NodeDto>(x => Alias(x.NodeId, "Id"), x => x.Path).From<NodeDto>().Where<NodeDto>(x => x.NodeObjectType == objectType);
filter?.Invoke(sql);
return Database.Fetch<TreeEntityPath>(sql);
}
@@ -250,7 +250,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
lock (_codeIdMap)
{
if (_codeIdMap.TryGetValue(isoCode, out var id)) return id;
if (isoCode.Contains('-') && _codeIdMap.TryGetValue(isoCode.Split('-').First(), out var invariantId)) return invariantId;
}
if (throwOnNotFound)
throw new ArgumentException($"Code {isoCode} does not correspond to an existing language.", nameof(isoCode));
@@ -188,6 +188,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
"DELETE FROM cmsMember2MemberGroup WHERE Member = @id",
"DELETE FROM cmsMember WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.ContentVersion + " WHERE nodeId = @id",
"DELETE FROM cmsContentXml WHERE nodeId = @id",
"DELETE FROM " + Constants.DatabaseSchema.Tables.Content + " WHERE nodeId = @id",
"DELETE FROM umbracoNode WHERE id = @id"
};
@@ -135,13 +135,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax
{
reader.Read();
// InstanceName can be NULL for the default instance
version = new ServerVersionInfo(
reader.GetString(0),
reader.IsDBNull(2) ? "(default)" : reader.GetString(2),
reader.IsDBNull(3) ? "" : reader.GetString(3),
(EngineEdition) reader.GetInt32(5),
reader.GetString(7),
reader.GetString(9));
version = new ServerVersionInfo(reader.GetString(0), reader.GetString(2), reader.IsDBNull(3) ? "(default)" : reader.GetString(3), (EngineEdition) reader.GetInt32(5), reader.GetString(7), reader.GetString(9));
}
connection.Close();
}
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Persistence
/// </remarks>
// TODO: these comments are not true anymore
// TODO: this class needs not be disposable!
internal class UmbracoDatabaseFactory : DisposableObjectSlim, IUmbracoDatabaseFactory
internal class UmbracoDatabaseFactory : DisposableObject, IUmbracoDatabaseFactory
{
private readonly Lazy<IMapperCollection> _mappers;
private readonly ILogger _logger;
@@ -5,7 +5,7 @@ namespace Umbraco.Core.PropertyEditors
/// <summary>
/// Represents a property editor for label properties.
/// </summary>
[DataEditor(Constants.PropertyEditors.Aliases.Label, "Label", "readonlyvalue", Icon = "icon-readonly")]
[DataEditor(Constants.PropertyEditors.Aliases.NoEdit, "Label", "readonlyvalue", Icon = "icon-readonly")]
public class LabelPropertyEditor : DataEditor
{
/// <summary>
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Core.PropertyEditors.ValueConverters
@@ -9,6 +8,8 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
[DefaultPropertyValueConverter]
public class CheckboxListValueConverter : PropertyValueConverterBase
{
private static readonly char[] Comma = { ',' };
public override bool IsConverter(PublishedPropertyType propertyType)
=> propertyType.EditorAlias.InvariantEquals(Constants.PropertyEditors.Aliases.CheckBoxList);
@@ -25,7 +26,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
if (string.IsNullOrEmpty(sourceString))
return Enumerable.Empty<string>();
return JsonConvert.DeserializeObject<string[]>(sourceString);
return sourceString.Split(Comma, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim());
}
}
}

Some files were not shown because too many files have changed in this diff Show More