diff --git a/.editorconfig b/.editorconfig
index 5f3b4d684a..d2f3002c12 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -15,3 +15,16 @@ indent_size = 4
# Trim trailing whitespace, limited support.
# https://github.com/editorconfig/editorconfig/wiki/Property-research:-Trim-trailing-spaces
trim_trailing_whitespace = true
+
+[*.{cs,vb}]
+dotnet_style_predefined_type_for_locals_parameters_members = true:error
+
+dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
+dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
+dotnet_naming_rule.private_members_with_underscore.severity = suggestion
+
+dotnet_naming_symbols.private_fields.applicable_kinds = field
+dotnet_naming_symbols.private_fields.applicable_accessibilities = private
+
+dotnet_naming_style.prefix_underscore.capitalization = camel_case
+dotnet_naming_style.prefix_underscore.required_prefix = _
\ No newline at end of file
diff --git a/build/NuSpecs/tools/trees.config.install.xdt b/build/NuSpecs/tools/trees.config.install.xdt
index 5a549e3fd8..dc59b5db10 100644
--- a/build/NuSpecs/tools/trees.config.install.xdt
+++ b/build/NuSpecs/tools/trees.config.install.xdt
@@ -86,9 +86,6 @@
-
+
+
\ No newline at end of file
diff --git a/build/build.ps1 b/build/build.ps1
index 013be89cb4..1c8d429333 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -372,8 +372,6 @@
Write-Host "Add web.config transforms to NuGet package"
mv "$($this.BuildTemp)\WebApp\Views\Web.config" "$($this.BuildTemp)\WebApp\Views\Web.config.transform"
- # fixme - that one does not exist in .bat build either?
- #mv "$($this.BuildTemp)\WebApp\Xslt\Web.config" "$($this.BuildTemp)\WebApp\Xslt\Web.config.transform"
})
$ubuild.DefineMethod("RestoreNuGet",
diff --git a/src/Umbraco.Core/Cache/CacheKeys.cs b/src/Umbraco.Core/Cache/CacheKeys.cs
index 68b4c3b157..bba5655b7a 100644
--- a/src/Umbraco.Core/Cache/CacheKeys.cs
+++ b/src/Umbraco.Core/Cache/CacheKeys.cs
@@ -22,9 +22,7 @@ namespace Umbraco.Core.Cache
[UmbracoWillObsolete("This cache key is only used for the legacy 'library' caching, remove in v8")]
public const string MediaCacheKey = "UL_GetMedia";
-
- public const string MacroXsltCacheKey = "macroXslt_";
-
+
[UmbracoWillObsolete("This cache key is only used for legacy business logic caching, remove in v8")]
public const string MacroCacheKey = "UmbracoMacroCache";
@@ -39,54 +37,14 @@ namespace Umbraco.Core.Cache
[UmbracoWillObsolete("This cache key is only used for legacy template business logic caching, remove in v8")]
public const string TemplateFrontEndCacheKey = "template";
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string TemplateBusinessLogicCacheKey = "UmbracoTemplateCache";
-
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string UserContextCacheKey = "UmbracoUserContext";
-
public const string UserContextTimeoutCacheKey = "UmbracoUserContextTimeout";
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string UserCacheKey = "UmbracoUser";
-
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string UserGroupPermissionsCacheKey = "UmbracoUserGroupPermissions";
-
[UmbracoWillObsolete("This cache key is only used for legacy business logic caching, remove in v8")]
public const string ContentTypeCacheKey = "UmbracoContentType";
[UmbracoWillObsolete("This cache key is only used for legacy business logic caching, remove in v8")]
public const string ContentTypePropertiesCacheKey = "ContentType_PropertyTypes_Content:";
-
- [Obsolete("No longer used and will be removed in v8")]
- public const string PropertyTypeCacheKey = "UmbracoPropertyTypeCache";
-
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string LanguageCacheKey = "UmbracoLanguageCache";
-
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string DomainCacheKey = "UmbracoDomainList";
-
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string StylesheetCacheKey = "UmbracoStylesheet";
-
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string StylesheetPropertyCacheKey = "UmbracoStylesheetProperty";
-
- [Obsolete("This is no longer used and will be removed from the codebase in the future")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string DataTypeCacheKey = "UmbracoDataTypeDefinition";
- public const string DataTypePreValuesCacheKey = "UmbracoPreVal";
-
+
public const string IdToKeyCacheKey = "UI2K__";
public const string KeyToIdCacheKey = "UK2I__";
}
diff --git a/src/Umbraco.Core/Composing/CompositionRoots/RepositoryCompositionRoot.cs b/src/Umbraco.Core/Composing/CompositionRoots/RepositoryCompositionRoot.cs
index 56538a8058..26a95af801 100644
--- a/src/Umbraco.Core/Composing/CompositionRoots/RepositoryCompositionRoot.cs
+++ b/src/Umbraco.Core/Composing/CompositionRoots/RepositoryCompositionRoot.cs
@@ -76,7 +76,6 @@ namespace Umbraco.Core.Composing.CompositionRoots
container.RegisterSingleton();
container.RegisterSingleton();
container.RegisterSingleton();
- container.RegisterSingleton();
}
}
}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs
deleted file mode 100644
index 66531a1ab1..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class DeveloperElement : ConfigurationElement, IDeveloperSection
- {
- private AppCodeFileExtensionsElement _default;
-
- [ConfigurationProperty("appCodeFileExtensions")]
- internal AppCodeFileExtensionsElement AppCodeFileExtensions
- {
- get
- {
- if (_default != null)
- {
- return _default;
- }
-
- //here we need to check if this element is defined, if it is not then we'll setup the defaults
- var prop = Properties["appCodeFileExtensions"];
- var autoFill = this[prop] as ConfigurationElement;
- if (autoFill != null && autoFill.ElementInformation.IsPresent == false)
- {
- var collection = new AppCodeFileExtensionsCollection
- {
- new FileExtensionElement {RawValue = "cs"},
- new FileExtensionElement {RawValue = "vb"}
- };
- _default = new AppCodeFileExtensionsElement
- {
- AppCodeFileExtensionsCollection = collection
- };
-
- return _default;
- }
-
- return (AppCodeFileExtensionsElement)base["appCodeFileExtensions"];
- }
- }
-
- IEnumerable IDeveloperSection.AppCodeFileExtensions
- {
- get { return AppCodeFileExtensions.AppCodeFileExtensionsCollection; }
- }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs
deleted file mode 100644
index af035d2e0e..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class DistributedCallElement : ConfigurationElement, IDistributedCallSection
- {
- [ConfigurationProperty("enable", DefaultValue = false)]
- internal bool Enabled
- {
- get { return (bool)base["enable"]; }
- }
-
- [ConfigurationProperty("user")]
- internal InnerTextConfigurationElement UserId
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["user"],
- //set the default
- 0);
- }
- }
-
- [ConfigurationCollection(typeof(ServerCollection), AddItemName = "server")]
- [ConfigurationProperty("servers", IsDefaultCollection = true)]
- internal ServerCollection Servers
- {
- get { return (ServerCollection)base["servers"]; }
- }
-
- bool IDistributedCallSection.Enabled
- {
- get { return Enabled; }
- }
-
- int IDistributedCallSection.UserId
- {
- get { return UserId; }
- }
-
- IEnumerable IDistributedCallSection.Servers
- {
- get { return Servers; }
- }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IDeveloperSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IDeveloperSection.cs
deleted file mode 100644
index 40aa6af0db..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/IDeveloperSection.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System.Collections.Generic;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- public interface IDeveloperSection : IUmbracoConfigurationSection
- {
- IEnumerable AppCodeFileExtensions { get; }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IDistributedCallSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IDistributedCallSection.cs
deleted file mode 100644
index 96f695c8c7..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/IDistributedCallSection.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Collections.Generic;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- public interface IDistributedCallSection : IUmbracoConfigurationSection
- {
- bool Enabled { get; }
-
- int UserId { get; }
-
- IEnumerable Servers { get; }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ILink.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ILink.cs
deleted file mode 100644
index c4b5781ca3..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ILink.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.ComponentModel;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This is no longer used and will be removed in future versions")]
- public interface ILink
- {
- string Application { get; }
-
- string ApplicationUrl { get; }
-
- string Language { get; }
-
- string UserType { get; }
-
- string HelpUrl { get; }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IRepositoriesSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IRepositoriesSection.cs
deleted file mode 100644
index 7dbb44ba25..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/IRepositoriesSection.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Collections.Generic;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
-
- public interface IRepositoriesSection : IUmbracoConfigurationSection
- {
- IEnumerable Repositories { get; }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IRepository.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IRepository.cs
deleted file mode 100644
index cff1d40145..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/IRepository.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- public interface IRepository
- {
- string Name { get; }
- Guid Id { get; }
- string RepositoryUrl { get; }
- string WebServiceUrl { get; }
- bool HasCustomWebServiceUrl { get; }
- string RestApiUrl { get; }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IServer.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IServer.cs
deleted file mode 100644
index 26b1db056e..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/IServer.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- public interface IServer
- {
- string ForcePortnumber { get; }
- string ForceProtocol { get; }
- string ServerAddress { get; }
-
- string AppId { get; }
- string ServerName { get; }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ITemplatesSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ITemplatesSection.cs
index a08bae87fb..e156b46d6c 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ITemplatesSection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ITemplatesSection.cs
@@ -4,13 +4,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ITemplatesSection : IUmbracoConfigurationSection
{
- bool UseAspNetMasterPages { get; }
-
- bool EnableSkinSupport { get; }
-
RenderingEngine DefaultRenderingEngine { get; }
-
- [Obsolete("This has no affect and will be removed in future versions")]
- bool EnableTemplateFolders { get; }
}
}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
index 085a826626..09cc698756 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
@@ -14,18 +14,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
IRequestHandlerSection RequestHandler { get; }
ITemplatesSection Templates { get; }
-
- IDeveloperSection Developer { get; }
-
-
+
ILoggingSection Logging { get; }
IScheduledTasksSection ScheduledTasks { get; }
- IDistributedCallSection DistributedCall { get; }
-
- IRepositoriesSection PackageRepositories { get; }
-
IProvidersSection Providers { get; }
IWebRoutingSection WebRouting { get; }
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs
deleted file mode 100644
index 1a228d33f2..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class RepositoriesCollection : ConfigurationElementCollection, IEnumerable
- {
- internal void Add(RepositoryElement item)
- {
- BaseAdd(item);
- }
-
- protected override ConfigurationElement CreateNewElement()
- {
- return new RepositoryElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((RepositoryElement)element).Id;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as IRepository;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs
deleted file mode 100644
index 0f1063adb0..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class RepositoriesElement : ConfigurationElement, IRepositoriesSection
- {
-
- [ConfigurationCollection(typeof(RepositoriesCollection), AddItemName = "repository")]
- [ConfigurationProperty("", IsDefaultCollection = true)]
- internal RepositoriesCollection Repositories
- {
- get { return (RepositoriesCollection) base[""]; }
- set { base[""] = value; }
- }
-
- IEnumerable IRepositoriesSection.Repositories
- {
- get { return Repositories; }
- }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryConfigExtensions.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryConfigExtensions.cs
deleted file mode 100644
index d311a4423b..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryConfigExtensions.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Linq;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- public static class RepositoryConfigExtensions
- {
- //Our package repo
- private static readonly Guid RepoGuid = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66");
-
- public static IRepository GetDefault(this IRepositoriesSection repos)
- {
- var found = repos.Repositories.FirstOrDefault(x => x.Id == RepoGuid);
- if (found == null)
- throw new InvalidOperationException("No default package repository found with id " + RepoGuid);
- return found;
- }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs
deleted file mode 100644
index ae583ca7c3..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class RepositoryElement : ConfigurationElement, IRepository
- {
- [ConfigurationProperty("name", IsRequired = true)]
- public string Name
- {
- get { return (string)base["name"]; }
- set { base["name"] = value; }
- }
-
- [ConfigurationProperty("guid", IsRequired = true)]
- public Guid Id
- {
- get { return (Guid)base["guid"]; }
- set { base["guid"] = value; }
- }
-
- [ConfigurationProperty("repositoryurl", DefaultValue = "http://packages.umbraco.org")]
- public string RepositoryUrl
- {
- get { return (string)base["repositoryurl"]; }
- set { base["repositoryurl"] = value; }
- }
-
- [ConfigurationProperty("webserviceurl", DefaultValue = "/umbraco/webservices/api/repository.asmx")]
- public string WebServiceUrl
- {
- get { return (string)base["webserviceurl"]; }
- set { base["webserviceurl"] = value; }
- }
-
- public bool HasCustomWebServiceUrl
- {
- get
- {
- var prop = Properties["webserviceurl"];
- return (string) prop.DefaultValue != (string) this[prop];
- }
- }
-
- [ConfigurationProperty("restapiurl", DefaultValue = "https://our.umbraco.org/webapi/packages/v1")]
- public string RestApiUrl
- {
- get { return (string)base["restapiurl"]; }
- set { base["restapiurl"] = value; }
- }
-
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs
index 8ae5816569..9ce88a8f75 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs
@@ -41,7 +41,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
[ConfigurationProperty("authCookieName")]
internal InnerTextConfigurationElement AuthCookieName
{
- get { return GetOptionalTextElement("authCookieName", Constants.Web.AuthCookieName); }
+ get { return GetOptionalTextElement("authCookieName", "UMB_UCONTEXT"); }
}
[ConfigurationProperty("authCookieDomain")]
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ServerCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ServerCollection.cs
deleted file mode 100644
index dfaa5c5247..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ServerCollection.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ServerCollection : ConfigurationElementCollection, IEnumerable
- {
- protected override ConfigurationElement CreateNewElement()
- {
- return new ServerElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((ServerElement)element).Value;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as IServer;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ServerElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ServerElement.cs
deleted file mode 100644
index 30c836bc07..0000000000
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ServerElement.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ServerElement : InnerTextConfigurationElement, IServer
- {
- public string ForcePortnumber
- {
- get
- {
- return RawXml.Attribute("forcePortnumber") == null
- ? null
- : RawXml.Attribute("forcePortnumber").Value;
- }
- }
-
- public string ForceProtocol
- {
- get
- {
- return RawXml.Attribute("forceProtocol") == null
- ? null
- : RawXml.Attribute("forceProtocol").Value;
- }
- }
-
- string IServer.ServerAddress
- {
- get { return Value; }
- }
-
- public string AppId
- {
- get
- {
- return RawXml.Attribute("appId") == null
- ? null
- : RawXml.Attribute("appId").Value;
- }
- }
- public string ServerName
- {
- get
- {
- return RawXml.Attribute("serverName") == null
- ? null
- : RawXml.Attribute("serverName").Value;
- }
- }
- }
-}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs
index 9eb843313c..d4d0f230ce 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs
@@ -5,50 +5,16 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class TemplatesElement : UmbracoConfigurationElement, ITemplatesSection
{
- [ConfigurationProperty("useAspNetMasterPages")]
- internal InnerTextConfigurationElement UseAspNetMasterPages
- {
- get { return GetOptionalTextElement("useAspNetMasterPages", true); }
- }
-
- [ConfigurationProperty("enableSkinSupport")]
- internal InnerTextConfigurationElement EnableSkinSupport
- {
- get { return GetOptionalTextElement("enableSkinSupport", true); }
- }
-
[ConfigurationProperty("defaultRenderingEngine", IsRequired = true)]
internal InnerTextConfigurationElement DefaultRenderingEngine
{
get { return GetOptionalTextElement("defaultRenderingEngine", RenderingEngine.Mvc); }
}
-
- [Obsolete("This has no affect and will be removed in future versions")]
- [ConfigurationProperty("enableTemplateFolders")]
- internal InnerTextConfigurationElement EnableTemplateFolders
- {
- get { return GetOptionalTextElement("enableTemplateFolders", false); }
- }
-
- bool ITemplatesSection.UseAspNetMasterPages
- {
- get { return UseAspNetMasterPages; }
- }
-
- bool ITemplatesSection.EnableSkinSupport
- {
- get { return EnableSkinSupport; }
- }
-
+
RenderingEngine ITemplatesSection.DefaultRenderingEngine
{
get { return DefaultRenderingEngine; }
}
- [Obsolete("This has no affect and will be removed in future versions")]
- bool ITemplatesSection.EnableTemplateFolders
- {
- get { return EnableTemplateFolders; }
- }
}
}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
index 0cf97b2560..7a08ec3b18 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
@@ -12,7 +12,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
internal BackOfficeElement BackOffice
{
get { return (BackOfficeElement)this["backOffice"]; }
- }
+ }
[ConfigurationProperty("content")]
internal ContentElement Content
@@ -37,14 +37,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
get { return (TemplatesElement)this["templates"]; }
}
-
- [ConfigurationProperty("developer")]
- internal DeveloperElement Developer
- {
- get { return (DeveloperElement)this["developer"]; }
- }
-
-
+
[ConfigurationProperty("logging")]
internal LoggingElement Logging
{
@@ -57,55 +50,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (ScheduledTasksElement)this["scheduledTasks"]; }
}
- [ConfigurationProperty("distributedCall")]
- internal DistributedCallElement DistributedCall
- {
- get { return (DistributedCallElement)this["distributedCall"]; }
- }
-
- private RepositoriesElement _defaultRepositories;
-
- [ConfigurationProperty("repositories")]
- internal RepositoriesElement PackageRepositories
- {
- get
- {
-
- if (_defaultRepositories != null)
- {
- return _defaultRepositories;
- }
-
- //here we need to check if this element is defined, if it is not then we'll setup the defaults
- var prop = Properties["repositories"];
- var repos = this[prop] as ConfigurationElement;
- if (repos != null && repos.ElementInformation.IsPresent == false)
- {
- var collection = new RepositoriesCollection
- {
- new RepositoryElement() {Name = "Umbraco package Repository", Id = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66")}
- };
-
-
- _defaultRepositories = new RepositoriesElement()
- {
- Repositories = collection
- };
-
- return _defaultRepositories;
- }
-
- //now we need to ensure there is *always* our umbraco repo! its hard coded in the codebase!
- var reposElement = (RepositoriesElement)base["repositories"];
- if (reposElement.Repositories.All(x => x.Id != new Guid("65194810-1f85-11dd-bd0b-0800200c9a66")))
- {
- reposElement.Repositories.Add(new RepositoryElement() { Name = "Umbraco package Repository", Id = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66") });
- }
-
- return reposElement;
- }
- }
-
[ConfigurationProperty("providers")]
internal ProvidersElement Providers
{
@@ -141,11 +85,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
IBackOfficeSection IUmbracoSettingsSection.BackOffice
{
get { return BackOffice; }
- }
-
- IDeveloperSection IUmbracoSettingsSection.Developer
- {
- get { return Developer; }
}
ILoggingSection IUmbracoSettingsSection.Logging
@@ -157,17 +96,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
get { return ScheduledTasks; }
}
-
- IDistributedCallSection IUmbracoSettingsSection.DistributedCall
- {
- get { return DistributedCall; }
- }
-
- IRepositoriesSection IUmbracoSettingsSection.PackageRepositories
- {
- get { return PackageRepositories; }
- }
-
+
IProvidersSection IUmbracoSettingsSection.Providers
{
get { return Providers; }
diff --git a/src/Umbraco.Core/Constants-Applications.cs b/src/Umbraco.Core/Constants-Applications.cs
index 4c859469fd..7d8476989a 100644
--- a/src/Umbraco.Core/Constants-Applications.cs
+++ b/src/Umbraco.Core/Constants-Applications.cs
@@ -121,9 +121,7 @@
public const string Templates = "templates";
public const string RelationTypes = "relationTypes";
-
- public const string Xslt = "xslt";
-
+
public const string Languages = "languages";
///
diff --git a/src/Umbraco.Core/Constants-Composing.cs b/src/Umbraco.Core/Constants-Composing.cs
index 734a715c2d..1e8c9886d2 100644
--- a/src/Umbraco.Core/Constants-Composing.cs
+++ b/src/Umbraco.Core/Constants-Composing.cs
@@ -21,7 +21,6 @@
public const string StylesheetFileSystem = "StylesheetFileSystem";
public const string MasterpageFileSystem = "MasterpageFileSystem";
public const string ViewFileSystem = "ViewFileSystem";
- public const string XsltFileSystem = "XsltFileSystem";
public const string JavascriptLibraryFileSystem = "JavascriptLibraryFileSystem";
}
}
diff --git a/src/Umbraco.Core/Constants-PackageRepository.cs b/src/Umbraco.Core/Constants-PackageRepository.cs
new file mode 100644
index 0000000000..bdcb86932b
--- /dev/null
+++ b/src/Umbraco.Core/Constants-PackageRepository.cs
@@ -0,0 +1,15 @@
+namespace Umbraco.Core
+{
+ public static partial class Constants
+ {
+ ///
+ /// Defines the constants used for the Umbraco package repository
+ ///
+ public static class PackageRepository
+ {
+ public const string RestApiBaseUrl = "https://our.umbraco.org/webapi/packages/v1";
+ public const string DefaultRepositoryName = "Umbraco package Repository";
+ public const string DefaultRepositoryId = "65194810-1f85-11dd-bd0b-0800200c9a66";
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Constants-Web.cs b/src/Umbraco.Core/Constants-Web.cs
index a5f140ddba..0da5431e91 100644
--- a/src/Umbraco.Core/Constants-Web.cs
+++ b/src/Umbraco.Core/Constants-Web.cs
@@ -23,13 +23,6 @@ namespace Umbraco.Core
public const string InstallerCookieName = "umb_installId";
- ///
- /// The auth cookie name
- ///
- [Obsolete("DO NOT USE THIS, USE ISecuritySection.AuthCookieName, this will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public const string AuthCookieName = "UMB_UCONTEXT";
-
}
}
}
diff --git a/src/Umbraco.Core/Events/MacroErrorEventArgs.cs b/src/Umbraco.Core/Events/MacroErrorEventArgs.cs
index bdda23ba3a..75312508a7 100644
--- a/src/Umbraco.Core/Events/MacroErrorEventArgs.cs
+++ b/src/Umbraco.Core/Events/MacroErrorEventArgs.cs
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Events
///
/// Filename, file path, fully qualified class name, or other key used by the macro engine to do it's processing of the faulting macro.
///
- public string ItemKey { get; set; }
+ public string MacroSource { get; set; }
///
/// Exception raised.
diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs
index 39e7fa30fc..33989122b8 100644
--- a/src/Umbraco.Core/IO/FileSystems.cs
+++ b/src/Umbraco.Core/IO/FileSystems.cs
@@ -26,7 +26,6 @@ namespace Umbraco.Core.IO
private ShadowWrapper _partialViewsFileSystem;
private ShadowWrapper _stylesheetsFileSystem;
private ShadowWrapper _scriptsFileSystem;
- private ShadowWrapper _xsltFileSystem;
private ShadowWrapper _masterPagesFileSystem;
private ShadowWrapper _mvcViewsFileSystem;
private ShadowWrapper _javaScriptLibraryFileSystem;
@@ -103,16 +102,7 @@ namespace Umbraco.Core.IO
return _scriptsFileSystem;
}
}
-
- public IFileSystem XsltFileSystem
- {
- get
- {
- if (Volatile.Read(ref _wkfsInitialized) == false) EnsureWellKnownFileSystems();
- return _xsltFileSystem;
- }
- }
-
+
public IFileSystem MasterPagesFileSystem
{
get
@@ -163,7 +153,6 @@ namespace Umbraco.Core.IO
var partialViewsFileSystem = new PhysicalFileSystem(SystemDirectories.PartialViews);
var stylesheetsFileSystem = new PhysicalFileSystem(SystemDirectories.Css);
var scriptsFileSystem = new PhysicalFileSystem(SystemDirectories.Scripts);
- var xsltFileSystem = new PhysicalFileSystem(SystemDirectories.Xslt);
var masterPagesFileSystem = new PhysicalFileSystem(SystemDirectories.Masterpages);
var mvcViewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews);
var javaScriptLibraryFileSystem = new PhysicalFileSystem(SystemDirectories.JavaScriptLibrary);
@@ -172,7 +161,6 @@ namespace Umbraco.Core.IO
_partialViewsFileSystem = new ShadowWrapper(partialViewsFileSystem, "Views/Partials", () => IsScoped());
_stylesheetsFileSystem = new ShadowWrapper(stylesheetsFileSystem, "css", () => IsScoped());
_scriptsFileSystem = new ShadowWrapper(scriptsFileSystem, "scripts", () => IsScoped());
- _xsltFileSystem = new ShadowWrapper(xsltFileSystem, "xslt", () => IsScoped());
_masterPagesFileSystem = new ShadowWrapper(masterPagesFileSystem, "masterpages", () => IsScoped());
_mvcViewsFileSystem = new ShadowWrapper(mvcViewsFileSystem, "Views", () => IsScoped());
_javascriptLibraryFileSystem = new ShadowWrapper(javaScriptLibraryFileSystem, "Lib", () => IsScoped());
@@ -366,14 +354,13 @@ namespace Umbraco.Core.IO
if (Volatile.Read(ref _wkfsInitialized) == false) EnsureWellKnownFileSystems();
var typed = _wrappers.ToArray();
- var wrappers = new ShadowWrapper[typed.Length + 7];
+ var wrappers = new ShadowWrapper[typed.Length + 6];
var i = 0;
while (i < typed.Length) wrappers[i] = typed[i++];
wrappers[i++] = _macroPartialFileSystem;
wrappers[i++] = _partialViewsFileSystem;
wrappers[i++] = _stylesheetsFileSystem;
wrappers[i++] = _scriptsFileSystem;
- wrappers[i++] = _xsltFileSystem;
wrappers[i++] = _masterPagesFileSystem;
wrappers[i] = _mvcViewsFileSystem;
diff --git a/src/Umbraco.Core/IO/MasterPageHelper.cs b/src/Umbraco.Core/IO/MasterPageHelper.cs
index e619ec98d8..049db04b9a 100644
--- a/src/Umbraco.Core/IO/MasterPageHelper.cs
+++ b/src/Umbraco.Core/IO/MasterPageHelper.cs
@@ -27,13 +27,7 @@ namespace Umbraco.Core.IO
{
return _masterPageFileSystem.FileExists(GetFilePath(t));
}
-
- [Obsolete("This is only used for legacy purposes and will be removed in future versions")]
- internal string GetPhysicalFilePath(ITemplate t)
- {
- return _masterPageFileSystem.GetFullPath(GetFilePath(t.Alias));
- }
-
+
private string GetFilePath(ITemplate t)
{
return GetFilePath(t.Alias);
diff --git a/src/Umbraco.Core/IO/SystemDirectories.cs b/src/Umbraco.Core/IO/SystemDirectories.cs
index 7d3bfd3ae0..37eb1a09b9 100644
--- a/src/Umbraco.Core/IO/SystemDirectories.cs
+++ b/src/Umbraco.Core/IO/SystemDirectories.cs
@@ -46,8 +46,6 @@ namespace Umbraco.Core.IO
public static string WebServices => IOHelper.ReturnPath("umbracoWebservicesPath", Umbraco.EnsureEndsWith("/") + "webservices");
- public static string Xslt => IOHelper.ReturnPath("umbracoXsltPath", "~/xslt");
-
//by default the packages folder should exist in the data folder
public static string Packages => IOHelper.ReturnPath("umbracoPackagesPath", Data + IOHelper.DirSepChar + "packages");
diff --git a/src/Umbraco.Core/Logging/ParallelForwardingAppender.cs b/src/Umbraco.Core/Logging/ParallelForwardingAppender.cs
deleted file mode 100644
index e8dad743e1..0000000000
--- a/src/Umbraco.Core/Logging/ParallelForwardingAppender.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// fixme - remove this file
-//using log4net.Core;
-//using log4net.Util;
-//using System;
-//using System.Collections.Concurrent;
-//using System.Threading;
-//using System.Threading.Tasks;
-
-//namespace Umbraco.Core.Logging
-//{
-// ///
-// /// An asynchronous appender based on
-// ///
-// ///
-// /// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
-// ///
-// [Obsolete("Use the Log4Net.Async.ParallelForwardingAppender instead this will be removed in future versions")]
-// public class ParallelForwardingAppender : Log4Net.Async.ParallelForwardingAppender
-// {
-// }
-//}
diff --git a/src/Umbraco.Core/Macros/MacroTagParser.cs b/src/Umbraco.Core/Macros/MacroTagParser.cs
index 26f2b34ae5..857d36d2da 100644
--- a/src/Umbraco.Core/Macros/MacroTagParser.cs
+++ b/src/Umbraco.Core/Macros/MacroTagParser.cs
@@ -179,7 +179,7 @@ namespace Umbraco.Core.Macros
// Check whether it's a single tag (.../>) or a tag with children (..>...?...>)
if (tag.Substring(tag.Length - 2, 1) != "/" && tag.IndexOf(" ") > -1)
{
- String closingTag = "" + (tag.Substring(1, tag.IndexOf(" ") - 1)) + ">";
+ string closingTag = "" + (tag.Substring(1, tag.IndexOf(" ") - 1)) + ">";
// Tag with children are only used when a macro is inserted by the umbraco-editor, in the
// following format: "
?UMBRACO_MACRO>", so we
// need to delete extra information inserted which is the image-tag and the closing
diff --git a/src/Umbraco.Core/Macros/XsltExtension.cs b/src/Umbraco.Core/Macros/XsltExtension.cs
deleted file mode 100644
index 7bc9277ac3..0000000000
--- a/src/Umbraco.Core/Macros/XsltExtension.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace Umbraco.Core.Macros
-{
- ///
- /// Encapsulates what an xslt extension object is when used for macros
- ///
- internal sealed class XsltExtension
- {
- public XsltExtension(string ns, object extensionObject)
- {
- Namespace = ns;
- ExtensionObject = extensionObject;
- }
-
- public string Namespace { get; private set; }
- public object ExtensionObject { get; private set; }
- }
-}
diff --git a/src/Umbraco.Core/Macros/XsltExtensionAttribute.cs b/src/Umbraco.Core/Macros/XsltExtensionAttribute.cs
deleted file mode 100644
index 8cde062046..0000000000
--- a/src/Umbraco.Core/Macros/XsltExtensionAttribute.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Security.Permissions;
-using System.Web;
-
-namespace Umbraco.Core.Macros
-{
- ///
- /// Allows App_Code XSLT extensions to be declared using the [XsltExtension] class attribute.
- ///
- ///
- /// An optional XML namespace can be specified using [XsltExtension("MyNamespace")].
- ///
- [AttributeUsage(AttributeTargets.Class)]
- public class XsltExtensionAttribute : Attribute
- {
- public XsltExtensionAttribute()
- {
- Namespace = String.Empty;
- }
-
- public XsltExtensionAttribute(string ns)
- {
- Namespace = ns;
- }
-
- public string Namespace { get; set; }
-
- public override string ToString()
- {
- return Namespace;
- }
- }
-}
diff --git a/src/Umbraco.Core/Macros/XsltExtensionCollection.cs b/src/Umbraco.Core/Macros/XsltExtensionCollection.cs
deleted file mode 100644
index 4d32382d06..0000000000
--- a/src/Umbraco.Core/Macros/XsltExtensionCollection.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Collections.Generic;
-using Umbraco.Core.Composing;
-
-namespace Umbraco.Core.Macros
-{
- internal class XsltExtensionCollection : BuilderCollectionBase
- {
- public XsltExtensionCollection(IEnumerable items)
- : base(items)
- { }
- }
-}
diff --git a/src/Umbraco.Core/Macros/XsltExtensionCollectionBuilder.cs b/src/Umbraco.Core/Macros/XsltExtensionCollectionBuilder.cs
deleted file mode 100644
index 45a7615e3d..0000000000
--- a/src/Umbraco.Core/Macros/XsltExtensionCollectionBuilder.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using LightInject;
-using Umbraco.Core.Composing;
-
-namespace Umbraco.Core.Macros
-{
- // that one is special since it's not initialized with XsltExtension types, but with Xslt extension object types,
- // which are then wrapped in an XsltExtension object when the collection is created. so, cannot really inherit
- // from (Lazy)CollectionBuilderBase and have to re-implement it. but almost everything is copied from CollectionBuilderBase.
-
- internal class XsltExtensionCollectionBuilder : ICollectionBuilder
- {
- private readonly IServiceContainer _container;
- private readonly List>> _producers = new List>>();
- private readonly object _locker = new object();
- private ServiceRegistration[] _registrations;
-
- public XsltExtensionCollectionBuilder(IServiceContainer container)
- {
- _container = container;
-
- // register the collection
- container.Register(_ => CreateCollection(), new PerContainerLifetime());
- }
-
- public static XsltExtensionCollectionBuilder Register(IServiceContainer container)
- {
- // register the builder - per container
- var builderLifetime = new PerContainerLifetime();
- container.Register(builderLifetime);
- return container.GetInstance();
- }
-
- public XsltExtensionCollectionBuilder AddExtensionObjectProducer(Func> producer)
- {
- lock (_locker)
- {
- if (_registrations != null)
- throw new InvalidOperationException("Cannot configure a collection builder after its types have been resolved.");
- _producers.Add(producer);
- }
- return this;
- }
-
- private void RegisterTypes()
- {
- lock (_locker)
- {
- if (_registrations != null) return;
-
- var prefix = GetType().FullName + "_";
- var i = 0;
- foreach (var type in _producers.SelectMany(x => x()).Distinct())
- {
- var name = $"{prefix}{i++:00000}";
- _container.Register(type, type, name);
- }
-
- _registrations = _container.AvailableServices
- .Where(x => x.ServiceName.StartsWith(prefix))
- .OrderBy(x => x.ServiceName)
- .ToArray();
- }
- }
-
- public XsltExtensionCollection CreateCollection()
- {
- RegisterTypes(); // will do it only once
-
- var exts = _registrations.SelectMany(r => r.ServiceType.GetCustomAttributes(true)
- .Select(a => new XsltExtension(a.Namespace.IfNullOrWhiteSpace(r.ServiceType.FullName), _container.GetInstance(r.ServiceType, r.ServiceName))));
-
- return new XsltExtensionCollection(exts);
- }
- }
-}
diff --git a/src/Umbraco.Core/Media/IImageUrlProvider.cs b/src/Umbraco.Core/Media/IImageUrlProvider.cs
deleted file mode 100644
index 4a51edd412..0000000000
--- a/src/Umbraco.Core/Media/IImageUrlProvider.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Umbraco.Core.Media
-{
- // note: because this interface is obsolete is is *not* IDiscoverable, and in case the
- // TypeLoader is asked to find types implementing this interface it will fall back
- // to a complete scan.
-
- [Obsolete("IImageUrlProvider is no longer used and will be removed in future versions")]
- public interface IImageUrlProvider // IDiscoverable
- {
- string Name { get; }
- string GetImageUrlFromMedia(int mediaId, IDictionary parameters);
- string GetImageUrlFromFileName(string specifiedSrc, IDictionary parameters);
- }
-}
diff --git a/src/Umbraco.Core/Media/IThumbnailProvider.cs b/src/Umbraco.Core/Media/IThumbnailProvider.cs
deleted file mode 100644
index 1e5a59bb39..0000000000
--- a/src/Umbraco.Core/Media/IThumbnailProvider.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-namespace Umbraco.Core.Media
-{
- // note: because this interface is obsolete is is *not* IDiscoverable, and in case the
- // TypeLoader is asked to find types implementing this interface it will fall back
- // to a complete scan.
-
- [Obsolete("Thumbnails are generated by ImageProcessor, use that instead")]
- public interface IThumbnailProvider // : IDiscoverable
- {
- bool CanProvideThumbnail(string fileUrl);
- string GetThumbnailUrl(string fileUrl);
- }
-
-}
diff --git a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs
index 4954742908..565d5be138 100644
--- a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs
+++ b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs
@@ -118,9 +118,10 @@ namespace Umbraco.Core.Migrations.Upgrade
Chain("{7F59355A-0EC9-4438-8157-EB517E6D2727}");
Chain("{66B6821A-0DE3-4DF8-A6A4-65ABD211EDDE}");
Chain("{49506BAE-CEBB-4431-A1A6-24AD6EBBBC57}");
+ Chain("{083A9894-903D-41B7-B6B3-9EAF2D4CCED0}");
// must chain to v8 final state (see at end of file)
- Chain("{76DF5CD7-A884-41A5-8DC6-7860D95B1DF5}");
+ Chain("{A7540C58-171D-462A-91C5-7A9AA5CB8BFD}");
// UPGRADE FROM 7, MORE RECENT
@@ -209,10 +210,12 @@ namespace Umbraco.Core.Migrations.Upgrade
// however, need to take care of ppl in post-AddVariationTables1 state
Add("{941B2ABA-2D06-4E04-81F5-74224F1DB037}", "{76DF5CD7-A884-41A5-8DC6-7860D95B1DF5}");
+ Chain("{A7540C58-171D-462A-91C5-7A9AA5CB8BFD}");
+
// FINAL STATE - MUST MATCH LAST ONE ABOVE !
// whenever this changes, update all references in this file!
- Add(string.Empty, "{76DF5CD7-A884-41A5-8DC6-7860D95B1DF5}");
+ Add(string.Empty, "{A7540C58-171D-462A-91C5-7A9AA5CB8BFD}");
}
}
}
diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddVariationTables1A.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddVariationTables1A.cs
index 0fce88da46..96e82d281d 100644
--- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddVariationTables1A.cs
+++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddVariationTables1A.cs
@@ -33,7 +33,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
//now we need to update the new column with some values because this column doesn't allow NULL values
Update.Table(ContentVersionCultureVariationDto.TableName).Set(new {date = DateTime.Now}).AllRows().Do();
//now apply constraints (NOT NULL) to new table
- foreach (var sql in sqls) Database.Execute(sql);
+ foreach (var sql in sqls) Execute.Sql(sql).Do();
// name, languageId are now non-nullable
AlterColumn(Constants.DatabaseSchema.Tables.ContentVersionCultureVariation, "name");
diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RefactorMacroColumns.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RefactorMacroColumns.cs
new file mode 100644
index 0000000000..623a842525
--- /dev/null
+++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RefactorMacroColumns.cs
@@ -0,0 +1,43 @@
+using Umbraco.Core.Models;
+using Umbraco.Core.Persistence.Dtos;
+
+namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
+{
+ public class RefactorMacroColumns : MigrationBase
+ {
+ public RefactorMacroColumns(IMigrationContext context)
+ : base(context)
+ { }
+
+ public override void Migrate()
+ {
+ if (ColumnExists(Constants.DatabaseSchema.Tables.Macro, "macroXSLT"))
+ {
+ //special trick to add the column without constraints and return the sql to add them later
+ AddColumn("macroType", out var sqls1);
+ //now we need to update the new column with some values because this column doesn't allow NULL values
+ Update.Table(Constants.DatabaseSchema.Tables.Macro).Set(new { macroType = (int)MacroTypes.Unknown}).AllRows().Do();
+ //now apply constraints (NOT NULL) to new table
+ foreach (var sql in sqls1) Execute.Sql(sql).Do();
+
+ //special trick to add the column without constraints and return the sql to add them later
+ AddColumn("macroSource", out var sqls2);
+
+ //populate the new macroSource column with legacy data
+ Execute.Sql($"UPDATE {Constants.DatabaseSchema.Tables.Macro} SET macroSource = macroXSLT, macroType = {(int)MacroTypes.Unknown} WHERE macroXSLT IS NOT NULL").Do();
+ Execute.Sql($"UPDATE {Constants.DatabaseSchema.Tables.Macro} SET macroSource = macroScriptAssembly, macroType = {(int)MacroTypes.Unknown} WHERE macroScriptAssembly IS NOT NULL").Do();
+ Execute.Sql($"UPDATE {Constants.DatabaseSchema.Tables.Macro} SET macroSource = macroScriptType, macroType = {(int)MacroTypes.UserControl} WHERE macroScriptType IS NOT NULL").Do();
+ Execute.Sql($"UPDATE {Constants.DatabaseSchema.Tables.Macro} SET macroSource = macroPython, macroType = {(int)MacroTypes.PartialView} WHERE macroPython IS NOT NULL").Do();
+
+ //now apply constraints (NOT NULL) to new table
+ foreach (var sql in sqls2) Execute.Sql(sql).Do();
+
+ //now remove these old columns
+ Delete.Column("macroXSLT").FromTable(Constants.DatabaseSchema.Tables.Macro).Do();
+ Delete.Column("macroScriptAssembly").FromTable(Constants.DatabaseSchema.Tables.Macro).Do();
+ Delete.Column("macroScriptType").FromTable(Constants.DatabaseSchema.Tables.Macro).Do();
+ Delete.Column("macroPython").FromTable(Constants.DatabaseSchema.Tables.Macro).Do();
+ }
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Models/File.cs b/src/Umbraco.Core/Models/File.cs
index cf202ea54f..41aff25a81 100644
--- a/src/Umbraco.Core/Models/File.cs
+++ b/src/Umbraco.Core/Models/File.cs
@@ -146,13 +146,7 @@ namespace Umbraco.Core.Models
/// Gets or sets the file's virtual path (i.e. the file path relative to the root of the website)
///
public string VirtualPath { get; set; }
-
- [Obsolete("This is no longer used and will be removed from the codebase in future versions")]
- public virtual bool IsValid()
- {
- return true;
- }
-
+
// this exists so that class that manage name and alias differently, eg Template,
// can implement their own cloning - (though really, not sure it's even needed)
protected virtual void DeepCloneNameAndAlias(File clone)
diff --git a/src/Umbraco.Core/Models/IFile.cs b/src/Umbraco.Core/Models/IFile.cs
index 9b974276c1..109d65f554 100644
--- a/src/Umbraco.Core/Models/IFile.cs
+++ b/src/Umbraco.Core/Models/IFile.cs
@@ -43,8 +43,6 @@ namespace Umbraco.Core.Models
/// Gets or sets the file's virtual path (i.e. the file path relative to the root of the website)
///
string VirtualPath { get; set; }
-
- [Obsolete("This is no longer used and will be removed from the codebase in future versions")]
- bool IsValid();
+
}
}
diff --git a/src/Umbraco.Core/Models/IMacro.cs b/src/Umbraco.Core/Models/IMacro.cs
index 1100212190..472c135e32 100644
--- a/src/Umbraco.Core/Models/IMacro.cs
+++ b/src/Umbraco.Core/Models/IMacro.cs
@@ -51,35 +51,19 @@ namespace Umbraco.Core.Models
///
[DataMember]
bool DontRender { get; set; }
-
+
///
- /// Gets or sets the path to user control or the Control Type to render
+ /// Gets or set the path to the macro source to render
///
[DataMember]
- string ControlType { get; set; }
-
+ string MacroSource { get; set; }
+
///
- /// Gets or sets the name of the assembly, which should be used by the Macro
+ /// Gets or set the macro type
///
- /// Will usually only be filled if the ScriptFile is a Usercontrol
[DataMember]
- [Obsolete("This is no longer used, we should remove it in v8, CustomControl macros are gone")]
- string ControlAssembly { get; set; }
-
- ///
- /// Gets or set the path to the Python file in use
- ///
- /// Optional: Can only be one of three Script, Python or Xslt
- [DataMember]
- string ScriptPath { get; set; }
-
- ///
- /// Gets or sets the path to the Xslt file in use
- ///
- /// Optional: Can only be one of three Script, Python or Xslt
- [DataMember]
- string XsltPath { get; set; }
-
+ MacroTypes MacroType { get; set; }
+
///
/// Gets or sets a list of Macro Properties
///
diff --git a/src/Umbraco.Core/Models/IXsltFile.cs b/src/Umbraco.Core/Models/IXsltFile.cs
deleted file mode 100644
index 028b5581c9..0000000000
--- a/src/Umbraco.Core/Models/IXsltFile.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Umbraco.Core.Models
-{
- public interface IXsltFile : IFile
- {
-
- }
-}
diff --git a/src/Umbraco.Core/Models/Macro.cs b/src/Umbraco.Core/Models/Macro.cs
index bd05abb1c1..dc411a0291 100644
--- a/src/Umbraco.Core/Models/Macro.cs
+++ b/src/Umbraco.Core/Models/Macro.cs
@@ -34,14 +34,11 @@ namespace Umbraco.Core.Models
///
///
///
- ///
- ///
- ///
///
///
///
- ///
- public Macro(int id, Guid key, bool useInEditor, int cacheDuration, string @alias, string name, string controlType, string controlAssembly, string xsltPath, bool cacheByPage, bool cacheByMember, bool dontRender, string scriptPath)
+ ///
+ public Macro(int id, Guid key, bool useInEditor, int cacheDuration, string @alias, string name, bool cacheByPage, bool cacheByMember, bool dontRender, string macroSource, MacroTypes macroType)
: this()
{
Id = id;
@@ -50,13 +47,11 @@ namespace Umbraco.Core.Models
CacheDuration = cacheDuration;
Alias = alias.ToCleanString(CleanStringType.Alias);
Name = name;
- ControlType = controlType;
- ControlAssembly = controlAssembly;
- XsltPath = xsltPath;
CacheByPage = cacheByPage;
CacheByMember = cacheByMember;
DontRender = dontRender;
- ScriptPath = scriptPath;
+ MacroSource = macroSource;
+ MacroType = macroType;
}
///
@@ -66,18 +61,13 @@ namespace Umbraco.Core.Models
///
///
///
- ///
- ///
- ///
///
///
///
- ///
+ ///
public Macro(string @alias, string name,
- string controlType = "",
- string controlAssembly = "",
- string xsltPath = "",
- string scriptPath = "",
+ string macroSource,
+ MacroTypes macroType,
bool cacheByPage = false,
bool cacheByMember = false,
bool dontRender = true,
@@ -89,13 +79,11 @@ namespace Umbraco.Core.Models
CacheDuration = cacheDuration;
Alias = alias.ToCleanString(CleanStringType.Alias);
Name = name;
- ControlType = controlType;
- ControlAssembly = controlAssembly;
- XsltPath = xsltPath;
CacheByPage = cacheByPage;
CacheByMember = cacheByMember;
DontRender = dontRender;
- ScriptPath = scriptPath;
+ MacroSource = macroSource;
+ MacroType = macroType;
}
private string _alias;
@@ -105,10 +93,8 @@ namespace Umbraco.Core.Models
private bool _cacheByPage;
private bool _cacheByMember;
private bool _dontRender;
- private string _scriptFile;
- private string _scriptAssembly;
- private string _scriptPath;
- private string _xslt;
+ private string _macroSource;
+ private MacroTypes _macroType = MacroTypes.Unknown;
private MacroPropertyCollection _properties;
private List _addedProperties;
private List _removedProperties;
@@ -124,10 +110,8 @@ namespace Umbraco.Core.Models
public readonly PropertyInfo CacheByPageSelector = ExpressionHelper.GetPropertyInfo(x => x.CacheByPage);
public readonly PropertyInfo CacheByMemberSelector = ExpressionHelper.GetPropertyInfo(x => x.CacheByMember);
public readonly PropertyInfo DontRenderSelector = ExpressionHelper.GetPropertyInfo(x => x.DontRender);
- public readonly PropertyInfo ControlPathSelector = ExpressionHelper.GetPropertyInfo(x => x.ControlType);
- public readonly PropertyInfo ControlAssemblySelector = ExpressionHelper.GetPropertyInfo(x => x.ControlAssembly);
- public readonly PropertyInfo ScriptPathSelector = ExpressionHelper.GetPropertyInfo(x => x.ScriptPath);
- public readonly PropertyInfo XsltPathSelector = ExpressionHelper.GetPropertyInfo(x => x.XsltPath);
+ public readonly PropertyInfo ScriptPathSelector = ExpressionHelper.GetPropertyInfo(x => x.MacroSource);
+ public readonly PropertyInfo MacroTypeSelector = ExpressionHelper.GetPropertyInfo(x => x.MacroType);
public readonly PropertyInfo PropertiesSelector = ExpressionHelper.GetPropertyInfo(x => x.Properties);
}
@@ -272,46 +256,23 @@ namespace Umbraco.Core.Models
}
///
- /// Gets or sets the path to user control or the Control Type to render
+ /// Gets or set the path to the Partial View to render
///
[DataMember]
- public string ControlType
+ public string MacroSource
{
- get { return _scriptFile; }
- set { SetPropertyValueAndDetectChanges(value, ref _scriptFile, Ps.Value.ControlPathSelector); }
- }
-
+ get { return _macroSource; }
+ set { SetPropertyValueAndDetectChanges(value, ref _macroSource, Ps.Value.ScriptPathSelector); }
+ }
+
///
- /// Gets or sets the name of the assembly, which should be used by the Macro
+ /// Gets or set the path to the Partial View to render
///
- /// Will usually only be filled if the ControlType is a Usercontrol
[DataMember]
- public string ControlAssembly
+ public MacroTypes MacroType
{
- get { return _scriptAssembly; }
- set { SetPropertyValueAndDetectChanges(value, ref _scriptAssembly, Ps.Value.ControlAssemblySelector); }
- }
-
- ///
- /// Gets or set the path to the Python file in use
- ///
- /// Optional: Can only be one of three Script, Python or Xslt
- [DataMember]
- public string ScriptPath
- {
- get { return _scriptPath; }
- set { SetPropertyValueAndDetectChanges(value, ref _scriptPath, Ps.Value.ScriptPathSelector); }
- }
-
- ///
- /// Gets or sets the path to the Xslt file in use
- ///
- /// Optional: Can only be one of three Script, Python or Xslt
- [DataMember]
- public string XsltPath
- {
- get { return _xslt; }
- set { SetPropertyValueAndDetectChanges(value, ref _xslt, Ps.Value.XsltPathSelector); }
+ get { return _macroType; }
+ set { SetPropertyValueAndDetectChanges(value, ref _macroType, Ps.Value.MacroTypeSelector); }
}
///
diff --git a/src/Umbraco.Core/Models/MacroTypes.cs b/src/Umbraco.Core/Models/MacroTypes.cs
index 90eacf5171..310d6ccd7c 100644
--- a/src/Umbraco.Core/Models/MacroTypes.cs
+++ b/src/Umbraco.Core/Models/MacroTypes.cs
@@ -10,15 +10,11 @@ namespace Umbraco.Core.Models
[DataContract(IsReference = true)]
public enum MacroTypes
{
- [EnumMember]
- Xslt = 1,
[EnumMember]
UserControl = 3,
[EnumMember]
Unknown = 4,
[EnumMember]
- Script = 6,
- [EnumMember]
PartialView = 7
}
}
diff --git a/src/Umbraco.Core/Models/Membership/IUser.cs b/src/Umbraco.Core/Models/Membership/IUser.cs
index 8219af17b9..f3092a0106 100644
--- a/src/Umbraco.Core/Models/Membership/IUser.cs
+++ b/src/Umbraco.Core/Models/Membership/IUser.cs
@@ -18,11 +18,7 @@ namespace Umbraco.Core.Models.Membership
int[] StartContentIds { get; set; }
int[] StartMediaIds { get; set; }
string Language { get; set; }
-
- [Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- IUserType UserType { get; set; }
-
+
DateTime? EmailConfirmedDate { get; set; }
DateTime? InvitedDate { get; set; }
@@ -37,14 +33,6 @@ namespace Umbraco.Core.Models.Membership
IEnumerable AllowedSections { get; }
- [Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void RemoveAllowedSection(string sectionAlias);
-
- [Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void AddAllowedSection(string sectionAlias);
-
///
/// Exposes the basic profile data
///
@@ -65,4 +53,4 @@ namespace Umbraco.Core.Models.Membership
///
string TourData { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Umbraco.Core/Models/Membership/IUserType.cs b/src/Umbraco.Core/Models/Membership/IUserType.cs
deleted file mode 100644
index 118d66074f..0000000000
--- a/src/Umbraco.Core/Models/Membership/IUserType.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using Umbraco.Core.Models.Entities;
-
-namespace Umbraco.Core.Models.Membership
-{
- [Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public interface IUserType : IEntity
- {
- string Alias { get; set; }
- string Name { get; set; }
- IEnumerable Permissions { get; set; }
-
- }
-}
diff --git a/src/Umbraco.Core/Models/Membership/User.cs b/src/Umbraco.Core/Models/Membership/User.cs
index 0e3ab70e0a..cc91f5ed47 100644
--- a/src/Umbraco.Core/Models/Membership/User.cs
+++ b/src/Umbraco.Core/Models/Membership/User.cs
@@ -284,162 +284,6 @@ namespace Umbraco.Core.Models.Membership
get { return _allowedSections ?? (_allowedSections = new List(_userGroups.SelectMany(x => x.AllowedSections).Distinct())); }
}
- [Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- IUserType IUser.UserType
- {
- get
- {
- //the best we can do here is to return the user's first user group as a IUserType object
- //but we should attempt to return any group that is the built in ones first
- var groups = Groups.ToArray();
- if (groups.Length == 0)
- {
- //In backwards compatibility land, a user type cannot be null! so we need to return a fake one.
- return new UserType
- {
- Alias = "temp",
- Id = int.MinValue,
- Key = Guid.Empty,
- CreateDate = default(DateTime),
- DeleteDate = null,
- Name = "Temp",
- Permissions = new List(),
- UpdateDate = default(DateTime)
- };
- }
- var builtIns = new[] { Constants.Security.AdminGroupAlias, "writer", "editor", "translator" };
- var foundBuiltIn = groups.FirstOrDefault(x => builtIns.Contains(x.Alias));
- IUserGroup realGroup;
- if (foundBuiltIn != null)
- {
- //if the group isn't IUserGroup we'll need to look it up
- realGroup = foundBuiltIn as IUserGroup ?? Current.Services.UserService.GetUserGroupById(foundBuiltIn.Id);
-
- //return a mapped version of the group
- return new UserType
- {
- Alias = realGroup.Alias,
- Id = realGroup.Id,
- Key = realGroup.Key,
- CreateDate = realGroup.CreateDate,
- DeleteDate = realGroup.DeleteDate,
- Name = realGroup.Name,
- Permissions = realGroup.Permissions,
- UpdateDate = realGroup.UpdateDate
- };
- }
-
- //otherwise return the first
- //if the group isn't IUserGroup we'll need to look it up
- realGroup = groups[0] as IUserGroup ?? Current.Services.UserService.GetUserGroupById(groups[0].Id);
- //return a mapped version of the group
- return new UserType
- {
- Alias = realGroup.Alias,
- Id = realGroup.Id,
- Key = realGroup.Key,
- CreateDate = realGroup.CreateDate,
- DeleteDate = realGroup.DeleteDate,
- Name = realGroup.Name,
- Permissions = realGroup.Permissions,
- UpdateDate = realGroup.UpdateDate
- };
- }
- set
- {
- //if old APIs are still using this lets first check if the user is part of the user group with the alias specified
- if (Groups.Any(x => x.Alias == value.Alias))
- return;
-
- //the only other option we have here is to lookup the group (and we'll need to use singletons here :( )
- var found = Current.Services.UserService.GetUserGroupByAlias(value.Alias);
- if (found == null)
- throw new InvalidOperationException("No user group was found with the alias " + value.Alias + ", this API (IUser.UserType) is obsolete, use user groups instead");
-
- //if it's found, all we can do is add it, we can't really replace them
- AddGroup(found.ToReadOnlyGroup());
- }
- }
-
- [Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void IUser.RemoveAllowedSection(string sectionAlias)
- {
- //don't do anything if they aren't allowed it already
- if (AllowedSections.Contains(sectionAlias) == false)
- return;
-
- var groups = Groups.ToArray();
- //our only option here is to check if a custom group is created for this user, if so we can remove it from that group, otherwise we'll throw
- //now we'll check if the user has a special 1:1 user group created for itself. This will occur if this method is used and also during an upgrade.
- //this comes in the alias form of userName + 'Group'
- var customUserGroup = groups.FirstOrDefault(x => x.Alias == (Username + "Group"));
- if (customUserGroup != null)
- {
- //if the group isn't IUserGroup we'll need to look it up
- var realGroup = customUserGroup as IUserGroup ?? Current.Services.UserService.GetUserGroupById(customUserGroup.Id);
- realGroup.RemoveAllowedSection(sectionAlias);
- //now we need to flag this for saving (hack!)
- GroupsToSave.Add(realGroup);
- }
- else
- {
- throw new InvalidOperationException("Cannot remove the allowed section using this obsolete API. Modify the user's groups instead");
- }
-
- }
-
- [Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void IUser.AddAllowedSection(string sectionAlias)
- {
- //don't do anything if they are allowed it already
- if (AllowedSections.Contains(sectionAlias))
- return;
-
- //This is here for backwards compat only.
- //First we'll check if the user is part of the 'admin' group. If so then we can ensure that the admin group has this section available to it.
- //otherwise, the only thing we can do is create a custom user group for this user and add this section.
- //We are checking for admin here because if the user is an admin and an allowed section is being added, then it's assumed it's to be added
- //for the whole admin group (i.e. Forms installer does this for admins)
- var groups = Groups.ToArray();
- var admin = groups.FirstOrDefault(x => x.Alias == Constants.Security.AdminGroupAlias);
- if (admin != null)
- {
- //if the group isn't IUserGroup we'll need to look it up
- var realGroup = admin as IUserGroup ?? Current.Services.UserService.GetUserGroupById(admin.Id);
- realGroup.AddAllowedSection(sectionAlias);
- //now we need to flag this for saving (hack!)
- GroupsToSave.Add(realGroup);
- }
- else
- {
- //now we'll check if the user has a special 1:1 user group created for itself. This will occur if this method is used and also during an upgrade.
- //this comes in the alias form of userName + 'Group'
- var customUserGroup = groups.FirstOrDefault(x => x.Alias == (Username + "Group"));
- if (customUserGroup != null)
- {
- //if the group isn't IUserGroup we'll need to look it up
- var realGroup = customUserGroup as IUserGroup ?? Current.Services.UserService.GetUserGroupById(customUserGroup.Id);
- realGroup.AddAllowedSection(sectionAlias);
- //now we need to flag this for saving (hack!)
- GroupsToSave.Add(realGroup);
- }
-
- //ok, so the user doesn't have a 1:1 group, we'll need to flag it for creation
- var newUserGroup = new UserGroup
- {
- Alias = Username + "Group",
- Name = "Group for " + Username
- };
- newUserGroup.AddAllowedSection(sectionAlias);
- //add this user to this new group
- AddGroup(newUserGroup);
- GroupsToSave.Add(newUserGroup);
- }
- }
-
///
/// This used purely for hacking backwards compatibility into this class for < 7.7 compat
///
diff --git a/src/Umbraco.Core/Models/Membership/UserType.cs b/src/Umbraco.Core/Models/Membership/UserType.cs
deleted file mode 100644
index d2e4a8f6cb..0000000000
--- a/src/Umbraco.Core/Models/Membership/UserType.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Reflection;
-using System.Runtime.Serialization;
-using Umbraco.Core.Models.Entities;
-using Umbraco.Core.Strings;
-
-namespace Umbraco.Core.Models.Membership
-{
- [Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Serializable]
- [DataContract(IsReference = true)]
- internal class UserType : EntityBase, IUserType
- {
- private string _alias;
- private string _name;
- private IEnumerable _permissions;
- private static readonly Lazy Ps = new Lazy();
- private class PropertySelectors
- {
- public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo(x => x.Name);
- public readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo(x => x.Alias);
- public readonly PropertyInfo PermissionsSelector = ExpressionHelper.GetPropertyInfo>(x => x.Permissions);
- }
-
- public UserType(string name, string alias)
- {
- Name = name;
- Alias = alias;
- }
-
- public UserType()
- {
- }
-
- [DataMember]
- public string Alias
- {
- get { return _alias; }
- set
- {
- SetPropertyValueAndDetectChanges(
- value.ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase),
- ref _alias,
- Ps.Value.AliasSelector);
- }
- }
-
- [DataMember]
- public string Name
- {
- get { return _name; }
- set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
- }
-
- ///
- /// The set of default permissions for the user type
- ///
- ///
- /// By default each permission is simply a single char but we've made this an enumerable{string} to support a more flexible permissions structure in the future.
- ///
- [DataMember]
- public IEnumerable Permissions
- {
- get { return _permissions; }
- set
- {
- SetPropertyValueAndDetectChanges(value, ref _permissions, Ps.Value.PermissionsSelector,
- //Custom comparer for enumerable
- new DelegateEqualityComparer>(
- (enum1, enum2) => enum1.UnsortedSequenceEqual(enum2),
- enum1 => enum1.GetHashCode()));
- }
- }
- }
-}
diff --git a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs
index 31b5f2e513..817ef3ace8 100644
--- a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs
+++ b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs
@@ -14,14 +14,6 @@ namespace Umbraco.Core.Models
///
Unknown,
- ///
- /// Content Item Type
- ///
- [UmbracoObjectType(Constants.ObjectTypes.Strings.ContentItemType)]
- [FriendlyName("Content Item Type")]
- [Obsolete("This is not used and will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- ContentItemType,
///
/// Root
@@ -69,17 +61,7 @@ namespace Umbraco.Core.Models
[FriendlyName("Member Group")]
[UmbracoUdiType(Constants.UdiEntityType.MemberGroup)]
MemberGroup,
-
- //TODO: What is a 'Content Item' supposed to be???
- ///
- /// Content Item
- ///
- [UmbracoObjectType(Constants.ObjectTypes.Strings.ContentItem)]
- [FriendlyName("Content Item")]
- [Obsolete("This is not used and will be removed in future versions")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- ContentItem,
-
+
///
/// "Media Type
///
diff --git a/src/Umbraco.Core/Models/UserExtensions.cs b/src/Umbraco.Core/Models/UserExtensions.cs
index f78de43f01..00dd3273bf 100644
--- a/src/Umbraco.Core/Models/UserExtensions.cs
+++ b/src/Umbraco.Core/Models/UserExtensions.cs
@@ -112,15 +112,6 @@ namespace Umbraco.Core.Models
}
- public static void ClearAllowedSections(this IUser user)
- {
- var allowed = user.AllowedSections.ToArray();
- foreach (var s in allowed)
- {
- user.RemoveAllowedSection(s);
- }
- }
-
///
/// Returns the culture info associated with this user, based on the language they're assigned to in the back office
///
diff --git a/src/Umbraco.Core/Models/XsltFile.cs b/src/Umbraco.Core/Models/XsltFile.cs
deleted file mode 100644
index a88cd2c127..0000000000
--- a/src/Umbraco.Core/Models/XsltFile.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Runtime.Serialization;
-
-namespace Umbraco.Core.Models
-{
- ///
- /// Represents a XSLT file
- ///
- [Serializable]
- [DataContract(IsReference = true)]
- public class XsltFile : File, IXsltFile
- {
- public XsltFile(string path)
- : this(path, (Func) null)
- { }
-
- internal XsltFile(string path, Func getFileContent)
- : base(path, getFileContent)
- { }
-
- ///
- /// Indicates whether the current entity has an identity, which in this case is a path/name.
- ///
- ///
- /// Overrides the default Entity identity check.
- ///
- public override bool HasIdentity
- {
- get { return string.IsNullOrEmpty(Path) == false; }
- }
- }
-}
diff --git a/src/Umbraco.Core/Persistence/Dtos/MacroDto.cs b/src/Umbraco.Core/Persistence/Dtos/MacroDto.cs
index 821f092b38..8558ce4a35 100644
--- a/src/Umbraco.Core/Persistence/Dtos/MacroDto.cs
+++ b/src/Umbraco.Core/Persistence/Dtos/MacroDto.cs
@@ -34,18 +34,6 @@ namespace Umbraco.Core.Persistence.Dtos
[NullSetting(NullSetting = NullSettings.Null)]
public string Name { get; set; }
- [Column("macroScriptType")]
- [NullSetting(NullSetting = NullSettings.Null)]
- public string ScriptType { get; set; }
-
- [Column("macroScriptAssembly")]
- [NullSetting(NullSetting = NullSettings.Null)]
- public string ScriptAssembly { get; set; }
-
- [Column("macroXSLT")]
- [NullSetting(NullSetting = NullSettings.Null)]
- public string Xslt { get; set; }
-
[Column("macroCacheByPage")]
[Constraint(Default = "1")]
public bool CacheByPage { get; set; }
@@ -58,10 +46,13 @@ namespace Umbraco.Core.Persistence.Dtos
[Constraint(Default = "0")]
public bool DontRender { get; set; }
- //TODO: Rename this column! - actually please revamp all of the macros! :)
- [Column("macroPython")]
- [NullSetting(NullSetting = NullSettings.Null)]
- public string MacroFilePath { get; set; }
+ [Column("macroSource")]
+ [NullSetting(NullSetting = NullSettings.NotNull)]
+ public string MacroSource { get; set; }
+
+ [Column("macroType")]
+ [NullSetting(NullSetting = NullSettings.NotNull)]
+ public int MacroType { get; set; }
[ResultColumn]
[Reference(ReferenceType.Many, ReferenceMemberName = "Macro")]
diff --git a/src/Umbraco.Core/Persistence/Dtos/StylesheetDto.cs b/src/Umbraco.Core/Persistence/Dtos/StylesheetDto.cs
deleted file mode 100644
index f340d34d16..0000000000
--- a/src/Umbraco.Core/Persistence/Dtos/StylesheetDto.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using NPoco;
-using Umbraco.Core.Persistence.DatabaseAnnotations;
-
-namespace Umbraco.Core.Persistence.Dtos
-{
- [Obsolete("This is no longer used and will be removed from Umbraco in future versions")]
- internal class StylesheetDto
- {
- [Column("nodeId")]
- [PrimaryKeyColumn(AutoIncrement = false)]
- [ForeignKey(typeof(NodeDto))]
- public int NodeId { get; set; }
-
- [Column("filename")]
- [Length(100)]
- public string Filename { get; set; }
-
- [Column("content")]
- [SpecialDbType(SpecialDbTypes.NTEXT)]
- [NullSetting(NullSetting = NullSettings.Null)]
- public string Content { get; set; }
- }
-}
diff --git a/src/Umbraco.Core/Persistence/Dtos/StylesheetPropertyDto.cs b/src/Umbraco.Core/Persistence/Dtos/StylesheetPropertyDto.cs
deleted file mode 100644
index 5ef1aed9cc..0000000000
--- a/src/Umbraco.Core/Persistence/Dtos/StylesheetPropertyDto.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using NPoco;
-using Umbraco.Core.Persistence.DatabaseAnnotations;
-
-namespace Umbraco.Core.Persistence.Dtos
-{
- [Obsolete("This is no longer used and will be removed from Umbraco in future versions")]
- internal class StylesheetPropertyDto
- {
- [Column("nodeId")]
- [PrimaryKeyColumn(AutoIncrement = false)]
- public int NodeId { get; set; }
-
- [Column("stylesheetPropertyEditor")]
- [NullSetting(NullSetting = NullSettings.Null)]
- public bool? Editor { get; set; }
-
- [Column("stylesheetPropertyAlias")]
- [NullSetting(NullSetting = NullSettings.Null)]
- [Length(50)]
- public string Alias { get; set; }
-
- [Column("stylesheetPropertyValue")]
- [NullSetting(NullSetting = NullSettings.Null)]
- [Length(400)]
- public string Value { get; set; }
- }
-}
diff --git a/src/Umbraco.Core/Persistence/Factories/MacroFactory.cs b/src/Umbraco.Core/Persistence/Factories/MacroFactory.cs
index a854a3a65f..3963c591f0 100644
--- a/src/Umbraco.Core/Persistence/Factories/MacroFactory.cs
+++ b/src/Umbraco.Core/Persistence/Factories/MacroFactory.cs
@@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Factories
{
public IMacro BuildEntity(MacroDto dto)
{
- var model = new Macro(dto.Id, dto.UniqueId, dto.UseInEditor, dto.RefreshRate, dto.Alias, dto.Name, dto.ScriptType, dto.ScriptAssembly, dto.Xslt, dto.CacheByPage, dto.CachePersonalized, dto.DontRender, dto.MacroFilePath);
+ var model = new Macro(dto.Id, dto.UniqueId, dto.UseInEditor, dto.RefreshRate, dto.Alias, dto.Name, dto.CacheByPage, dto.CachePersonalized, dto.DontRender, dto.MacroSource, (MacroTypes)dto.MacroType);
try
{
@@ -40,13 +40,11 @@ namespace Umbraco.Core.Persistence.Factories
CachePersonalized = entity.CacheByMember,
DontRender = entity.DontRender,
Name = entity.Name,
- MacroFilePath = entity.ScriptPath,
+ MacroSource = entity.MacroSource,
RefreshRate = entity.CacheDuration,
- ScriptAssembly = entity.ControlAssembly,
- ScriptType = entity.ControlType,
UseInEditor = entity.UseInEditor,
- Xslt = entity.XsltPath,
- MacroPropertyDtos = BuildPropertyDtos(entity)
+ MacroPropertyDtos = BuildPropertyDtos(entity),
+ MacroType = (int)entity.MacroType
};
if (entity.HasIdentity)
diff --git a/src/Umbraco.Core/Persistence/Mappers/MacroMapper.cs b/src/Umbraco.Core/Persistence/Mappers/MacroMapper.cs
index c60feea9b8..489bd40ddf 100644
--- a/src/Umbraco.Core/Persistence/Mappers/MacroMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/MacroMapper.cs
@@ -18,14 +18,12 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap(src => src.Alias, dto => dto.Alias);
CacheMap(src => src.CacheByPage, dto => dto.CacheByPage);
CacheMap(src => src.CacheByMember, dto => dto.CachePersonalized);
- CacheMap(src => src.ControlAssembly, dto => dto.ScriptAssembly);
- CacheMap(src => src.ControlType, dto => dto.ScriptType);
+ CacheMap(src => src.MacroType, dto => dto.MacroType);
CacheMap(src => src.DontRender, dto => dto.DontRender);
CacheMap(src => src.Name, dto => dto.Name);
CacheMap(src => src.CacheDuration, dto => dto.RefreshRate);
- CacheMap(src => src.ScriptPath, dto => dto.MacroFilePath);
+ CacheMap(src => src.MacroSource, dto => dto.MacroSource);
CacheMap(src => src.UseInEditor, dto => dto.UseInEditor);
- CacheMap(src => src.XsltPath, dto => dto.Xslt);
}
}
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/IXsltFileRepository.cs b/src/Umbraco.Core/Persistence/Repositories/IXsltFileRepository.cs
deleted file mode 100644
index 2e9e840036..0000000000
--- a/src/Umbraco.Core/Persistence/Repositories/IXsltFileRepository.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.IO;
-using Umbraco.Core.Models;
-
-namespace Umbraco.Core.Persistence.Repositories
-{
- public interface IXsltFileRepository : IReadRepository, IWriteRepository
- {
- bool ValidateXsltFile(XsltFile xsltFile);
- Stream GetFileContentStream(string filepath);
- void SetFileContent(string filepath, Stream content);
- long GetFileSize(string filepath);
- }
-}
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs
index e204a708a4..32080c4a12 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs
@@ -776,7 +776,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
}
else
{
- validExts.Add(_templateConfig.UseAspNetMasterPages ? "master" : "aspx");
+ validExts.Add("master");
}
// validate path and extension
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/XsltFileRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/XsltFileRepository.cs
deleted file mode 100644
index 75d92eabf6..0000000000
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/XsltFileRepository.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using LightInject;
-using Umbraco.Core.IO;
-using Umbraco.Core.Models;
-
-namespace Umbraco.Core.Persistence.Repositories.Implement
-{
- ///
- /// Represents the XsltFile Repository
- ///
- internal class XsltFileRepository : FileRepository, IXsltFileRepository
- {
- public XsltFileRepository([Inject("XsltFileSystem")] IFileSystem fileSystem)
- : base(fileSystem)
- { }
-
- public override XsltFile Get(string id)
- {
- var path = FileSystem.GetRelativePath(id);
-
- path = path.EnsureEndsWith(".xslt");
-
- if (FileSystem.FileExists(path) == false)
- return null;
-
- var created = FileSystem.GetCreated(path).UtcDateTime;
- var updated = FileSystem.GetLastModified(path).UtcDateTime;
-
- var xsltFile = new XsltFile(path, file => GetFileContent(file.OriginalPath))
- {
- Key = path.EncodeAsGuid(),
- CreateDate = created,
- UpdateDate = updated,
- Id = path.GetHashCode(),
- VirtualPath = FileSystem.GetUrl(path)
- };
-
- // reset dirty initial properties (U4-1946)
- xsltFile.ResetDirtyProperties(false);
-
- return xsltFile;
- }
-
- public override void Save(XsltFile entity)
- {
- base.Save(entity);
-
- // ensure that from now on, content is lazy-loaded
- if (entity.GetFileContent == null)
- entity.GetFileContent = file => GetFileContent(file.OriginalPath);
- }
-
- public override IEnumerable GetMany(params string[] ids)
- {
- ids = ids
- .Select(x => StringExtensions.EnsureEndsWith(x, ".xslt"))
- .Distinct()
- .ToArray();
-
- if (ids.Any())
- {
- foreach (var id in ids)
- {
- yield return Get(id);
- }
- }
- else
- {
- var files = FindAllFiles("", "*.xslt");
- foreach (var file in files)
- {
- yield return Get(file);
- }
- }
- }
-
- ///
- /// Gets a list of all that exist at the relative path specified.
- ///
- ///
- /// If null or not specified, will return the XSLT files at the root path relative to the IFileSystem
- ///
- ///
- public IEnumerable GetXsltFilesAtPath(string rootPath = null)
- {
- return FileSystem.GetFiles(rootPath ?? string.Empty, "*.xslt").Select(Get);
- }
-
- private static readonly List ValidExtensions = new List { "xslt" };
-
- public bool ValidateXsltFile(XsltFile xsltFile)
- {
- // get full path
- string fullPath;
- try
- {
- // may throw for security reasons
- fullPath = FileSystem.GetFullPath(xsltFile.Path);
- }
- catch
- {
- return false;
- }
-
- // validate path and extension
- var validDir = SystemDirectories.Xslt;
- var isValidPath = IOHelper.VerifyEditPath(fullPath, validDir);
- var isValidExtension = IOHelper.VerifyFileExtension(xsltFile.Path, ValidExtensions);
- return isValidPath && isValidExtension;
- }
-
- public Stream GetFileContentStream(string filepath)
- {
- if (FileSystem.FileExists(filepath) == false) return null;
-
- try
- {
- return FileSystem.OpenFile(filepath);
- }
- catch
- {
- return null; // deal with race conds
- }
- }
-
- public void SetFileContent(string filepath, Stream content)
- {
- FileSystem.AddFile(filepath, content, true);
- }
- }
-}
diff --git a/src/Umbraco.Core/Runtime/CoreRuntimeComponent.cs b/src/Umbraco.Core/Runtime/CoreRuntimeComponent.cs
index eeacba2b7c..a90d5b5b4c 100644
--- a/src/Umbraco.Core/Runtime/CoreRuntimeComponent.cs
+++ b/src/Umbraco.Core/Runtime/CoreRuntimeComponent.cs
@@ -52,7 +52,6 @@ namespace Umbraco.Core.Runtime
composition.Container.RegisterSingleton(factory => factory.GetInstance().StylesheetsFileSystem, Constants.Composing.FileSystems.StylesheetFileSystem);
composition.Container.RegisterSingleton(factory => factory.GetInstance().MasterPagesFileSystem, Constants.Composing.FileSystems.MasterpageFileSystem);
composition.Container.RegisterSingleton(factory => factory.GetInstance().MvcViewsFileSystem, Constants.Composing.FileSystems.ViewFileSystem);
- composition.Container.RegisterSingleton(factory => factory.GetInstance().XsltFileSystem, Constants.Composing.FileSystems.XsltFileSystem);
// register manifest parser, will be injected in collection builders where needed
composition.Container.RegisterSingleton();
@@ -72,12 +71,9 @@ namespace Umbraco.Core.Runtime
composition.Container.RegisterSingleton();
composition.Container.RegisterSingleton();
- // register a server registrar, by default it's the db registrar unless the dev
- // has the legacy dist calls enabled - fixme - should obsolete the legacy thing
+ // register a server registrar, by default it's the db registrar
composition.Container.RegisterSingleton(f =>
{
- if (UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled)
- return new ConfigServerRegistrar(f.GetInstance(), f.GetInstance(), f.GetInstance());
if ("true".InvariantEquals(ConfigurationManager.AppSettings["umbracoDisableElectionForSingleServer"]))
return new SingleServerRegistrar(f.GetInstance());
return new DatabaseServerRegistrar(
diff --git a/src/Umbraco.Core/RuntimeState.cs b/src/Umbraco.Core/RuntimeState.cs
index a1401e035a..53a474cef7 100644
--- a/src/Umbraco.Core/RuntimeState.cs
+++ b/src/Umbraco.Core/RuntimeState.cs
@@ -19,6 +19,8 @@ namespace Umbraco.Core
private readonly ILogger _logger;
private readonly Lazy _serverRegistrar;
private readonly Lazy _mainDom;
+ private readonly IUmbracoSettingsSection _settings;
+ private readonly IGlobalSettings _globalSettings;
private readonly HashSet _applicationUrls = new HashSet();
private RuntimeLevel _level;
@@ -28,11 +30,13 @@ namespace Umbraco.Core
/// A logger.
/// A (lazy) server registrar.
/// A (lazy) MainDom.
- public RuntimeState(ILogger logger, Lazy serverRegistrar, Lazy mainDom)
+ public RuntimeState(ILogger logger, Lazy serverRegistrar, Lazy mainDom, IUmbracoSettingsSection settings, IGlobalSettings globalSettings)
{
_logger = logger;
_serverRegistrar = serverRegistrar;
_mainDom = mainDom;
+ _settings = settings;
+ _globalSettings = globalSettings;
}
private IServerRegistrar ServerRegistrar => _serverRegistrar.Value;
@@ -103,15 +107,13 @@ namespace Umbraco.Core
///
/// Ensures that the property has a value.
///
- ///
///
- ///
- internal void EnsureApplicationUrl(IUmbracoSettingsSection settings, IGlobalSettings globalSettings, HttpRequestBase request = null)
+ internal void EnsureApplicationUrl(HttpRequestBase request = null)
{
// see U4-10626 - in some cases we want to reset the application url
// (this is a simplified version of what was in 7.x)
// note: should this be optional? is it expensive?
- var url = request == null ? null : ApplicationUrlHelper.GetApplicationUrlFromCurrentRequest(request, globalSettings);
+ var url = request == null ? null : ApplicationUrlHelper.GetApplicationUrlFromCurrentRequest(request, _globalSettings);
var change = url != null && !_applicationUrls.Contains(url);
if (change)
{
@@ -120,7 +122,7 @@ namespace Umbraco.Core
}
if (ApplicationUrl != null && !change) return;
- ApplicationUrl = new Uri(ApplicationUrlHelper.GetApplicationUrl(_logger, globalSettings, settings, request));
+ ApplicationUrl = new Uri(ApplicationUrlHelper.GetApplicationUrl(_logger, _globalSettings, _settings, ServerRegistrar, request));
}
private readonly ManualResetEventSlim _runLevel = new ManualResetEventSlim(false);
diff --git a/src/Umbraco.Core/Services/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/EntityXmlSerializer.cs
index 72838c3d55..e418c8d3e6 100644
--- a/src/Umbraco.Core/Services/EntityXmlSerializer.cs
+++ b/src/Umbraco.Core/Services/EntityXmlSerializer.cs
@@ -295,10 +295,8 @@ namespace Umbraco.Core.Services
var xml = new XElement("macro");
xml.Add(new XElement("name", macro.Name));
xml.Add(new XElement("alias", macro.Alias));
- xml.Add(new XElement("scriptType", macro.ControlType));
- xml.Add(new XElement("scriptAssembly", macro.ControlAssembly));
- xml.Add(new XElement("scriptingFile", macro.ScriptPath));
- xml.Add(new XElement("xslt", macro.XsltPath));
+ xml.Add(new XElement("macroType", macro.MacroType));
+ xml.Add(new XElement("macroSource", macro.MacroSource));
xml.Add(new XElement("useInEditor", macro.UseInEditor.ToString()));
xml.Add(new XElement("dontRender", macro.DontRender.ToString()));
xml.Add(new XElement("refreshRate", macro.CacheDuration.ToString(CultureInfo.InvariantCulture)));
diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs
index 91ac7c25ea..1f938c8e27 100644
--- a/src/Umbraco.Core/Services/IFileService.cs
+++ b/src/Umbraco.Core/Services/IFileService.cs
@@ -18,8 +18,6 @@ namespace Umbraco.Core.Services
IPartialView GetPartialView(string path);
IPartialView GetPartialViewMacro(string path);
IEnumerable GetPartialViewMacros(params string[] names);
- IXsltFile GetXsltFile(string path);
- IEnumerable GetXsltFiles(params string[] names);
Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = 0);
Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = 0);
bool DeletePartialView(string path, int userId = 0);
@@ -305,27 +303,6 @@ namespace Umbraco.Core.Services
/// The size of the script file.
long GetScriptFileSize(string filepath);
- ///
- /// Gets the content of a XSLT file as a stream.
- ///
- /// The filesystem path to the XSLT file.
- /// The content of the XSLT file.
- Stream GetXsltFileContentStream(string filepath);
-
- ///
- /// Sets the content of a XSLT file.
- ///
- /// The filesystem path to the XSLT file.
- /// The content of the XSLT file.
- void SetXsltFileContent(string filepath, Stream content);
-
- ///
- /// Gets the size of a XSLT file.
- ///
- /// The filesystem path to the XSLT file.
- /// The size of the XSLT file.
- long GetXsltFileSize(string filepath);
-
///
/// Gets the content of a macro partial view as a stream.
///
diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs
index 8c1fa53880..09bd096f8e 100644
--- a/src/Umbraco.Core/Services/Implement/FileService.cs
+++ b/src/Umbraco.Core/Services/Implement/FileService.cs
@@ -24,7 +24,6 @@ namespace Umbraco.Core.Services.Implement
private readonly ITemplateRepository _templateRepository;
private readonly IPartialViewRepository _partialViewRepository;
private readonly IPartialViewMacroRepository _partialViewMacroRepository;
- private readonly IXsltFileRepository _xsltRepository;
private readonly IAuditRepository _auditRepository;
private const string PartialViewHeader = "@inherits Umbraco.Web.Mvc.UmbracoViewPage";
@@ -33,7 +32,7 @@ namespace Umbraco.Core.Services.Implement
public FileService(IScopeProvider uowProvider, ILogger logger, IEventMessagesFactory eventMessagesFactory,
IStylesheetRepository stylesheetRepository, IScriptRepository scriptRepository, ITemplateRepository templateRepository,
IPartialViewRepository partialViewRepository, IPartialViewMacroRepository partialViewMacroRepository,
- IXsltFileRepository xsltRepository, IAuditRepository auditRepository)
+ IAuditRepository auditRepository)
: base(uowProvider, logger, eventMessagesFactory)
{
_stylesheetRepository = stylesheetRepository;
@@ -41,7 +40,6 @@ namespace Umbraco.Core.Services.Implement
_templateRepository = templateRepository;
_partialViewRepository = partialViewRepository;
_partialViewMacroRepository = partialViewMacroRepository;
- _xsltRepository = xsltRepository;
_auditRepository = auditRepository;
}
@@ -724,22 +722,6 @@ namespace Umbraco.Core.Services.Implement
}
}
- public IXsltFile GetXsltFile(string path)
- {
- using (var scope = ScopeProvider.CreateScope(autoComplete: true))
- {
- return _xsltRepository.Get(path);
- }
- }
-
- public IEnumerable GetXsltFiles(params string[] names)
- {
- using (var scope = ScopeProvider.CreateScope(autoComplete: true))
- {
- return _xsltRepository.GetMany(names).OrderBy(x => x.Name);
- }
- }
-
public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = 0)
{
return CreatePartialViewMacro(partialView, PartialViewType.PartialView, snippetName, userId);
@@ -1051,36 +1033,7 @@ namespace Umbraco.Core.Services.Implement
}
#endregion
-
- #region Xslt
-
- public Stream GetXsltFileContentStream(string filepath)
- {
- using (var scope = ScopeProvider.CreateScope(autoComplete: true))
- {
- return _xsltRepository.GetFileContentStream(filepath);
- }
- }
-
- public void SetXsltFileContent(string filepath, Stream content)
- {
- using (var scope = ScopeProvider.CreateScope())
- {
- _xsltRepository.SetFileContent(filepath, content);
- scope.Complete();
- }
- }
-
- public long GetXsltFileSize(string filepath)
- {
- using (var scope = ScopeProvider.CreateScope(autoComplete: true))
- {
- return _xsltRepository.GetFileSize(filepath);
- }
- }
-
- #endregion
-
+
private void Audit(AuditType type, string message, int userId, int objectId)
{
_auditRepository.Save(new AuditItem(objectId, message, type, userId));
diff --git a/src/Umbraco.Core/Services/Implement/MacroService.cs b/src/Umbraco.Core/Services/Implement/MacroService.cs
index a28bb7ca50..fdcc8e2ee0 100644
--- a/src/Umbraco.Core/Services/Implement/MacroService.cs
+++ b/src/Umbraco.Core/Services/Implement/MacroService.cs
@@ -25,24 +25,6 @@ namespace Umbraco.Core.Services.Implement
_auditRepository = auditRepository;
}
- ///
- /// Returns an enum based on the properties on the Macro
- ///
- ///
- internal static MacroTypes GetMacroType(IMacro macro)
- {
- if (string.IsNullOrEmpty(macro.XsltPath) == false)
- return MacroTypes.Xslt;
-
- if (string.IsNullOrEmpty(macro.ScriptPath) == false)
- return MacroTypes.PartialView;
-
- if (string.IsNullOrEmpty(macro.ControlType) == false && macro.ControlType.InvariantContains(".ascx"))
- return MacroTypes.UserControl;
-
- return MacroTypes.Unknown;
- }
-
///
/// Gets an object by its alias
///
diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs
index b6ddc400d8..1e585053da 100644
--- a/src/Umbraco.Core/Services/Implement/PackagingService.cs
+++ b/src/Umbraco.Core/Services/Implement/PackagingService.cs
@@ -1270,10 +1270,8 @@ namespace Umbraco.Core.Services.Implement
{
var macroName = macroElement.Element("name").Value;
var macroAlias = macroElement.Element("alias").Value;
- var controlType = macroElement.Element("scriptType").Value;
- var controlAssembly = macroElement.Element("scriptAssembly").Value;
- var xsltPath = macroElement.Element("xslt").Value;
- var scriptPath = macroElement.Element("scriptingFile").Value;
+ var macroType = Enum.Parse(macroElement.Element("macroType").Value);
+ var macroSource = macroElement.Element("macroSource").Value;
//Following xml elements are treated as nullable properties
var useInEditorElement = macroElement.Element("useInEditor");
@@ -1308,7 +1306,7 @@ namespace Umbraco.Core.Services.Implement
}
var existingMacro = _macroService.GetByAlias(macroAlias) as Macro;
- var macro = existingMacro ?? new Macro(macroAlias, macroName, controlType, controlAssembly, xsltPath, scriptPath,
+ var macro = existingMacro ?? new Macro(macroAlias, macroName, macroSource, macroType,
cacheByPage, cacheByMember, dontRender, useInEditor, cacheDuration);
var properties = macroElement.Element("properties");
@@ -1450,13 +1448,11 @@ namespace Umbraco.Core.Services.Implement
///
public string FetchPackageFile(Guid packageId, Version umbracoVersion, int userId)
{
- var packageRepo = UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault();
-
using (var httpClient = new HttpClient())
using (var scope = _scopeProvider.CreateScope())
{
//includeHidden = true because we don't care if it's hidden we want to get the file regardless
- var url = $"{packageRepo.RestApiUrl}/{packageId}?version={umbracoVersion.ToString(3)}&includeHidden=true&asFile=true";
+ var url = $"{Constants.PackageRepository.RestApiBaseUrl}/{packageId}?version={umbracoVersion.ToString(3)}&includeHidden=true&asFile=true";
byte[] bytes;
try
{
@@ -1485,7 +1481,7 @@ namespace Umbraco.Core.Services.Implement
}
}
- Audit(AuditType.PackagerInstall, $"Package {packageId} fetched from {packageRepo.Id}", userId, -1);
+ Audit(AuditType.PackagerInstall, $"Package {packageId} fetched from {Constants.PackageRepository.DefaultRepositoryId}", userId, -1);
return null;
}
}
diff --git a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs
index 691a325eaa..4628271625 100644
--- a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs
+++ b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs
@@ -29,9 +29,9 @@ namespace Umbraco.Core.Sync
// FIXME need another way to do it, eg an interface, injected!
public static Func ApplicationUrlProvider { get; set; }
- internal static string GetApplicationUrl(ILogger logger, IGlobalSettings globalSettings, IUmbracoSettingsSection settings, HttpRequestBase request = null)
+ internal static string GetApplicationUrl(ILogger logger, IGlobalSettings globalSettings, IUmbracoSettingsSection settings, IServerRegistrar serverRegistrar, HttpRequestBase request = null)
{
- var umbracoApplicationUrl = TryGetApplicationUrl(settings, logger, globalSettings);
+ var umbracoApplicationUrl = TryGetApplicationUrl(settings, logger, globalSettings, serverRegistrar);
if (umbracoApplicationUrl != null)
return umbracoApplicationUrl;
@@ -50,7 +50,7 @@ namespace Umbraco.Core.Sync
return umbracoApplicationUrl;
}
- internal static string TryGetApplicationUrl(IUmbracoSettingsSection settings, ILogger logger, IGlobalSettings globalSettings)
+ internal static string TryGetApplicationUrl(IUmbracoSettingsSection settings, ILogger logger, IGlobalSettings globalSettings, IServerRegistrar serverRegistrar)
{
// try umbracoSettings:settings/web.routing/@umbracoApplicationUrl
// which is assumed to:
@@ -88,7 +88,7 @@ namespace Umbraco.Core.Sync
// - contain a scheme
// - end or not with a slash, it will be taken care of
// eg "http://www.mysite.com/umbraco"
- url = Current.ServerRegistrar.GetCurrentServerUmbracoApplicationUrl();
+ url = serverRegistrar.GetCurrentServerUmbracoApplicationUrl();
if (url.IsNullOrWhiteSpace() == false)
{
var umbracoApplicationUrl = url.TrimEnd('/');
diff --git a/src/Umbraco.Core/Sync/BatchedWebServiceServerMessenger.cs b/src/Umbraco.Core/Sync/BatchedWebServiceServerMessenger.cs
deleted file mode 100644
index a0357111d1..0000000000
--- a/src/Umbraco.Core/Sync/BatchedWebServiceServerMessenger.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Umbraco.Core.Cache;
-
-namespace Umbraco.Core.Sync
-{
- ///
- /// An that works by messaging servers via web services.
- ///
- ///
- /// Abstract because it needs to be inherited by a class that will
- /// - implement ProcessBatch()
- /// - trigger FlushBatch() when appropriate
- ///
- internal abstract class BatchedWebServiceServerMessenger : WebServiceServerMessenger
- {
- internal BatchedWebServiceServerMessenger()
- {
- }
-
- internal BatchedWebServiceServerMessenger(string login, string password)
- : base(login, password)
- {
- }
-
- internal BatchedWebServiceServerMessenger(string login, string password, bool useDistributedCalls)
- : base(login, password, useDistributedCalls)
- {
- }
-
- protected BatchedWebServiceServerMessenger(Func> getLoginAndPassword)
- : base(getLoginAndPassword)
- {
- }
-
- protected abstract ICollection GetBatch(bool ensureHttpContext);
-
- protected void FlushBatch()
- {
- var batch = GetBatch(false);
- if (batch == null) return;
-
- var batcha = batch.ToArray();
- batch.Clear();
- if (batcha.Length == 0) return;
-
- ProcessBatch(batcha);
- }
-
- // needs to be overriden to actually do something
- protected abstract void ProcessBatch(RefreshInstructionEnvelope[] batch);
-
- protected override void DeliverRemote(IEnumerable servers, ICacheRefresher refresher, MessageType messageType, IEnumerable
public sealed class RefreshInstructionEnvelope
{
- public RefreshInstructionEnvelope(IEnumerable servers, ICacheRefresher refresher, IEnumerable instructions)
+ public RefreshInstructionEnvelope(ICacheRefresher refresher, IEnumerable instructions)
{
- Servers = servers;
Refresher = refresher;
Instructions = instructions;
}
- public IEnumerable Servers { get; set; }
public ICacheRefresher Refresher { get; set; }
public IEnumerable Instructions { get; set; }
}
diff --git a/src/Umbraco.Core/Sync/ServerMessengerBase.cs b/src/Umbraco.Core/Sync/ServerMessengerBase.cs
index d16c88eca3..68223a40e6 100644
--- a/src/Umbraco.Core/Sync/ServerMessengerBase.cs
+++ b/src/Umbraco.Core/Sync/ServerMessengerBase.cs
@@ -27,9 +27,9 @@ namespace Umbraco.Core.Sync
/// The cache refresher.
/// The message type.
/// true if distributed calls are required; otherwise, false, all we have is the local server.
- protected virtual bool RequiresDistributed(IEnumerable servers, ICacheRefresher refresher, MessageType messageType)
+ protected virtual bool RequiresDistributed(ICacheRefresher refresher, MessageType messageType)
{
- return DistributedEnabled && servers.Any();
+ return DistributedEnabled;
}
// ensures that all items in the enumerable are of the same type, either int or Guid.
@@ -56,98 +56,97 @@ namespace Umbraco.Core.Sync
#region IServerMessenger
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, TPayload[] payload)
+ public void PerformRefresh(ICacheRefresher refresher, TPayload[] payload)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
if (payload == null) throw new ArgumentNullException(nameof(payload));
- Deliver(servers, refresher, payload);
+ Deliver(refresher, payload);
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, string jsonPayload)
+ public void PerformRefresh(ICacheRefresher refresher, string jsonPayload)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
if (jsonPayload == null) throw new ArgumentNullException(nameof(jsonPayload));
- Deliver(servers, refresher, MessageType.RefreshByJson, json: jsonPayload);
+ Deliver(refresher, MessageType.RefreshByJson, json: jsonPayload);
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, Func getNumericId, params T[] instances)
+ public void PerformRefresh(ICacheRefresher refresher, Func getNumericId, params T[] instances)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
if (getNumericId == null) throw new ArgumentNullException(nameof(getNumericId));
if (instances == null || instances.Length == 0) return;
Func getId = x => getNumericId(x);
- Deliver(servers, refresher, MessageType.RefreshByInstance, getId, instances);
+ Deliver(refresher, MessageType.RefreshByInstance, getId, instances);
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, Func getGuidId, params T[] instances)
+ public void PerformRefresh(ICacheRefresher refresher, Func getGuidId, params T[] instances)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
if (getGuidId == null) throw new ArgumentNullException(nameof(getGuidId));
if (instances == null || instances.Length == 0) return;
Func getId = x => getGuidId(x);
- Deliver(servers, refresher, MessageType.RefreshByInstance, getId, instances);
+ Deliver(refresher, MessageType.RefreshByInstance, getId, instances);
}
- public void PerformRemove(IEnumerable servers, ICacheRefresher refresher, Func getNumericId, params T[] instances)
+ public void PerformRemove(ICacheRefresher refresher, Func getNumericId, params T[] instances)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
if (getNumericId == null) throw new ArgumentNullException(nameof(getNumericId));
if (instances == null || instances.Length == 0) return;
Func getId = x => getNumericId(x);
- Deliver(servers, refresher, MessageType.RemoveByInstance, getId, instances);
+ Deliver(refresher, MessageType.RemoveByInstance, getId, instances);
}
- public void PerformRemove(IEnumerable servers, ICacheRefresher refresher, params int[] numericIds)
+ public void PerformRemove(ICacheRefresher refresher, params int[] numericIds)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
if (numericIds == null || numericIds.Length == 0) return;
- Deliver(servers, refresher, MessageType.RemoveById, numericIds.Cast());
+ Deliver(refresher, MessageType.RemoveById, numericIds.Cast());
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, params int[] numericIds)
+ public void PerformRefresh(ICacheRefresher refresher, params int[] numericIds)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
if (numericIds == null || numericIds.Length == 0) return;
- Deliver(servers, refresher, MessageType.RefreshById, numericIds.Cast());
+ Deliver(refresher, MessageType.RefreshById, numericIds.Cast());
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, params Guid[] guidIds)
+ public void PerformRefresh(ICacheRefresher refresher, params Guid[] guidIds)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
if (guidIds == null || guidIds.Length == 0) return;
- Deliver(servers, refresher, MessageType.RefreshById, guidIds.Cast());
+ Deliver(refresher, MessageType.RefreshById, guidIds.Cast());
}
- public void PerformRefreshAll(IEnumerable servers, ICacheRefresher refresher)
+ public void PerformRefreshAll(ICacheRefresher refresher)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
- Deliver(servers, refresher, MessageType.RefreshAll);
+ Deliver(refresher, MessageType.RefreshAll);
}
- //public void PerformNotify(IEnumerable servers, ICacheRefresher refresher, object payload)
+ //public void PerformNotify(ICacheRefresher refresher, object payload)
//{
// if (servers == null) throw new ArgumentNullException("servers");
// if (refresher == null) throw new ArgumentNullException("refresher");
- // Deliver(servers, refresher, payload);
+ // Deliver(refresher, payload);
//}
#endregion
@@ -283,61 +282,57 @@ namespace Umbraco.Core.Sync
// refresher.Notify(payload);
//}
- protected abstract void DeliverRemote(IEnumerable servers, ICacheRefresher refresher, MessageType messageType, IEnumerable ids = null, string json = null);
+ protected abstract void DeliverRemote(ICacheRefresher refresher, MessageType messageType, IEnumerable ids = null, string json = null);
- //protected abstract void DeliverRemote(IEnumerable servers, ICacheRefresher refresher, object payload);
+ //protected abstract void DeliverRemote(ICacheRefresher refresher, object payload);
- protected virtual void Deliver(IEnumerable servers, ICacheRefresher refresher, TPayload[] payload)
+ protected virtual void Deliver(ICacheRefresher refresher, TPayload[] payload)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
- var serversA = servers.ToArray();
-
// deliver local
DeliverLocal(refresher, payload);
// distribute?
- if (RequiresDistributed(serversA, refresher, MessageType.RefreshByJson) == false)
+ if (RequiresDistributed(refresher, MessageType.RefreshByJson) == false)
return;
// deliver remote
var json = JsonConvert.SerializeObject(payload);
- DeliverRemote(serversA, refresher, MessageType.RefreshByJson, null, json);
+ DeliverRemote(refresher, MessageType.RefreshByJson, null, json);
}
- protected virtual void Deliver(IEnumerable servers, ICacheRefresher refresher, MessageType messageType, IEnumerable ids = null, string json = null)
+ protected virtual void Deliver(ICacheRefresher refresher, MessageType messageType, IEnumerable ids = null, string json = null)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
- var serversA = servers.ToArray();
var idsA = ids?.ToArray();
// deliver local
DeliverLocal(refresher, messageType, idsA, json);
// distribute?
- if (RequiresDistributed(serversA, refresher, messageType) == false)
+ if (RequiresDistributed(refresher, messageType) == false)
return;
// deliver remote
- DeliverRemote(serversA, refresher, messageType, idsA, json);
+ DeliverRemote(refresher, messageType, idsA, json);
}
- protected virtual void Deliver(IEnumerable servers, ICacheRefresher refresher, MessageType messageType, Func getId, IEnumerable instances)
+ protected virtual void Deliver(ICacheRefresher refresher, MessageType messageType, Func getId, IEnumerable instances)
{
- if (servers == null) throw new ArgumentNullException(nameof(servers));
+
if (refresher == null) throw new ArgumentNullException(nameof(refresher));
- var serversA = servers.ToArray();
var instancesA = instances.ToArray();
// deliver local
DeliverLocal(refresher, messageType, getId, instancesA);
// distribute?
- if (RequiresDistributed(serversA, refresher, messageType) == false)
+ if (RequiresDistributed(refresher, messageType) == false)
return;
// deliver remote
@@ -349,10 +344,10 @@ namespace Umbraco.Core.Sync
// convert instances to identifiers
var idsA = instancesA.Select(getId).ToArray();
- DeliverRemote(serversA, refresher, messageType, idsA);
+ DeliverRemote(refresher, messageType, idsA);
}
- //protected virtual void Deliver(IEnumerable servers, ICacheRefresher refresher, object payload)
+ //protected virtual void Deliver(ICacheRefresher refresher, object payload)
//{
// if (servers == null) throw new ArgumentNullException("servers");
// if (refresher == null) throw new ArgumentNullException("refresher");
diff --git a/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs b/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs
deleted file mode 100644
index dff839fe6f..0000000000
--- a/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs
+++ /dev/null
@@ -1,383 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Net;
-using System.Threading;
-using Newtonsoft.Json;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
-
-namespace Umbraco.Core.Sync
-{
- ///
- /// An that works by messaging servers via web services.
- ///
- ///
- /// this messenger sends ALL instructions to ALL servers, including the local server.
- /// the CacheRefresher web service will run ALL instructions, so there may be duplicated,
- /// except for "bulk" refresh, where it excludes those coming from the local server
- ///
- //
- // TODO see Message() method: stop sending to local server!
- // just need to figure out WebServerUtility permissions issues, if any
- //
- internal class WebServiceServerMessenger : ServerMessengerBase
- {
- private readonly Func> _getLoginAndPassword;
- private volatile bool _hasLoginAndPassword;
- private readonly object _locker = new object();
-
- protected string Login { get; private set; }
- protected string Password{ get; private set; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Distribution is disabled.
- internal WebServiceServerMessenger()
- : base(false)
- { }
-
- ///
- /// Initializes a new instance of the class with a login and a password.
- ///
- /// The login.
- /// The password.
- /// Distribution will be enabled based on the umbraco config setting.
- internal WebServiceServerMessenger(string login, string password)
- : this(login, password, UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled)
- {
- }
-
- ///
- /// Initializes a new instance of the class with a login and a password
- /// and a value indicating whether distribution is enabled.
- ///
- /// The login.
- /// The password.
- /// A value indicating whether distribution is enabled.
- internal WebServiceServerMessenger(string login, string password, bool distributedEnabled)
- : base(distributedEnabled)
- {
- if (login == null) throw new ArgumentNullException("login");
- if (password == null) throw new ArgumentNullException("password");
-
- Login = login;
- Password = password;
- }
-
- ///
- /// Initializes a new instance of the with a function providing
- /// a login and a password.
- ///
- /// A function providing a login and a password.
- /// Distribution will be enabled based on the umbraco config setting.
- public WebServiceServerMessenger(Func> getLoginAndPassword)
- : base(false) // value will be overriden by EnsureUserAndPassword
- {
- _getLoginAndPassword = getLoginAndPassword;
- }
-
- // lazy-get the login, password, and distributed setting
- protected void EnsureLoginAndPassword()
- {
- if (_hasLoginAndPassword || _getLoginAndPassword == null) return;
-
- lock (_locker)
- {
- if (_hasLoginAndPassword) return;
- _hasLoginAndPassword = true;
-
- try
- {
- var result = _getLoginAndPassword();
- if (result == null)
- {
- Login = null;
- Password = null;
- DistributedEnabled = false;
- }
- else
- {
- Login = result.Item1;
- Password = result.Item2;
- DistributedEnabled = UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled;
- }
- }
- catch (Exception ex)
- {
- Current.Logger.Error("Could not resolve username/password delegate, server distribution will be disabled", ex);
- Login = null;
- Password = null;
- DistributedEnabled = false;
- }
- }
- }
-
- // this exists only for legacy reasons - we should just pass the server identity un-hashed
- public static string GetCurrentServerHash()
- {
- if (SystemUtilities.GetCurrentTrustLevel() != System.Web.AspNetHostingPermissionLevel.Unrestricted)
- throw new NotSupportedException("FullTrust ASP.NET permission level is required.");
- return GetServerHash(NetworkHelper.MachineName, System.Web.HttpRuntime.AppDomainAppId);
- }
-
- public static string GetServerHash(string machineName, string appDomainAppId)
- {
- using (var generator = new HashGenerator())
- {
- generator.AddString(machineName);
- generator.AddString(appDomainAppId);
- return generator.GenerateHash();
- }
- }
-
- protected override bool RequiresDistributed(IEnumerable servers, ICacheRefresher refresher, MessageType messageType)
- {
- EnsureLoginAndPassword();
- return base.RequiresDistributed(servers, refresher, messageType);
- }
-
- protected override void DeliverRemote(IEnumerable servers, ICacheRefresher refresher, MessageType messageType, IEnumerable ids = null, string json = null)
- {
- var idsA = ids == null ? null : ids.ToArray();
-
- Type arrayType;
- if (GetArrayType(idsA, out arrayType) == false)
- throw new ArgumentException("All items must be of the same type, either int or Guid.", "ids");
-
- Message(servers, refresher, messageType, idsA, arrayType, json);
- }
-
- protected virtual void Message(
- IEnumerable servers,
- ICacheRefresher refresher,
- MessageType messageType,
- IEnumerable ids = null,
- Type idArrayType = null,
- string jsonPayload = null)
- {
- Current.Logger.Debug(() =>
- $"Performing distributed call for {refresher.GetType()}/{messageType} on servers ({string.Join(";", servers.Select(x => x.ToString()))}), ids: {(ids == null ? "" : string.Join(";", ids.Select(x => x.ToString())))}, json: {(jsonPayload ?? "")}");
-
- try
- {
- // NOTE: we are messaging ALL servers including the local server
- // at the moment, the web service,
- // for bulk (batched) checks the origin and does NOT process the instructions again
- // for anything else, processes the instructions again (but we don't use this anymore, batched is the default)
- // TODO: see WebServerHelper, could remove local server from the list of servers
-
- // the default server messenger uses http requests
- using (var client = new ServerSyncWebServiceClient())
- {
- var asyncResults = new List();
-
- LogStartDispatch();
-
- // go through each configured node submitting a request asynchronously
- // NOTE: 'asynchronously' in this case does not mean that it will continue while we give the page back to the user!
- foreach (var n in servers)
- {
- // set the server address
- client.Url = n.ServerAddress;
-
- // add the returned WaitHandle to the list for later checking
- switch (messageType)
- {
- case MessageType.RefreshByJson:
- asyncResults.Add(client.BeginRefreshByJson(refresher.RefresherUniqueId, jsonPayload, Login, Password, null, null));
- break;
-
- case MessageType.RefreshAll:
- asyncResults.Add(client.BeginRefreshAll(refresher.RefresherUniqueId, Login, Password, null, null));
- break;
-
- case MessageType.RefreshById:
- if (idArrayType == null)
- throw new InvalidOperationException("Cannot refresh by id if the idArrayType is null.");
-
- if (idArrayType == typeof(int))
- {
- // bulk of ints is supported
- var json = JsonConvert.SerializeObject(ids.Cast().ToArray());
- var result = client.BeginRefreshByIds(refresher.RefresherUniqueId, json, Login, Password, null, null);
- asyncResults.Add(result);
- }
- else // must be guids
- {
- // bulk of guids is not supported, iterate
- asyncResults.AddRange(ids.Select(i =>
- client.BeginRefreshByGuid(refresher.RefresherUniqueId, (Guid)i, Login, Password, null, null)));
- }
-
- break;
- case MessageType.RemoveById:
- if (idArrayType == null)
- throw new InvalidOperationException("Cannot remove by id if the idArrayType is null.");
-
- // must be ints
- asyncResults.AddRange(ids.Select(i =>
- client.BeginRemoveById(refresher.RefresherUniqueId, (int)i, Login, Password, null, null)));
- break;
- }
- }
-
- // wait for all requests to complete
- var waitHandles = asyncResults.Select(x => x.AsyncWaitHandle);
- WaitHandle.WaitAll(waitHandles.ToArray());
-
- // handle results
- var errorCount = 0;
- foreach (var asyncResult in asyncResults)
- {
- try
- {
- switch (messageType)
- {
- case MessageType.RefreshByJson:
- client.EndRefreshByJson(asyncResult);
- break;
-
- case MessageType.RefreshAll:
- client.EndRefreshAll(asyncResult);
- break;
-
- case MessageType.RefreshById:
- if (idArrayType == typeof(int))
- client.EndRefreshById(asyncResult);
- else
- client.EndRefreshByGuid(asyncResult);
- break;
-
- case MessageType.RemoveById:
- client.EndRemoveById(asyncResult);
- break;
- }
- }
- catch (WebException ex)
- {
- LogDispatchNodeError(ex);
- errorCount++;
- }
- catch (Exception ex)
- {
- LogDispatchNodeError(ex);
- errorCount++;
- }
- }
-
- LogDispatchBatchResult(errorCount);
- }
- }
- catch (Exception ee)
- {
- LogDispatchBatchError(ee);
- }
- }
-
- protected virtual void Message(IEnumerable envelopes)
- {
- var envelopesA = envelopes.ToArray();
- var servers = envelopesA.SelectMany(x => x.Servers).Distinct();
-
- try
- {
- // NOTE: we are messaging ALL servers including the local server
- // at the moment, the web service,
- // for bulk (batched) checks the origin and does NOT process the instructions again
- // for anything else, processes the instructions again (but we don't use this anymore, batched is the default)
- // TODO: see WebServerHelper, could remove local server from the list of servers
-
- using (var client = new ServerSyncWebServiceClient())
- {
- var asyncResults = new List();
-
- LogStartDispatch();
-
- // go through each configured node submitting a request asynchronously
- // NOTE: 'asynchronously' in this case does not mean that it will continue while we give the page back to the user!
- foreach (var server in servers)
- {
- // set the server address
- client.Url = server.ServerAddress;
-
- var serverInstructions = envelopesA
- .Where(x => x.Servers.Contains(server))
- .SelectMany(x => x.Instructions)
- .Distinct() // only execute distinct instructions - no sense in running the same one.
- .ToArray();
-
- asyncResults.Add(
- client.BeginBulkRefresh(
- serverInstructions,
- GetCurrentServerHash(),
- Login, Password, null, null));
- }
-
- // wait for all requests to complete
- var waitHandles = asyncResults.Select(x => x.AsyncWaitHandle).ToArray();
- WaitHandle.WaitAll(waitHandles.ToArray());
-
- // handle results
- var errorCount = 0;
- foreach (var asyncResult in asyncResults)
- {
- try
- {
- client.EndBulkRefresh(asyncResult);
- }
- catch (WebException ex)
- {
- LogDispatchNodeError(ex);
- errorCount++;
- }
- catch (Exception ex)
- {
- LogDispatchNodeError(ex);
- errorCount++;
- }
- }
- LogDispatchBatchResult(errorCount);
- }
- }
- catch (Exception ee)
- {
- LogDispatchBatchError(ee);
- }
- }
-
- #region Logging
-
- private static void LogDispatchBatchError(Exception ee)
- {
- Current.Logger.Error("Error refreshing distributed list", ee);
- }
-
- private static void LogDispatchBatchResult(int errorCount)
- {
- Current.Logger.Debug(string.Format("Distributed server push completed with {0} nodes reporting an error", errorCount == 0 ? "no" : errorCount.ToString(CultureInfo.InvariantCulture)));
- }
-
- private static void LogDispatchNodeError(Exception ex)
- {
- Current.Logger.Error("Error refreshing a node in the distributed list", ex);
- }
-
- private static void LogDispatchNodeError(WebException ex)
- {
- string url = (ex.Response != null) ? ex.Response.ResponseUri.ToString() : "invalid url (responseUri null)";
- Current.Logger.Error("Error refreshing a node in the distributed list, URI attempted: " + url, ex);
- }
-
- private static void LogStartDispatch()
- {
- Current.Logger.Info("Submitting calls to distributed servers");
- }
-
- #endregion
- }
-}
diff --git a/src/Umbraco.Core/UdiEntityType.cs b/src/Umbraco.Core/UdiEntityType.cs
index 34bd26b537..07bde1ba93 100644
--- a/src/Umbraco.Core/UdiEntityType.cs
+++ b/src/Umbraco.Core/UdiEntityType.cs
@@ -54,8 +54,7 @@ namespace Umbraco.Core
{ Script, UdiType.StringUdi},
{ PartialView, UdiType.StringUdi},
{ PartialViewMacro, UdiType.StringUdi},
- { Stylesheet, UdiType.StringUdi},
- { Xslt, UdiType.StringUdi},
+ { Stylesheet, UdiType.StringUdi}
};
}
@@ -108,7 +107,6 @@ namespace Umbraco.Core
public const string Stylesheet = "stylesheet";
public const string PartialView = "partial-view";
public const string PartialViewMacro = "partial-view-macro";
- public const string Xslt = "xslt";
public static string FromUmbracoObjectType(UmbracoObjectTypes umbracoObjectType)
{
diff --git a/src/Umbraco.Core/UdiGetterExtensions.cs b/src/Umbraco.Core/UdiGetterExtensions.cs
index 3ba5fe6f65..5a5ccf5574 100644
--- a/src/Umbraco.Core/UdiGetterExtensions.cs
+++ b/src/Umbraco.Core/UdiGetterExtensions.cs
@@ -206,18 +206,7 @@ namespace Umbraco.Core
return new StringUdi(entityType, entity.Path.TrimStart('/')).EnsureClosed();
}
-
- ///
- /// Gets the entity identifier of the entity.
- ///
- /// The entity.
- /// The entity identifier of the entity.
- public static StringUdi GetUdi(this IXsltFile entity)
- {
- if (entity == null) throw new ArgumentNullException("entity");
- return new StringUdi(Constants.UdiEntityType.Xslt, entity.Path.TrimStart('/')).EnsureClosed();
- }
-
+
///
/// Gets the entity identifier of the entity.
///
@@ -317,9 +306,6 @@ namespace Umbraco.Core
var partialView = entity as IPartialView;
if (partialView != null) return partialView.GetUdi();
- var xsltFile = entity as IXsltFile;
- if (xsltFile != null) return xsltFile.GetUdi();
-
var contentBase = entity as IContentBase;
if (contentBase != null) return contentBase.GetUdi();
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index d0d633211c..d02efea6fd 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -250,32 +250,24 @@
-
-
-
-
-
-
-
-
@@ -284,17 +276,11 @@
-
-
-
-
-
-
@@ -312,6 +298,7 @@
+
@@ -342,6 +329,7 @@
+
@@ -563,7 +551,6 @@
-
@@ -573,10 +560,6 @@
-
-
-
-
@@ -614,9 +597,7 @@
-
-
@@ -701,7 +682,6 @@
-
@@ -721,7 +701,6 @@
-
@@ -733,7 +712,6 @@
-
@@ -821,8 +799,6 @@
-
-
@@ -859,7 +835,6 @@
-
@@ -1193,7 +1168,6 @@
-
@@ -1228,7 +1202,6 @@
-
@@ -1476,9 +1449,6 @@
-
-
-
@@ -1493,7 +1463,6 @@
-
diff --git a/src/Umbraco.Tests/Cache/CacheRefresherTests.cs b/src/Umbraco.Tests/Cache/CacheRefresherTests.cs
deleted file mode 100644
index 8002cb9b4f..0000000000
--- a/src/Umbraco.Tests/Cache/CacheRefresherTests.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using NUnit.Framework;
-using Umbraco.Core.Sync;
-
-namespace Umbraco.Tests.Cache
-{
- [TestFixture]
- public class CacheRefresherTests
- {
- [TestCase("", "123456", "testmachine", true)] //empty hash will continue
- [TestCase("2e6deefea4444a69dbd15a01b4c2749d", "123456", "testmachine", false)] //match, don't continue
- [TestCase("2e6deefea4444a69dbd15a01b4c2749d", "12345", "testmachine", true)] // no match, continue
- [TestCase("2e6deefea4444a69dbd15a01b4c2749d", "123456", "testmachin", true)] // same
- [TestCase("2e6deefea4444a69dbd15a01b4c2749", "123456", "testmachine", true)] // same
- public void Continue_Refreshing_For_Request(string hash, string appDomainAppId, string machineName, bool expected)
- {
- if (expected)
- Assert.IsTrue(Continue(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName)));
- else
- Assert.IsFalse(Continue(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName)));
- }
-
- // that's what CacheRefresher.asmx.cs does...
- private bool Continue(string hash1, string hash2)
- {
- if (string.IsNullOrEmpty(hash1)) return true;
- return hash1 != hash2;
- }
- }
-}
diff --git a/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs b/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
index ed28004477..dc67bb532f 100644
--- a/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
+++ b/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
@@ -129,52 +129,52 @@ namespace Umbraco.Tests.Cache.DistributedCache
public List PayloadsRefreshed = new List();
public int CountOfFullRefreshes = 0;
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, TPayload[] payload)
+ public void PerformRefresh(ICacheRefresher refresher, TPayload[] payload)
{
// doing nothing
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, string jsonPayload)
+ public void PerformRefresh(ICacheRefresher refresher, string jsonPayload)
{
PayloadsRefreshed.Add(jsonPayload);
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, Func getNumericId, params T[] instances)
+ public void PerformRefresh(ICacheRefresher refresher, Func getNumericId, params T[] instances)
{
IntIdsRefreshed.AddRange(instances.Select(getNumericId));
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, Func getGuidId, params T[] instances)
+ public void PerformRefresh(ICacheRefresher refresher, Func getGuidId, params T[] instances)
{
GuidIdsRefreshed.AddRange(instances.Select(getGuidId));
}
- public void PerformRemove(IEnumerable servers, ICacheRefresher refresher, string jsonPayload)
+ public void PerformRemove(ICacheRefresher refresher, string jsonPayload)
{
PayloadsRemoved.Add(jsonPayload);
}
- public void PerformRemove(IEnumerable servers, ICacheRefresher refresher, Func getNumericId, params T[] instances)
+ public void PerformRemove(ICacheRefresher refresher, Func getNumericId, params T[] instances)
{
IntIdsRemoved.AddRange(instances.Select(getNumericId));
}
- public void PerformRemove(IEnumerable servers, ICacheRefresher refresher, params int[] numericIds)
+ public void PerformRemove(ICacheRefresher refresher, params int[] numericIds)
{
IntIdsRemoved.AddRange(numericIds);
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, params int[] numericIds)
+ public void PerformRefresh(ICacheRefresher refresher, params int[] numericIds)
{
IntIdsRefreshed.AddRange(numericIds);
}
- public void PerformRefresh(IEnumerable servers, ICacheRefresher refresher, params Guid[] guidIds)
+ public void PerformRefresh(ICacheRefresher refresher, params Guid[] guidIds)
{
GuidIdsRefreshed.AddRange(guidIds);
}
- public void PerformRefreshAll(IEnumerable servers, ICacheRefresher refresher)
+ public void PerformRefreshAll(ICacheRefresher refresher)
{
CountOfFullRefreshes++;
}
diff --git a/src/Umbraco.Tests/Composing/TypeFinderTests.cs b/src/Umbraco.Tests/Composing/TypeFinderTests.cs
index 29458deefb..9a0d473db0 100644
--- a/src/Umbraco.Tests/Composing/TypeFinderTests.cs
+++ b/src/Umbraco.Tests/Composing/TypeFinderTests.cs
@@ -90,7 +90,7 @@ namespace Umbraco.Tests.Composing
Assert.AreEqual(0, typesFound.Count()); // 0 classes in _assemblies are marked with [Tree]
typesFound = TypeFinder.FindClassesWithAttribute(new[] { typeof (UmbracoContext).Assembly });
- Assert.AreEqual(23, typesFound.Count()); // + classes in Umbraco.Web are marked with [Tree]
+ Assert.AreEqual(22, typesFound.Count()); // + classes in Umbraco.Web are marked with [Tree]
}
private static ProfilingLogger GetTestProfilingLogger()
@@ -100,70 +100,6 @@ namespace Umbraco.Tests.Composing
return new ProfilingLogger(logger, profiler);
}
- [Ignore("fixme - ignored test")]
- [Test]
- public void Benchmark_Original_Finder()
- {
- var profilingLogger = GetTestProfilingLogger();
- using (profilingLogger.TraceDuration("Starting test", "Finished test"))
- {
- using (profilingLogger.TraceDuration("Starting FindClassesOfType", "Finished FindClassesOfType"))
- {
- for (var i = 0; i < 1000; i++)
- {
- Assert.Greater(TypeFinderOriginal.FindClassesOfType(_assemblies).Count(), 0);
- }
- }
- using (profilingLogger.TraceDuration("Starting FindClassesOfTypeWithAttribute", "Finished FindClassesOfTypeWithAttribute"))
- {
- for (var i = 0; i < 1000; i++)
- {
- Assert.Greater(TypeFinderOriginal.FindClassesOfTypeWithAttribute(_assemblies).Count(), 0);
- }
- }
- using (profilingLogger.TraceDuration("Starting FindClassesWithAttribute", "Finished FindClassesWithAttribute"))
- {
- for (var i = 0; i < 1000; i++)
- {
- Assert.Greater(TypeFinderOriginal.FindClassesWithAttribute(_assemblies).Count(), 0);
- }
- }
- }
-
- }
-
- [Ignore("fixme - ignored test")]
- [Test]
- public void Benchmark_New_Finder()
- {
- var profilingLogger = GetTestProfilingLogger();
- using (profilingLogger.TraceDuration("Starting test", "Finished test"))
- {
- using (profilingLogger.TraceDuration("Starting FindClassesOfType", "Finished FindClassesOfType"))
- {
- for (var i = 0; i < 1000; i++)
- {
- Assert.Greater(TypeFinder.FindClassesOfType(_assemblies).Count(), 0);
- }
- }
- using (profilingLogger.TraceDuration("Starting FindClassesOfTypeWithAttribute", "Finished FindClassesOfTypeWithAttribute"))
- {
- for (var i = 0; i < 1000; i++)
- {
- Assert.Greater(TypeFinder.FindClassesOfTypeWithAttribute(_assemblies).Count(), 0);
- }
- }
- using (profilingLogger.TraceDuration("Starting FindClassesWithAttribute", "Finished FindClassesWithAttribute"))
- {
- for (var i = 0; i < 1000; i++)
- {
- Assert.Greater(TypeFinder.FindClassesWithAttribute(_assemblies).Count(), 0);
- }
- }
- }
-
- }
-
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class MyTestAttribute : Attribute
{
diff --git a/src/Umbraco.Tests/Composing/TypeLoaderTests.cs b/src/Umbraco.Tests/Composing/TypeLoaderTests.cs
index 6fba071709..46f024429e 100644
--- a/src/Umbraco.Tests/Composing/TypeLoaderTests.cs
+++ b/src/Umbraco.Tests/Composing/TypeLoaderTests.cs
@@ -272,14 +272,14 @@ AnotherContentFinder
public void Resolves_Actions()
{
var actions = _typeLoader.GetActions();
- Assert.AreEqual(37, actions.Count());
+ Assert.AreEqual(35, actions.Count());
}
[Test]
public void Resolves_Trees()
{
var trees = _typeLoader.GetTrees();
- Assert.AreEqual(5, trees.Count());
+ Assert.AreEqual(4, trees.Count());
}
[Test]
@@ -288,14 +288,7 @@ AnotherContentFinder
var types = _typeLoader.GetDataEditors();
Assert.AreEqual(43, types.Count());
}
-
- [Test]
- public void Resolves_XsltExtensions()
- {
- var types = _typeLoader.GetXsltExtensions();
- Assert.AreEqual(3, types.Count());
- }
-
+
///
/// This demonstrates this issue: http://issues.umbraco.org/issue/U4-3505 - the TypeList was returning a list of assignable types
/// not explicit types which is sort of ideal but is confusing so we'll do it the less confusing way.
@@ -319,12 +312,6 @@ AnotherContentFinder
Assert.IsNull(shouldNotFind);
}
- [XsltExtension("Blah.Blah")]
- public class MyXsltExtension
- {
-
- }
-
public interface IFindMe : IDiscoverable
{
diff --git a/src/Umbraco.Tests/Composing/XsltExtensionCollectionTests.cs b/src/Umbraco.Tests/Composing/XsltExtensionCollectionTests.cs
deleted file mode 100644
index 399b1df7bb..0000000000
--- a/src/Umbraco.Tests/Composing/XsltExtensionCollectionTests.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System.Linq;
-using LightInject;
-using NUnit.Framework;
-using Umbraco.Core.Macros;
-using Umbraco.Web;
-
-namespace Umbraco.Tests.Composing
-{
- [TestFixture]
- public class XsltExtensionCollectionTests : ComposingTestBase
- {
- [Test]
- public void XsltExtensionsCollectionBuilderWorks()
- {
- var container = new ServiceContainer();
- var builder = new XsltExtensionCollectionBuilder(container);
- builder.AddExtensionObjectProducer(() => TypeLoader.GetXsltExtensions());
- var extensions = builder.CreateCollection();
-
- Assert.AreEqual(3, extensions.Count());
-
- Assert.IsTrue(extensions.Select(x => x.ExtensionObject.GetType()).Contains(typeof (XsltEx1)));
- Assert.IsTrue(extensions.Select(x => x.ExtensionObject.GetType()).Contains(typeof(XsltEx2)));
- Assert.AreEqual("test1", extensions.Single(x => x.ExtensionObject.GetType() == typeof(XsltEx1)).Namespace);
- Assert.AreEqual("test2", extensions.Single(x => x.ExtensionObject.GetType() == typeof(XsltEx2)).Namespace);
- }
-
- #region Test Objects
-
- [XsltExtension("test1")]
- public class XsltEx1
- { }
-
- //test with legacy one
- [umbraco.XsltExtension("test2")]
- public class XsltEx2
- { }
-
- #endregion
- }
-}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementDefaultTests.cs
deleted file mode 100644
index a3f8b79aa1..0000000000
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementDefaultTests.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using NUnit.Framework;
-
-namespace Umbraco.Tests.Configurations.UmbracoSettings
-{
- [TestFixture]
- public class DeveloperElementDefaultTests : DeveloperElementTests
- {
- protected override bool TestingDefaults
- {
- get { return true; }
- }
- }
-}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementTests.cs
deleted file mode 100644
index aa79ffd965..0000000000
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementTests.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Linq;
-using NUnit.Framework;
-
-namespace Umbraco.Tests.Configurations.UmbracoSettings
-{
- [TestFixture]
- public class DeveloperElementTests : UmbracoSettingsTests
- {
- [Test]
- public void AppCodeFileExtensions()
- {
- Assert.IsTrue(SettingsSection.Developer.AppCodeFileExtensions.Count() == 2);
- Assert.IsTrue(SettingsSection.Developer.AppCodeFileExtensions.All(
- x => "cs,vb".Split(',').Contains(x.Extension)));
- }
- }
-}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementDefaultTests.cs
deleted file mode 100644
index 2c3a843af6..0000000000
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementDefaultTests.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System.Linq;
-using NUnit.Framework;
-
-namespace Umbraco.Tests.Configurations.UmbracoSettings
-{
- [TestFixture]
- public class DistributedCallElementDefaultTests : DistributedCallElementTests
- {
- protected override bool TestingDefaults
- {
- get { return true; }
- }
-
- [Test]
- public override void Enabled()
- {
- Assert.IsTrue(SettingsSection.DistributedCall.Enabled == false);
-
- }
-
- [Test]
- public override void Servers()
- {
- Assert.IsTrue(SettingsSection.DistributedCall.Servers.Any() == false);
- }
- }
-}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs
deleted file mode 100644
index c7796a3b0a..0000000000
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System.Linq;
-using NUnit.Framework;
-
-namespace Umbraco.Tests.Configurations.UmbracoSettings
-{
- [TestFixture]
- public class DistributedCallElementTests : UmbracoSettingsTests
- {
- [Test]
- public virtual void Enabled()
- {
- Assert.IsTrue(SettingsSection.DistributedCall.Enabled == true);
-
- }
- [Test]
- public void UserId()
- {
- Assert.IsTrue(SettingsSection.DistributedCall.UserId == 0);
-
- }
- [Test]
- public virtual void Servers()
- {
- Assert.IsTrue(SettingsSection.DistributedCall.Servers.Count() == 2);
- Assert.IsTrue(SettingsSection.DistributedCall.Servers.ElementAt(0).ServerAddress == "127.0.0.1");
- Assert.IsTrue(SettingsSection.DistributedCall.Servers.ElementAt(1).ServerAddress == "127.0.0.2");
- Assert.IsTrue(SettingsSection.DistributedCall.Servers.ElementAt(1).ForceProtocol == "https");
- Assert.IsTrue(SettingsSection.DistributedCall.Servers.ElementAt(1).ForcePortnumber == "443");
- }
-
- }
-}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementDefaultTests.cs
deleted file mode 100644
index 4a96957e2f..0000000000
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementDefaultTests.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Linq;
-using NUnit.Framework;
-
-namespace Umbraco.Tests.Configurations.UmbracoSettings
-{
- [TestFixture]
- public class PackageRepositoriesElementDefaultTests : PackageRepositoriesElementTests
- {
- protected override bool TestingDefaults
- {
- get { return true; }
- }
-
- [Test]
- public override void Repositories()
- {
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.Count() == 1);
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66"));
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Name == "Umbraco package Repository");
- }
- }
-}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs
deleted file mode 100644
index 6b5d0e2d48..0000000000
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Linq;
-using NUnit.Framework;
-
-namespace Umbraco.Tests.Configurations.UmbracoSettings
-{
- [TestFixture]
- public class PackageRepositoriesElementTests : UmbracoSettingsTests
- {
- [Test]
- public virtual void Repositories()
- {
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.Count() == 2);
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66"));
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).Name == "Umbraco package Repository");
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).HasCustomWebServiceUrl == false);
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).WebServiceUrl == "/umbraco/webservices/api/repository.asmx");
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).RepositoryUrl == "http://packages.umbraco.org");
-
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).Id == Guid.Parse("163245E0-CD22-44B6-841A-1B9B9D2E955F"));
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).Name == "Test Repo");
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(1).HasCustomWebServiceUrl == false);
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).WebServiceUrl == "/umbraco/webservices/api/repository.asmx");
- Assert.IsTrue(SettingsSection.PackageRepositories.Repositories.ElementAt(0).RepositoryUrl == "http://packages.umbraco.org");
- }
- }
-}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs
index d419d9d320..429aa28bb7 100644
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs
+++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs
@@ -33,7 +33,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
[Test]
public void AuthCookieName()
{
- Assert.IsTrue(SettingsSection.Security.AuthCookieName == Constants.Web.AuthCookieName);
+ Assert.IsTrue(SettingsSection.Security.AuthCookieName == "UMB_UCONTEXT");
}
}
}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/TemplateElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/TemplateElementTests.cs
index bfc8f72c6f..3e5a6df65b 100644
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/TemplateElementTests.cs
+++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/TemplateElementTests.cs
@@ -6,25 +6,11 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
[TestFixture]
public class TemplateElementTests : UmbracoSettingsTests
{
- [Test]
- public void UseAspNetMasterPages()
- {
- Assert.IsTrue(SettingsSection.Templates.UseAspNetMasterPages == true);
- }
- [Test]
- public void EnableSkinSupport()
- {
- Assert.IsTrue(SettingsSection.Templates.EnableSkinSupport);
- }
[Test]
public void DefaultRenderingEngine()
{
Assert.IsTrue(SettingsSection.Templates.DefaultRenderingEngine == RenderingEngine.Mvc);
}
- [Test]
- public void EnableTemplateFolders()
- {
- Assert.IsTrue(SettingsSection.Templates.EnableTemplateFolders == false);
- }
+
}
}
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config
index c56ee45f55..fc59f62d12 100644
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config
+++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config
@@ -147,19 +147,9 @@
- true
- true
Mvc
-
-
-
- cs
- vb
-
-
-
false
true
@@ -179,26 +169,6 @@
-
-
-
-
- 0
-
-
-
- 127.0.0.1
- 127.0.0.2
-
-
-
-
-
-
-
-
-
-
@@ -226,4 +196,4 @@
internalRedirectPreservesTemplate="false">
-
\ No newline at end of file
+
diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config
index 0848a893d6..ba10dbca78 100644
--- a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config
+++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config
@@ -42,25 +42,16 @@
Mvc
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
diff --git a/src/Umbraco.Tests/IO/AbstractFileSystemTests.cs b/src/Umbraco.Tests/IO/AbstractFileSystemTests.cs
index 9f83529d11..123b9c54c2 100644
--- a/src/Umbraco.Tests/IO/AbstractFileSystemTests.cs
+++ b/src/Umbraco.Tests/IO/AbstractFileSystemTests.cs
@@ -123,12 +123,12 @@ namespace Umbraco.Tests.IO
var created = _fileSystem.GetCreated("test.txt");
var modified = _fileSystem.GetLastModified("test.txt");
- Assert.AreEqual(DateTime.Today.Year, created.Year);
- Assert.AreEqual(DateTime.Today.Month, created.Month);
+ Assert.AreEqual(DateTime.UtcNow.Year, created.Year);
+ Assert.AreEqual(DateTime.UtcNow.Month, created.Month);
Assert.AreEqual(DateTime.UtcNow.Date, created.Date);
- Assert.AreEqual(DateTime.Today.Year, modified.Year);
- Assert.AreEqual(DateTime.Today.Month, modified.Month);
+ Assert.AreEqual(DateTime.UtcNow.Year, modified.Year);
+ Assert.AreEqual(DateTime.UtcNow.Month, modified.Month);
Assert.AreEqual(DateTime.UtcNow.Date, modified.Date);
_fileSystem.DeleteFile("test.txt");
diff --git a/src/Umbraco.Tests/IO/IoHelperTests.cs b/src/Umbraco.Tests/IO/IoHelperTests.cs
index fb3283718e..07436eff1a 100644
--- a/src/Umbraco.Tests/IO/IoHelperTests.cs
+++ b/src/Umbraco.Tests/IO/IoHelperTests.cs
@@ -47,7 +47,6 @@ namespace Umbraco.Tests.IO
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.UmbracoClient, true), IOHelper.MapPath(SystemDirectories.UmbracoClient, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.UserControls, true), IOHelper.MapPath(SystemDirectories.UserControls, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.WebServices, true), IOHelper.MapPath(SystemDirectories.WebServices, false));
- Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Xslt, true), IOHelper.MapPath(SystemDirectories.Xslt, false));
}
[Test]
diff --git a/src/Umbraco.Tests/Integration/ContentEventsTests.cs b/src/Umbraco.Tests/Integration/ContentEventsTests.cs
index c87774ba27..246626f0a8 100644
--- a/src/Umbraco.Tests/Integration/ContentEventsTests.cs
+++ b/src/Umbraco.Tests/Integration/ContentEventsTests.cs
@@ -14,8 +14,10 @@ using Umbraco.Core.Sync;
using Umbraco.Tests.Cache.DistributedCache;
using Umbraco.Tests.Services;
using Umbraco.Tests.TestHelpers.Entities;
+using Umbraco.Tests.TestHelpers.Stubs;
using Umbraco.Tests.Testing;
using Umbraco.Web.Cache;
+using static Umbraco.Tests.Cache.DistributedCache.DistributedCacheTests;
namespace Umbraco.Tests.Integration
{
@@ -50,8 +52,8 @@ namespace Umbraco.Tests.Integration
{
base.Compose();
- Container.Register(_ => new DistributedCacheTests.TestServerRegistrar()); // localhost-only
- Container.Register(new PerContainerLifetime());
+ Container.Register(_ => new TestServerRegistrar()); // localhost-only
+ Container.Register(new PerContainerLifetime());
Container.RegisterCollectionBuilder()
.Add()
@@ -2234,5 +2236,15 @@ namespace Umbraco.Tests.Integration
// all content type events
#endregion
+
+ public class LocalServerMessenger : ServerMessengerBase
+ {
+ public LocalServerMessenger() : base(false)
+ { }
+
+ protected override void DeliverRemote(ICacheRefresher refresher, MessageType messageType, IEnumerable ids = null, string json = null)
+ {
+ }
+ }
}
}
diff --git a/src/Umbraco.Tests/Macros/MacroTests.cs b/src/Umbraco.Tests/Macros/MacroTests.cs
index e3a4db5390..29d81e773e 100644
--- a/src/Umbraco.Tests/Macros/MacroTests.cs
+++ b/src/Umbraco.Tests/Macros/MacroTests.cs
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Macros
{
Name = "test",
Alias = "test",
- ScriptName = "~/usercontrols/menu.ascx"
+ MacroSource = "~/usercontrols/menu.ascx"
};
macroModel.Properties.Add(new MacroPropertyModel(macroPropName, val));
@@ -68,7 +68,6 @@ namespace Umbraco.Tests.Macros
Assert.AreEqual(converted.Result, prop.GetValue(ctrl));
}
- [TestCase("Xslt", true)]
[TestCase("PartialView", true)]
[TestCase("UserControl", true)]
[TestCase("Unknown", false)]
@@ -78,9 +77,7 @@ namespace Umbraco.Tests.Macros
var model = new MacroModel
{
MacroType = macroType,
- Xslt = "anything",
- ScriptName = "anything",
- TypeName = "anything"
+ MacroSource = "anything"
};
var filename = MacroRenderer.GetMacroFileName(model);
if (expectedNonNull)
diff --git a/src/Umbraco.Tests/Misc/ApplicationUrlHelperTests.cs b/src/Umbraco.Tests/Misc/ApplicationUrlHelperTests.cs
index bb134d7e35..9c0560351b 100644
--- a/src/Umbraco.Tests/Misc/ApplicationUrlHelperTests.cs
+++ b/src/Umbraco.Tests/Misc/ApplicationUrlHelperTests.cs
@@ -11,25 +11,18 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Sync;
using Umbraco.Tests.TestHelpers;
+using Umbraco.Tests.Cache.DistributedCache;
+using Umbraco.Tests.TestHelpers.Stubs;
+
namespace Umbraco.Tests.Misc
{
[TestFixture]
public class ApplicationUrlHelperTests
{
- private IServerRegistrar _registrar;
-
// note: in tests, read appContext._umbracoApplicationUrl and not the property,
// because reading the property does run some code, as long as the field is null.
- private void Initialize(IUmbracoSettingsSection settings, IGlobalSettings globalSettings)
- {
- _registrar = new ConfigServerRegistrar(settings.DistributedCall, Mock.Of(), globalSettings);
- var container = new ServiceContainer();
- container.ConfigureUmbracoCore();
- container.Register(_ => _registrar);
- }
-
[TearDown]
public void Reset()
{
@@ -39,18 +32,42 @@ namespace Umbraco.Tests.Misc
[Test]
public void NoApplicationUrlByDefault()
{
- var state = new RuntimeState(Mock.Of(), new Lazy(Mock.Of), new Lazy(Mock.Of));
+ var state = new RuntimeState(Mock.Of(), new Lazy(Mock.Of), new Lazy(Mock.Of), Mock.Of(), Mock.Of());
Assert.IsNull(state.ApplicationUrl);
}
+ [Test]
+ public void SetApplicationUrlViaServerRegistrar()
+ {
+ // no applicable settings, but a provider
+
+ var settings = Mock.Of(section =>
+ section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
+ && section.ScheduledTasks == Mock.Of());
+
+ var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
+ globalConfig.Setup(x => x.UseHttps).Returns(true);
+
+ var registrar = new Mock();
+ registrar.Setup(x => x.GetCurrentServerUmbracoApplicationUrl()).Returns("http://server1.com/umbraco");
+
+ var state = new RuntimeState(
+ Mock.Of(),
+ new Lazy(() => registrar.Object),
+ new Lazy(Mock.Of), settings, globalConfig.Object);
+
+ state.EnsureApplicationUrl();
+
+ Assert.AreEqual("http://server1.com/umbraco", state.ApplicationUrl.ToString());
+ }
+
[Test]
public void SetApplicationUrlViaProvider()
{
// no applicable settings, but a provider
var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Servers == Enumerable.Empty())
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string) null)
+ section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string) null)
&& section.ScheduledTasks == Mock.Of());
var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
@@ -58,11 +75,11 @@ namespace Umbraco.Tests.Misc
ApplicationUrlHelper.ApplicationUrlProvider = request => "http://server1.com/umbraco";
- Initialize(settings, globalConfig.Object);
+
- var state = new RuntimeState(Mock.Of(), new Lazy(Mock.Of), new Lazy(Mock.Of));
+ var state = new RuntimeState(Mock.Of(), new Lazy(Mock.Of), new Lazy(Mock.Of), settings, globalConfig.Object);
- state.EnsureApplicationUrl(settings, globalConfig.Object);
+ state.EnsureApplicationUrl();
Assert.AreEqual("http://server1.com/umbraco", state.ApplicationUrl.ToString());
}
@@ -73,176 +90,31 @@ namespace Umbraco.Tests.Misc
// no applicable settings, cannot set url
var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Servers == Enumerable.Empty())
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string) null)
+ section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string) null)
&& section.ScheduledTasks == Mock.Of());
var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
globalConfig.Setup(x => x.UseHttps).Returns(true);
- Initialize(settings, globalConfig.Object);
-
- var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object);
+ var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object, Mock.Of());
// still NOT set
Assert.IsNull(url);
}
-
- [Test]
- public void SetApplicationUrlFromDcSettingsSsl1()
- {
- // set from distributed call settings
- // first server is master server
-
- var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Enabled && callSection.Servers == new[]
- {
- Mock.Of(server => server.ServerName == NetworkHelper.MachineName && server.ServerAddress == "server1.com"),
- Mock.Of(server => server.ServerName == "ANOTHERNAME" && server.ServerAddress == "server2.com"),
- })
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
- && section.ScheduledTasks == Mock.Of(tasksSection => tasksSection.BaseUrl == (string)null));
-
- var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
- globalConfig.Setup(x => x.UseHttps).Returns(true);
-
- Initialize(settings, globalConfig.Object);
-
- var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object);
-
- Assert.AreEqual("http://server1.com:80/umbraco", url);
-
- var role = _registrar.GetCurrentServerRole();
- Assert.AreEqual(ServerRole.Master, role);
- }
-
- [Test]
- public void SetApplicationUrlFromDcSettingsSsl2()
- {
- // set from distributed call settings
- // other servers are slave servers
-
- var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Enabled && callSection.Servers == new[]
- {
- Mock.Of(server => server.ServerName == "ANOTHERNAME" && server.ServerAddress == "server2.com"),
- Mock.Of(server => server.ServerName == NetworkHelper.MachineName && server.ServerAddress == "server1.com"),
- })
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
- && section.ScheduledTasks == Mock.Of(tasksSection => tasksSection.BaseUrl == (string)null));
-
- var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
- globalConfig.Setup(x => x.UseHttps).Returns(true);
-
- Initialize(settings, globalConfig.Object);
-
- var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object);
-
- Assert.AreEqual("http://server1.com:80/umbraco", url);
-
- var role = _registrar.GetCurrentServerRole();
- Assert.AreEqual(ServerRole.Slave, role);
- }
-
- [Test]
- public void SetApplicationUrlFromDcSettingsSsl3()
- {
- // set from distributed call settings
- // cannot set if not enabled
-
- var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Enabled == false && callSection.Servers == new[]
- {
- Mock.Of(server => server.ServerName == "ANOTHERNAME" && server.ServerAddress == "server2.com"),
- Mock.Of(server => server.ServerName == NetworkHelper.MachineName && server.ServerAddress == "server1.com"),
- })
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
- && section.ScheduledTasks == Mock.Of(tasksSection => tasksSection.BaseUrl == (string)null));
-
- var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
- globalConfig.Setup(x => x.UseHttps).Returns(true);
-
- Initialize(settings, globalConfig.Object);
-
- var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object);
-
- Assert.IsNull(url);
-
- var role = _registrar.GetCurrentServerRole();
- Assert.AreEqual(ServerRole.Single, role);
- }
-
- [Test]
- public void ServerRoleSingle()
- {
- // distributed call settings disabled, single server
-
- var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Enabled == false && callSection.Servers == Enumerable.Empty())
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
- && section.ScheduledTasks == Mock.Of(tasksSection => tasksSection.BaseUrl == (string)null));
-
- var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
-
- Initialize(settings, globalConfig.Object);
-
- var role = _registrar.GetCurrentServerRole();
- Assert.AreEqual(ServerRole.Single, role);
- }
-
- [Test]
- public void ServerRoleUnknown1()
- {
- // distributed call enabled but missing servers, unknown server
-
- var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Enabled && callSection.Servers == Enumerable.Empty())
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
- && section.ScheduledTasks == Mock.Of(tasksSection => tasksSection.BaseUrl == (string)null));
-
- var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
-
- Initialize(settings, globalConfig.Object);
-
- var role = _registrar.GetCurrentServerRole();
- Assert.AreEqual(ServerRole.Unknown, role);
- }
-
- [Test]
- public void ServerRoleUnknown2()
- {
- // distributed call enabled, cannot find server, assume it's an undeclared slave
-
- var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Enabled && callSection.Servers == new[]
- {
- Mock.Of(server => server.ServerName == "ANOTHERNAME" && server.ServerAddress == "server2.com"),
- })
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
- && section.ScheduledTasks == Mock.Of(tasksSection => tasksSection.BaseUrl == (string)null));
-
- var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
-
- Initialize(settings, globalConfig.Object);
-
- var role = _registrar.GetCurrentServerRole();
- Assert.AreEqual(ServerRole.Slave, role);
- }
-
+
[Test]
public void SetApplicationUrlFromStSettingsNoSsl()
{
var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Servers == Enumerable.Empty())
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string) null)
+ section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string) null)
&& section.ScheduledTasks == Mock.Of(tasksSection => tasksSection.BaseUrl == "mycoolhost.com/umbraco"));
var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
globalConfig.Setup(x => x.UseHttps).Returns(false);
- Initialize(settings, globalConfig.Object);
- var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object);
+
+ var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object, Mock.Of());
Assert.AreEqual("http://mycoolhost.com/umbraco", url);
}
@@ -251,16 +123,15 @@ namespace Umbraco.Tests.Misc
public void SetApplicationUrlFromStSettingsSsl()
{
var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of(callSection => callSection.Servers == Enumerable.Empty())
- && section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string) null)
+ section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string) null)
&& section.ScheduledTasks == Mock.Of(tasksSection => tasksSection.BaseUrl == "mycoolhost.com/umbraco/"));
var globalConfig = Mock.Get(SettingsForTests.GenerateMockGlobalSettings());
globalConfig.Setup(x => x.UseHttps).Returns(true);
- Initialize(settings, globalConfig.Object);
- var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object);
+
+ var url = ApplicationUrlHelper.TryGetApplicationUrl(settings, Mock.Of(), globalConfig.Object, Mock.Of());
Assert.AreEqual("https://mycoolhost.com/umbraco", url);
}
@@ -269,18 +140,19 @@ namespace Umbraco.Tests.Misc
public void SetApplicationUrlFromWrSettingsSsl()
{
var settings = Mock.Of(section =>
- section.DistributedCall == Mock.Of