diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
index 7a81989037..e97b03e7e3 100644
--- a/.github/CODE_OF_CONDUCT.md
+++ b/.github/CODE_OF_CONDUCT.md
@@ -43,6 +43,8 @@ Community leaders (e.g. Meetup & festival organizers, moderators, maintainers, .
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
+Specific enforcement steps are listed in the [Code of Conduct Enforcement Guidelines](https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/.github/CODE_OF_CONDUCT_ENFORCEMENT.md) document which is an appendix of this document, updated and maintained by the Code of Conduct Team.
+
## Scope
This Code of Conduct applies within all community spaces and events supported by Umbraco HQ or using the Umbraco name. It also applies when an individual is officially representing the community in public spaces.
@@ -58,6 +60,8 @@ Or alternatively, you can reach out directly to any of the team members behind t
The review process is done with full respect for the privacy and security of the reporter of any incident.
+People with a conflict of interest should exclude themselves or if necessary be excluded by the other team members.
+
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
diff --git a/.github/CODE_OF_CONDUCT_ENFORCEMENT.md b/.github/CODE_OF_CONDUCT_ENFORCEMENT.md
new file mode 100644
index 0000000000..2bb45644c2
--- /dev/null
+++ b/.github/CODE_OF_CONDUCT_ENFORCEMENT.md
@@ -0,0 +1,57 @@
+# Umbraco Code of Conduct Enforcement guidelines - Consequence Ladder
+
+These are the steps followed by the [Umbraco Code of Conduct Team](https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/.github/CODE_OF_CONDUCT.md) when we respond to an issue or incident brought to our attention by a community member.
+
+This is an appendix to the Code of Conduct and is updated and maintained by the Code of Conduct Team.
+
+To make sure that all reports will be reviewed and investigated promptly and fairly, as highlighted in the Umbraco Code of Conduct, we are following [Mozilla’s Consequence Ladder approach](https://github.com/mozilla/inclusion/blob/master/code-of-conduct-enforcement/consequence-ladder.md).
+
+This approach helps the Team enforce the Code of Conduct in a structured manner and can be used as a way of communicating escalation. Each time the Team takes an action (warning, ban) the individual is made aware of future consequences. The Team can either follow the order of the levels in the ladder or decide to jump levels. When needed, the team can go directly to a permanent ban.
+
+**Level 0: No Action**
+Recommendations do not indicate a violation of the Code of Conduct.
+
+**Level 1: Simple Warning Issued**
+A private, written warning from the Code of Conduct Team, with clarity of violation, consequences of continued behavior.
+
+**Level 2: Warning**
+A private, written warning from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. Additionally:
+
+* Communication of next-level consequences if behaviors are repeated (according to this ladder).
+
+**Level 3: Warning + Mandatory Cooling Off Period (Access Retained)**
+A private warning from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. Additionally:
+
+* Request to avoid interaction on community messaging platforms (public forums, Our, commenting on issues).
+ * This includes avoiding any interactions in any Umbraco channels, spaces/offices, as well as external channels like social media (e.g. Twitter, Facebook, LinkedIn). For example, 'following/liking/retweeting' would be considered a violation of these terms, and consequence would escalate according to this ladder.
+* Require they do not interact with others in the report, or those who they suspect are involved in the report.
+* Suggestions for 'out of office' type of message on platforms, to reduce curiosity, or suspicion among those not involved.
+
+**Level 4: Temporary Ban (Access Revoked)**
+Private communication of ban from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. Additionally:
+
+* 3-6 months imposed break.
+* All accounts deactivated, or blocked during this time (Our, HQ Slack if applicable).
+* Require to avoid interaction on community messaging platforms (public forums, Our, commenting on issues).
+ * This includes avoiding any interactions in any Umbraco channels, spaces/offices, as well as external channels like social media (e.g. Twitter, Facebook, LinkedIn). For example, 'following/liking/retweeting' would be considered a violation of these terms, and consequence would escalate according to this ladder.
+* All community leadership roles (e.g. Community Teams, Meetup/festival organizer, Commit right on Github..) suspended. (onboarding/reapplication required outside of this process)
+* No attendance at Umbraco events during the ban period.
+* Not allowed to enter Umbraco HQ offices during the ban period.
+* Permission to use the MVP title, if applicable, is revoked during this ban period.
+* The community leaders running events and other initiatives are informed of the ban.
+
+**Level 5: Permanent Ban**
+Private communication of ban from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. Additionally:
+
+* All accounts deactivated permanently.
+* No attendance at Umbraco events going forward.
+* Not allowed to enter Umbraco HQ offices permanently.
+* All community leadership roles (e.g. Community Teams, Meetup/festival organizer, Commit right on Github..) permanently suspended.
+* Permission to use the MVP title, if applicable, revoked.
+* The community leaders running events and other initiatives are informed of the ban.
+
+
+Sources:
+* [Mozilla Code of Conduct - Enforcement Consequence Ladder](https://github.com/mozilla/inclusion/blob/master/code-of-conduct-enforcement/consequence-ladder.md)
+* [Drupal Conflict Resolution Policy and Process](https://www.drupal.org/conflict-resolution)
+* [Django Code of Conduct - Enforcement Manual](https://www.djangoproject.com/conduct/enforcement-manual/)
diff --git a/.github/workflows/codeql-config.yml b/.github/workflows/codeql-config.yml
index 59b55e48ec..7bac345491 100644
--- a/.github/workflows/codeql-config.yml
+++ b/.github/workflows/codeql-config.yml
@@ -9,5 +9,6 @@ paths-ignore:
- Umbraco.Tests.AcceptanceTest
- Umbraco.Tests.Benchmarks
- bin
+ - build.tmp
paths:
- - src
\ No newline at end of file
+ - src
diff --git a/build/NuSpecs/UmbracoCms.Web.nuspec b/build/NuSpecs/UmbracoCms.Web.nuspec
index 82d15d2b95..d8815bab63 100644
--- a/build/NuSpecs/UmbracoCms.Web.nuspec
+++ b/build/NuSpecs/UmbracoCms.Web.nuspec
@@ -28,7 +28,7 @@
-
+
@@ -42,7 +42,7 @@
-
+
diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs
index 3ecfd20f03..2a7386cb45 100644
--- a/src/SolutionInfo.cs
+++ b/src/SolutionInfo.cs
@@ -18,5 +18,5 @@ using System.Resources;
[assembly: AssemblyVersion("8.0.0")]
// these are FYI and changed automatically
-[assembly: AssemblyFileVersion("8.11.1")]
-[assembly: AssemblyInformationalVersion("8.11.1")]
+[assembly: AssemblyFileVersion("8.13.0")]
+[assembly: AssemblyInformationalVersion("8.13.0-rc")]
diff --git a/src/Umbraco.Core/Cache/CacheKeys.cs b/src/Umbraco.Core/Cache/CacheKeys.cs
index b8ee0e97c4..0e9a9a3862 100644
--- a/src/Umbraco.Core/Cache/CacheKeys.cs
+++ b/src/Umbraco.Core/Cache/CacheKeys.cs
@@ -12,5 +12,10 @@
public const string MacroContentCacheKey = "macroContent_"; // used in MacroRenderers
public const string MacroFromAliasCacheKey = "macroFromAlias_";
+
+ public const string UserAllContentStartNodesPrefix = "AllContentStartNodes";
+ public const string UserAllMediaStartNodesPrefix = "AllMediaStartNodes";
+ public const string UserMediaStartNodePathsPrefix = "MediaStartNodePaths";
+ public const string UserContentStartNodePathsPrefix = "ContentStartNodePaths";
}
}
diff --git a/src/Umbraco.Core/Composing/ComponentCollection.cs b/src/Umbraco.Core/Composing/ComponentCollection.cs
index 62b240f10f..6501a3a28c 100644
--- a/src/Umbraco.Core/Composing/ComponentCollection.cs
+++ b/src/Umbraco.Core/Composing/ComponentCollection.cs
@@ -51,7 +51,7 @@ namespace Umbraco.Core.Composing
}
catch (Exception ex)
{
- _logger.Error(ex, "Error while terminating component {ComponentType}.", componentType.FullName);
+ _logger.Error(ex, "Error while terminating component {ComponentType}.", componentType.FullName);
}
}
}
diff --git a/src/Umbraco.Core/Composing/Composers.cs b/src/Umbraco.Core/Composing/Composers.cs
index b2e6c9d068..1528c6760d 100644
--- a/src/Umbraco.Core/Composing/Composers.cs
+++ b/src/Umbraco.Core/Composing/Composers.cs
@@ -114,7 +114,7 @@ namespace Umbraco.Core.Composing
// bit verbose but should help for troubleshooting
//var text = "Ordered Composers: " + Environment.NewLine + string.Join(Environment.NewLine, sortedComposerTypes) + Environment.NewLine;
- _logger.Debug("Ordered Composers: {SortedComposerTypes}", sortedComposerTypes);
+ _logger.Debug>("Ordered Composers: {SortedComposerTypes}", sortedComposerTypes);
return sortedComposerTypes;
}
@@ -205,7 +205,7 @@ namespace Umbraco.Core.Composing
catch (Exception e)
{
// in case of an error, force-dump everything to log
- _logger.Info("Composer Report:\r\n{ComposerReport}", GetComposersReport(requirements));
+ _logger.Info("Composer Report:\r\n{ComposerReport}", GetComposersReport(requirements));
_logger.Error(e, "Failed to sort composers.");
throw;
}
diff --git a/src/Umbraco.Core/Composing/TypeFinder.cs b/src/Umbraco.Core/Composing/TypeFinder.cs
index 394d9480ae..5bf9eb89a9 100644
--- a/src/Umbraco.Core/Composing/TypeFinder.cs
+++ b/src/Umbraco.Core/Composing/TypeFinder.cs
@@ -11,7 +11,7 @@ using System.Web.Compilation;
using System.Web.Hosting;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
-
+using Umbraco.Core.Logging;
namespace Umbraco.Core.Composing
{
///
@@ -441,7 +441,7 @@ namespace Umbraco.Core.Composing
}
catch (TypeLoadException ex)
{
- Current.Logger.Error(typeof(TypeFinder), ex, "Could not query types on {Assembly} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", assembly);
+ Current.Logger.Error(typeof(TypeFinder), ex, "Could not query types on {Assembly} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", assembly);
continue;
}
@@ -507,7 +507,7 @@ namespace Umbraco.Core.Composing
}
catch (TypeLoadException ex)
{
- Current.Logger.Error(typeof(TypeFinder), ex, "Could not query types on {Assembly} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", assembly);
+ Current.Logger.Error(typeof(TypeFinder), ex, "Could not query types on {Assembly} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", assembly);
continue;
}
diff --git a/src/Umbraco.Core/Composing/TypeLoader.cs b/src/Umbraco.Core/Composing/TypeLoader.cs
index 6d0b1a0514..bee6436cd6 100644
--- a/src/Umbraco.Core/Composing/TypeLoader.cs
+++ b/src/Umbraco.Core/Composing/TypeLoader.cs
@@ -1,8 +1,9 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
+using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading;
@@ -44,7 +45,7 @@ namespace Umbraco.Core.Composing
private IEnumerable _assemblies;
private bool _reportedChange;
private readonly string _localTempPath;
- private string _fileBasePath;
+ private readonly Lazy _fileBasePath;
///
/// Initializes a new instance of the class.
@@ -69,6 +70,8 @@ namespace Umbraco.Core.Composing
_localTempPath = localTempPath;
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
+ _fileBasePath = new Lazy(GetFileBasePath);
+
if (detectChanges)
{
//first check if the cached hash is string.Empty, if it is then we need
@@ -159,7 +162,8 @@ namespace Umbraco.Core.Composing
return _cachedAssembliesHash;
var typesHashFilePath = GetTypesHashFilePath();
- if (!File.Exists(typesHashFilePath)) return string.Empty;
+ if (!File.Exists(typesHashFilePath))
+ return string.Empty;
var hash = File.ReadAllText(typesHashFilePath, Encoding.UTF8);
@@ -338,7 +342,9 @@ namespace Umbraco.Core.Composing
var typesListFilePath = GetTypesListFilePath();
if (File.Exists(typesListFilePath) == false)
+ {
return cache;
+ }
using (var stream = GetFileStream(typesListFilePath, FileMode.Open, FileAccess.Read, FileShare.Read, ListFileOpenReadTimeout))
using (var reader = new StreamReader(stream))
@@ -346,11 +352,21 @@ namespace Umbraco.Core.Composing
while (true)
{
var baseType = reader.ReadLine();
- if (baseType == null) return cache; // exit
- if (baseType.StartsWith("<")) break; // old xml
+ if (baseType == null)
+ {
+ return cache; // exit
+ }
+
+ if (baseType.StartsWith("<"))
+ {
+ break; // old xml
+ }
var attributeType = reader.ReadLine();
- if (attributeType == null) break;
+ if (attributeType == null)
+ {
+ break;
+ }
var types = new List();
while (true)
@@ -369,7 +385,10 @@ namespace Umbraco.Core.Composing
types.Add(type);
}
- if (types == null) break;
+ if (types == null)
+ {
+ break;
+ }
}
}
@@ -378,28 +397,31 @@ namespace Umbraco.Core.Composing
}
// internal for tests
- internal string GetTypesListFilePath() => GetFileBasePath() + ".list";
+ internal string GetTypesListFilePath() => _fileBasePath.Value + ".list";
- private string GetTypesHashFilePath() => GetFileBasePath() + ".hash";
+ private string GetTypesHashFilePath() => _fileBasePath.Value + ".hash";
+ ///
+ /// Used to produce the Lazy value of _fileBasePath
+ ///
+ ///
private string GetFileBasePath()
{
- lock (_locko)
+ var fileBasePath = Path.Combine(_localTempPath, "TypesCache", "umbraco-types." + NetworkHelper.FileSafeMachineName);
+
+ // ensure that the folder exists
+ var directory = Path.GetDirectoryName(fileBasePath);
+ if (directory == null)
{
- if (_fileBasePath != null)
- return _fileBasePath;
-
- _fileBasePath = Path.Combine(_localTempPath, "TypesCache", "umbraco-types." + NetworkHelper.FileSafeMachineName);
-
- // ensure that the folder exists
- var directory = Path.GetDirectoryName(_fileBasePath);
- if (directory == null)
- throw new InvalidOperationException($"Could not determine folder for path \"{_fileBasePath}\".");
- if (Directory.Exists(directory) == false)
- Directory.CreateDirectory(directory);
-
- return _fileBasePath;
+ throw new InvalidOperationException($"Could not determine folder for path \"{fileBasePath}\".");
}
+
+ if (Directory.Exists(directory) == false)
+ {
+ Directory.CreateDirectory(directory);
+ }
+
+ return fileBasePath;
}
// internal for tests
@@ -415,7 +437,10 @@ namespace Umbraco.Core.Composing
writer.WriteLine(typeList.BaseType == null ? string.Empty : typeList.BaseType.FullName);
writer.WriteLine(typeList.AttributeType == null ? string.Empty : typeList.AttributeType.FullName);
foreach (var type in typeList.Types)
+ {
writer.WriteLine(type.AssemblyQualifiedName);
+ }
+
writer.WriteLine();
}
}
@@ -433,16 +458,22 @@ namespace Umbraco.Core.Composing
WriteCache();
}
catch { /* bah - just don't die */ }
- if (!_timing) _timer = null;
+ if (!_timing)
+ _timer = null;
}
}
lock (_timerLock)
{
if (_timer == null)
+ {
_timer = new Timer(TimerRelease, null, ListFileWriteThrottle, Timeout.Infinite);
+ }
else
+ {
_timer.Change(ListFileWriteThrottle, Timeout.Infinite);
+ }
+
_timing = true;
}
}
@@ -475,9 +506,11 @@ namespace Umbraco.Core.Composing
catch
{
if (--attempts == 0)
+ {
throw;
+ }
- _logger.Debug("Attempted to get filestream for file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds);
+ _logger.Debug("Attempted to get filestream for file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds);
Thread.Sleep(pauseMilliseconds);
}
}
@@ -498,7 +531,7 @@ namespace Umbraco.Core.Composing
if (--attempts == 0)
throw;
- _logger.Debug("Attempted to delete file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds);
+ _logger.Debug("Attempted to delete file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds);
Thread.Sleep(pauseMilliseconds);
}
}
@@ -542,7 +575,8 @@ namespace Umbraco.Core.Composing
/// attributeTypes
public IEnumerable GetAssemblyAttributes(params Type[] attributeTypes)
{
- if (attributeTypes == null) throw new ArgumentNullException(nameof(attributeTypes));
+ if (attributeTypes == null)
+ throw new ArgumentNullException(nameof(attributeTypes));
return AssembliesToScan.SelectMany(a => attributeTypes.SelectMany(at => a.GetCustomAttributes(at))).ToList();
}
@@ -562,7 +596,9 @@ namespace Umbraco.Core.Composing
public IEnumerable GetTypes(bool cache = true, IEnumerable specificAssemblies = null)
{
if (_logger == null)
+ {
throw new InvalidOperationException("Cannot get types from a test/blank type loader.");
+ }
// do not cache anything from specific assemblies
cache &= specificAssemblies == null;
@@ -571,7 +607,7 @@ namespace Umbraco.Core.Composing
if (!typeof(IDiscoverable).IsAssignableFrom(typeof(T)))
{
// warn
- _logger.Debug("Running a full, " + (cache ? "" : "non-") + "cached, scan for non-discoverable type {TypeName} (slow).", typeof(T).FullName);
+ _logger.Debug("Running a full, " + (cache ? "" : "non-") + "cached, scan for non-discoverable type {TypeName} (slow).", typeof(T).FullName);
return GetTypesInternal(
typeof(T), null,
@@ -582,20 +618,20 @@ namespace Umbraco.Core.Composing
// get IDiscoverable and always cache
var discovered = GetTypesInternal(
- typeof (IDiscoverable), null,
+ typeof(IDiscoverable), null,
() => TypeFinder.FindClassesOfType(AssembliesToScan),
"scanning assemblies",
true);
// warn
if (!cache)
- _logger.Debug("Running a non-cached, filter for discoverable type {TypeName} (slowish).", typeof(T).FullName);
+ _logger.Debug("Running a non-cached, filter for discoverable type {TypeName} (slowish).", typeof(T).FullName);
// filter the cached discovered types (and maybe cache the result)
return GetTypesInternal(
- typeof (T), null,
+ typeof(T), null,
() => discovered
- .Where(x => typeof (T).IsAssignableFrom(x)),
+ .Where(x => typeof(T).IsAssignableFrom(x)),
"filtering IDiscoverable",
cache);
}
@@ -613,7 +649,9 @@ namespace Umbraco.Core.Composing
where TAttribute : Attribute
{
if (_logger == null)
+ {
throw new InvalidOperationException("Cannot get types from a test/blank type loader.");
+ }
// do not cache anything from specific assemblies
cache &= specificAssemblies == null;
@@ -621,7 +659,7 @@ namespace Umbraco.Core.Composing
// if not IDiscoverable, directly get types
if (!typeof(IDiscoverable).IsAssignableFrom(typeof(T)))
{
- _logger.Debug("Running a full, " + (cache ? "" : "non-") + "cached, scan for non-discoverable type {TypeName} / attribute {AttributeName} (slow).", typeof(T).FullName, typeof(TAttribute).FullName);
+ _logger.Debug("Running a full, " + (cache ? "" : "non-") + "cached, scan for non-discoverable type {TypeName} / attribute {AttributeName} (slow).", typeof(T).FullName, typeof(TAttribute).FullName);
return GetTypesInternal(
typeof(T), typeof(TAttribute),
@@ -632,18 +670,18 @@ namespace Umbraco.Core.Composing
// get IDiscoverable and always cache
var discovered = GetTypesInternal(
- typeof (IDiscoverable), null,
+ typeof(IDiscoverable), null,
() => TypeFinder.FindClassesOfType(AssembliesToScan),
"scanning assemblies",
true);
// warn
if (!cache)
- _logger.Debug("Running a non-cached, filter for discoverable type {TypeName} / attribute {AttributeName} (slowish).", typeof(T).FullName, typeof(TAttribute).FullName);
+ _logger.Debug("Running a non-cached, filter for discoverable type {TypeName} / attribute {AttributeName} (slowish).", typeof(T).FullName, typeof(TAttribute).FullName);
// filter the cached discovered types (and maybe cache the result)
return GetTypesInternal(
- typeof (T), typeof (TAttribute),
+ typeof(T), typeof(TAttribute),
() => discovered
.Where(x => typeof(T).IsAssignableFrom(x))
.Where(x => x.GetCustomAttributes(false).Any()),
@@ -663,16 +701,18 @@ namespace Umbraco.Core.Composing
where TAttribute : Attribute
{
if (_logger == null)
+ {
throw new InvalidOperationException("Cannot get types from a test/blank type loader.");
+ }
// do not cache anything from specific assemblies
cache &= specificAssemblies == null;
if (!cache)
- _logger.Debug("Running a full, non-cached, scan for types / attribute {AttributeName} (slow).", typeof(TAttribute).FullName);
+ _logger.Debug("Running a full, non-cached, scan for types / attribute {AttributeName} (slow).", typeof(TAttribute).FullName);
return GetTypesInternal(
- typeof (object), typeof (TAttribute),
+ typeof(object), typeof(TAttribute),
() => TypeFinder.FindClassesWithAttribute(specificAssemblies ?? AssembliesToScan),
"scanning assemblies",
cache);
@@ -692,12 +732,14 @@ namespace Umbraco.Core.Composing
var name = GetName(baseType, attributeType);
lock (_locko)
- using (_logger.DebugDuration(
+ {
+ using (_logger.DebugDuration(
"Getting " + name,
"Got " + name)) // cannot contain typesFound.Count as it's evaluated before the find
- {
- // get within a lock & timer
- return GetTypesInternalLocked(baseType, attributeType, finder, action, cache);
+ {
+ // get within a lock & timer
+ return GetTypesInternalLocked(baseType, attributeType, finder, action, cache);
+ }
}
}
@@ -719,13 +761,15 @@ namespace Umbraco.Core.Composing
var listKey = new CompositeTypeTypeKey(baseType ?? tobject, attributeType ?? tobject);
TypeList typeList = null;
if (cache)
+ {
_types.TryGetValue(listKey, out typeList); // else null
+ }
// if caching and found, return
if (typeList != null)
{
// need to put some logging here to try to figure out why this is happening: http://issues.umbraco.org/issue/U4-3505
- _logger.Debug("Getting {TypeName}: found a cached type list.", GetName(baseType, attributeType));
+ _logger.Debug("Getting {TypeName}: found a cached type list.", GetName(baseType, attributeType));
return typeList.Types;
}
@@ -756,7 +800,7 @@ namespace Umbraco.Core.Composing
// so in this instance there will never be a result.
if (cacheResult.Exception is CachedTypeNotFoundInFileException || cacheResult.Success == false)
{
- _logger.Debug("Getting {TypeName}: failed to load from cache file, must scan assemblies.", GetName(baseType, attributeType));
+ _logger.Debug("Getting {TypeName}: failed to load from cache file, must scan assemblies.", GetName(baseType, attributeType));
scan = true;
}
else
@@ -775,7 +819,7 @@ namespace Umbraco.Core.Composing
catch (Exception ex)
{
// in case of any exception, we have to exit, and revert to scanning
- _logger.Error(ex, "Getting {TypeName}: failed to load cache file type {CacheType}, reverting to scanning assemblies.", GetName(baseType, attributeType), type);
+ _logger.Error(ex, "Getting {TypeName}: failed to load cache file type {CacheType}, reverting to scanning assemblies.", GetName(baseType, attributeType), type);
scan = true;
break;
}
@@ -783,7 +827,7 @@ namespace Umbraco.Core.Composing
if (scan == false)
{
- _logger.Debug("Getting {TypeName}: loaded types from cache file.", GetName(baseType, attributeType));
+ _logger.Debug("Getting {TypeName}: loaded types from cache file.", GetName(baseType, attributeType));
}
}
}
@@ -791,10 +835,12 @@ namespace Umbraco.Core.Composing
if (scan)
{
// either we had to scan, or we could not get the types from the cache file - scan now
- _logger.Debug("Getting {TypeName}: " + action + ".", GetName(baseType, attributeType));
+ _logger.Debug("Getting {TypeName}: " + action + ".", GetName(baseType, attributeType));
foreach (var t in finder())
+ {
typeList.Add(t);
+ }
}
// if we are to cache the results, do so
@@ -806,14 +852,16 @@ namespace Umbraco.Core.Composing
_types[listKey] = typeList;
//if we are scanning then update the cache file
if (scan)
+ {
UpdateCache();
+ }
}
- _logger.Debug("Got {TypeName}, caching ({CacheType}).", GetName(baseType, attributeType), added.ToString().ToLowerInvariant());
+ _logger.Debug("Got {TypeName}, caching ({CacheType}).", GetName(baseType, attributeType), added.ToString().ToLowerInvariant());
}
else
{
- _logger.Debug("Got {TypeName}.", GetName(baseType, attributeType));
+ _logger.Debug("Got {TypeName}.", GetName(baseType, attributeType));
}
return typeList.Types;
diff --git a/src/Umbraco.Core/ConfigsExtensions.cs b/src/Umbraco.Core/ConfigsExtensions.cs
index d1672c6c7f..10594fc970 100644
--- a/src/Umbraco.Core/ConfigsExtensions.cs
+++ b/src/Umbraco.Core/ConfigsExtensions.cs
@@ -1,10 +1,10 @@
using System.IO;
using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Grid;
using Umbraco.Core.Configuration.HealthChecks;
using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Dashboards;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
@@ -48,6 +48,8 @@ namespace Umbraco.Core
configDir,
factory.GetInstance(),
factory.GetInstance().Debug));
+
+ configs.Add(() => new ContentDashboardSettings());
}
}
}
diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs
index 1d1ccaf7b4..c844abe75e 100644
--- a/src/Umbraco.Core/Configuration/GlobalSettings.cs
+++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs
@@ -6,7 +6,9 @@ using System.Web;
using System.Web.Configuration;
using System.Web.Hosting;
using System.Xml.Linq;
+using Umbraco.Core.Composing;
using Umbraco.Core.IO;
+using Umbraco.Core.Logging;
namespace Umbraco.Core.Configuration
{
@@ -23,6 +25,7 @@ namespace Umbraco.Core.Configuration
// TODO these should not be static
private static string _reservedPaths;
private static string _reservedUrls;
+ private static int _sqlWriteLockTimeOut;
//ensure the built on (non-changeable) reserved paths are there at all times
internal const string StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,"; //must end with a comma!
@@ -392,27 +395,47 @@ namespace Umbraco.Core.Configuration
}
}
-
///
/// An int value representing the time in milliseconds to lock the database for a write operation
///
///
- /// The default value is 1800 milliseconds
+ /// The default value is 5000 milliseconds
///
/// The timeout in milliseconds.
public int SqlWriteLockTimeOut
{
get
{
- try
+ if (_sqlWriteLockTimeOut != default) return _sqlWriteLockTimeOut;
+
+ var timeOut = GetSqlWriteLockTimeoutFromConfigFile(Current.Logger);
+
+ _sqlWriteLockTimeOut = timeOut;
+ return _sqlWriteLockTimeOut;
+ }
+ }
+
+ internal static int GetSqlWriteLockTimeoutFromConfigFile(ILogger logger)
+ {
+ var timeOut = 5000; // 5 seconds
+ var appSettingSqlWriteLockTimeOut = ConfigurationManager.AppSettings[Constants.AppSettings.SqlWriteLockTimeOut];
+ if (int.TryParse(appSettingSqlWriteLockTimeOut, out var configuredTimeOut))
+ {
+ // Only apply this setting if it's not excessively high or low
+ const int minimumTimeOut = 100;
+ const int maximumTimeOut = 20000;
+ if (configuredTimeOut >= minimumTimeOut && configuredTimeOut <= maximumTimeOut) // between 0.1 and 20 seconds
{
- return int.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.SqlWriteLockTimeOut]);
+ timeOut = configuredTimeOut;
}
- catch
+ else
{
- return 1800;
+ logger.Warn(
+ $"The `{Constants.AppSettings.SqlWriteLockTimeOut}` setting in web.config is not between the minimum of {minimumTimeOut} ms and maximum of {maximumTimeOut} ms, defaulting back to {timeOut}");
}
}
+
+ return timeOut;
}
}
}
diff --git a/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs b/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs
index d434da8c70..82f9bd2afe 100644
--- a/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs
+++ b/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs
@@ -43,7 +43,7 @@ namespace Umbraco.Core.Configuration.Grid
}
catch (Exception ex)
{
- _logger.Error(ex, "Could not parse the contents of grid.editors.config.js into a JSON array '{Json}", sourceString);
+ _logger.Error(ex, "Could not parse the contents of grid.editors.config.js into a JSON array '{Json}", sourceString);
}
}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs
index 3ebb632882..7c6ff4405f 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs
@@ -29,11 +29,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
internal InnerTextConfigurationElement MacroErrors => GetOptionalTextElement("MacroErrors", MacroErrorBehaviour.Inline);
[ConfigurationProperty("disallowedUploadFiles")]
- internal CommaDelimitedConfigurationElement DisallowedUploadFiles => GetOptionalDelimitedElement("disallowedUploadFiles", new[] {"ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd"});
+ internal CommaDelimitedConfigurationElement DisallowedUploadFiles => GetOptionalDelimitedElement("disallowedUploadFiles", new[] {"ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd", "xamlx"});
[ConfigurationProperty("allowedUploadFiles")]
internal CommaDelimitedConfigurationElement AllowedUploadFiles => GetOptionalDelimitedElement("allowedUploadFiles", new string[0]);
-
+
[ConfigurationProperty("showDeprecatedPropertyEditors")]
internal InnerTextConfigurationElement ShowDeprecatedPropertyEditors => GetOptionalTextElement("showDeprecatedPropertyEditors", false);
diff --git a/src/Umbraco.Core/Constants-AppSettings.cs b/src/Umbraco.Core/Constants-AppSettings.cs
index 0182034011..1f096ab9f9 100644
--- a/src/Umbraco.Core/Constants-AppSettings.cs
+++ b/src/Umbraco.Core/Constants-AppSettings.cs
@@ -110,6 +110,11 @@ namespace Umbraco.Core
///
public const string UseHttps = "Umbraco.Core.UseHttps";
+ ///
+ /// A true/false value indicating whether the content dashboard should be visible for all user groups.
+ ///
+ public const string AllowContentDashboardAccessToAllUsers = "Umbraco.Core.AllowContentDashboardAccessToAllUsers";
+
///
/// TODO: FILL ME IN
///
@@ -144,9 +149,6 @@ namespace Umbraco.Core
///
/// An int value representing the time in milliseconds to lock the database for a write operation
///
- ///
- /// The default value is 1800 milliseconds
- ///
public const string SqlWriteLockTimeOut = "Umbraco.Core.SqlWriteLockTimeOut";
}
}
diff --git a/src/Umbraco.Core/Constants-Icons.cs b/src/Umbraco.Core/Constants-Icons.cs
index 05213ed1c4..d5cc37c9a5 100644
--- a/src/Umbraco.Core/Constants-Icons.cs
+++ b/src/Umbraco.Core/Constants-Icons.cs
@@ -24,6 +24,26 @@
///
public const string DataType = "icon-autofill";
+ ///
+ /// System dictionary icon
+ ///
+ public const string Dictionary = "icon-book-alt";
+
+ ///
+ /// System generic folder icon
+ ///
+ public const string Folder = "icon-folder";
+
+ ///
+ /// System language icon
+ ///
+ public const string Language = "icon-globe";
+
+ ///
+ /// System logviewer icon
+ ///
+ public const string LogViewer = "icon-box-alt";
+
///
/// System list view icon
///
@@ -69,6 +89,11 @@
///
public const string MemberType = "icon-users";
+ ///
+ /// System packages icon
+ ///
+ public const string Packages = "icon-box";
+
///
/// System property editor icon
///
diff --git a/src/Umbraco.Core/Constants-PropertyEditors.cs b/src/Umbraco.Core/Constants-PropertyEditors.cs
index 90f5fbd0d0..87739469d1 100644
--- a/src/Umbraco.Core/Constants-PropertyEditors.cs
+++ b/src/Umbraco.Core/Constants-PropertyEditors.cs
@@ -51,6 +51,11 @@ namespace Umbraco.Core
///
public const string ColorPicker = "Umbraco.ColorPicker";
+ ///
+ /// EyeDropper Color Picker.
+ ///
+ public const string ColorPickerEyeDropper = "Umbraco.ColorPicker.EyeDropper";
+
///
/// Content Picker.
///
diff --git a/src/Umbraco.Core/Constants-Security.cs b/src/Umbraco.Core/Constants-Security.cs
index f900288ef5..2b6244debb 100644
--- a/src/Umbraco.Core/Constants-Security.cs
+++ b/src/Umbraco.Core/Constants-Security.cs
@@ -25,7 +25,7 @@ namespace Umbraco.Core
///
/// The name of the 'unknown' user.
///
- public const string UnknownUserName = "SYTEM";
+ public const string UnknownUserName = "SYSTEM";
public const string AdminGroupAlias = "admin";
public const string EditorGroupAlias = "editor";
diff --git a/src/Umbraco.Core/Constants-SvgSanitizer.cs b/src/Umbraco.Core/Constants-SvgSanitizer.cs
deleted file mode 100644
index c92b9f56c7..0000000000
--- a/src/Umbraco.Core/Constants-SvgSanitizer.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Collections.Generic;
-
-namespace Umbraco.Core
-{
- public static partial class Constants
- {
- ///
- /// Defines the alias identifiers for Umbraco's core application sections.
- ///
- public static class SvgSanitizer
- {
- ///
- /// Allowlist for SVG attributes.
- ///
- public static readonly IList Attributes = new [] { "accent-height", "accumulate", "additive", "alignment-baseline", "allowReorder", "alphabetic", "amplitude", "arabic-form", "ascent", "attributeName", "attributeType", "autoReverse", "azimuth", "baseFrequency", "baseline-shift", "baseProfile", "bbox", "begin", "bias", "by", "calcMode", "cap-height", "class", "clip", "clipPathUnits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "contentScriptType", "contentStyleType", "cursor", "cx", "cy", "d", "decelerate", "descent", "diffuseConstant", "direction", "display", "divisor", "dominant-baseline", "dur", "dx", "dy", "edgeMode", "elevation", "enable-background", "end", "exponent", "externalResourcesRequired", "Section", "fill", "fill-opacity", "fill-rule", "filter", "filterRes", "filterUnits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "format", "from", "fr", "fx", "fy", "g1", "g2", "glyph-name", "glyph-orientation-horizontal", "glyph-orientation-vertical", "glyphRef", "gradientTransform", "gradientUnits", "hanging", "height", "href", "hreflang", "horiz-adv-x", "horiz-origin-x", "ISection", "id", "ideographic", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kernelMatrix", "kernelUnitLength", "kerning", "keyPoints", "keySplines", "keyTimes", "lang", "lengthAdjust", "letter-spacing", "lighting-color", "limitingConeAngle", "local", "MSection", "marker-end", "marker-mid", "marker-start", "markerHeight", "markerUnits", "markerWidth", "mask", "maskContentUnits", "maskUnits", "mathematical", "max", "media", "method", "min", "mode", "NSection", "name", "numOctaves", "offset", "opacity", "operator", "order", "orient", "orientation", "origin", "overflow", "overline-position", "overline-thickness", "panose-1", "paint-order", "path", "pathLength", "patternContentUnits", "patternTransform", "patternUnits", "ping", "pointer-events", "points", "pointsAtX", "pointsAtY", "pointsAtZ", "preserveAlpha", "preserveAspectRatio", "primitiveUnits", "r", "radius", "referrerPolicy", "refX", "refY", "rel", "rendering-intent", "repeatCount", "repeatDur", "requiredExtensions", "requiredFeatures", "restart", "result", "rotate", "rx", "ry", "scale", "seed", "shape-rendering", "slope", "spacing", "specularConstant", "specularExponent", "speed", "spreadMethod", "startOffset", "stdDeviation", "stemh", "stemv", "stitchTiles", "stop-color", "stop-opacity", "strikethrough-position", "strikethrough-thickness", "string", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "style", "surfaceScale", "systemLanguage", "tabindex", "tableValues", "target", "targetX", "targetY", "text-anchor", "text-decoration", "text-rendering", "textLength", "to", "transform", "type", "u1", "u2", "underline-position", "underline-thickness", "unicode", "unicode-bidi", "unicode-range", "units-per-em", "v-alphabetic", "v-hanging", "v-ideographic", "v-mathematical", "values", "vector-effect", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "viewBox", "viewTarget", "visibility", "width", "widths", "word-spacing", "writing-mode", "x", "x-height", "x1", "x2", "xChannelSelector", "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space", "y", "y1", "y2", "yChannelSelector", "z", "zoomAndPan" };
-
- ///
- /// Allowlist for SVG tabs.
- ///
- public static readonly IList Tags = new [] { "a", "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "discard", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hatch", "hatchpath", "hkern", "image", "line", "linearGradient", "marker", "mask", "mesh", "meshgradient", "meshpatch", "meshrow", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "set", "solidcolor", "stop", "svg", "switch", "symbol", "text", "textPath", "title", "tref", "tspan", "unknown", "use", "view", "vkern" };
- }
- }
-}
diff --git a/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs b/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs
new file mode 100644
index 0000000000..f8fb5c7b06
--- /dev/null
+++ b/src/Umbraco.Core/Dashboards/ContentDashboardSettings.cs
@@ -0,0 +1,24 @@
+using System.Configuration;
+
+namespace Umbraco.Core.Dashboards
+{
+ public class ContentDashboardSettings: IContentDashboardSettings
+ {
+
+ ///
+ /// Gets a value indicating whether the content dashboard should be available to all users.
+ ///
+ ///
+ /// true if the dashboard is visible for all user groups; otherwise, false
+ /// and the default access rules for that dashboard will be in use.
+ ///
+ public bool AllowContentDashboardAccessToAllUsers
+ {
+ get
+ {
+ bool.TryParse(ConfigurationManager.AppSettings[Constants.AppSettings.AllowContentDashboardAccessToAllUsers], out var value);
+ return value;
+ }
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs b/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs
new file mode 100644
index 0000000000..862a28b90e
--- /dev/null
+++ b/src/Umbraco.Core/Dashboards/IContentDashboardSettings.cs
@@ -0,0 +1,14 @@
+namespace Umbraco.Core.Dashboards
+{
+ public interface IContentDashboardSettings
+ {
+ ///
+ /// Gets a value indicating whether the content dashboard should be available to all users.
+ ///
+ ///
+ /// true if the dashboard is visible for all user groups; otherwise, false
+ /// and the default access rules for that dashboard will be in use.
+ ///
+ bool AllowContentDashboardAccessToAllUsers { get; }
+ }
+}
diff --git a/src/Umbraco.Core/IO/FileSystemWrapper.cs b/src/Umbraco.Core/IO/FileSystemWrapper.cs
index 14d028c16d..3091a645d5 100644
--- a/src/Umbraco.Core/IO/FileSystemWrapper.cs
+++ b/src/Umbraco.Core/IO/FileSystemWrapper.cs
@@ -23,94 +23,94 @@ namespace Umbraco.Core.IO
internal IFileSystem InnerFileSystem { get; set; }
- public IEnumerable GetDirectories(string path)
+ public virtual IEnumerable GetDirectories(string path)
{
return InnerFileSystem.GetDirectories(path);
}
- public void DeleteDirectory(string path)
+ public virtual void DeleteDirectory(string path)
{
InnerFileSystem.DeleteDirectory(path);
}
- public void DeleteDirectory(string path, bool recursive)
+ public virtual void DeleteDirectory(string path, bool recursive)
{
InnerFileSystem.DeleteDirectory(path, recursive);
}
- public bool DirectoryExists(string path)
+ public virtual bool DirectoryExists(string path)
{
return InnerFileSystem.DirectoryExists(path);
}
- public void AddFile(string path, Stream stream)
+ public virtual void AddFile(string path, Stream stream)
{
InnerFileSystem.AddFile(path, stream);
}
- public void AddFile(string path, Stream stream, bool overrideExisting)
+ public virtual void AddFile(string path, Stream stream, bool overrideExisting)
{
InnerFileSystem.AddFile(path, stream, overrideExisting);
}
- public IEnumerable GetFiles(string path)
+ public virtual IEnumerable GetFiles(string path)
{
return InnerFileSystem.GetFiles(path);
}
- public IEnumerable GetFiles(string path, string filter)
+ public virtual IEnumerable GetFiles(string path, string filter)
{
return InnerFileSystem.GetFiles(path, filter);
}
- public Stream OpenFile(string path)
+ public virtual Stream OpenFile(string path)
{
return InnerFileSystem.OpenFile(path);
}
- public void DeleteFile(string path)
+ public virtual void DeleteFile(string path)
{
InnerFileSystem.DeleteFile(path);
}
- public bool FileExists(string path)
+ public virtual bool FileExists(string path)
{
return InnerFileSystem.FileExists(path);
}
- public string GetRelativePath(string fullPathOrUrl)
+ public virtual string GetRelativePath(string fullPathOrUrl)
{
return InnerFileSystem.GetRelativePath(fullPathOrUrl);
}
- public string GetFullPath(string path)
+ public virtual string GetFullPath(string path)
{
return InnerFileSystem.GetFullPath(path);
}
- public string GetUrl(string path)
+ public virtual string GetUrl(string path)
{
return InnerFileSystem.GetUrl(path);
}
- public DateTimeOffset GetLastModified(string path)
+ public virtual DateTimeOffset GetLastModified(string path)
{
return InnerFileSystem.GetLastModified(path);
}
- public DateTimeOffset GetCreated(string path)
+ public virtual DateTimeOffset GetCreated(string path)
{
return InnerFileSystem.GetCreated(path);
}
- public long GetSize(string path)
+ public virtual long GetSize(string path)
{
return InnerFileSystem.GetSize(path);
}
- public bool CanAddPhysical => InnerFileSystem.CanAddPhysical;
+ public virtual bool CanAddPhysical => InnerFileSystem.CanAddPhysical;
- public void AddFile(string path, string physicalPath, bool overrideIfExists = true, bool copy = false)
+ public virtual void AddFile(string path, string physicalPath, bool overrideIfExists = true, bool copy = false)
{
InnerFileSystem.AddFile(path, physicalPath, overrideIfExists, copy);
}
diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs
index 8906752dd1..3b05adb20f 100644
--- a/src/Umbraco.Core/IO/FileSystems.cs
+++ b/src/Umbraco.Core/IO/FileSystems.cs
@@ -225,7 +225,7 @@ namespace Umbraco.Core.IO
_shadowCurrentId = id;
- _logger.Debug("Shadow '{ShadowId}'", _shadowCurrentId);
+ _logger.Debug("Shadow '{ShadowId}'", _shadowCurrentId);
foreach (var wrapper in _shadowWrappers)
wrapper.Shadow(_shadowCurrentId);
@@ -242,7 +242,7 @@ namespace Umbraco.Core.IO
if (id != _shadowCurrentId)
throw new InvalidOperationException("Not the current shadow.");
- _logger.Debug("UnShadow '{ShadowId}' {Status}", id, completed ? "complete" : "abort");
+ _logger.Debug("UnShadow '{ShadowId}' {Status}", id, completed ? "complete" : "abort");
var exceptions = new List();
foreach (var wrapper in _shadowWrappers)
diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs
index 8661f73fb1..69ce50de9c 100644
--- a/src/Umbraco.Core/IO/IOHelper.cs
+++ b/src/Umbraco.Core/IO/IOHelper.cs
@@ -81,6 +81,7 @@ namespace Umbraco.Core.IO
public static string MapPath(string path, bool useHttpContext)
{
if (path == null) throw new ArgumentNullException("path");
+
useHttpContext = useHttpContext && IsHosted;
// Check if the path is already mapped
@@ -89,10 +90,8 @@ namespace Umbraco.Core.IO
{
return path;
}
- // Check that we even have an HttpContext! otherwise things will fail anyways
- // http://umbraco.codeplex.com/workitem/30946
- if (useHttpContext && HttpContext.Current != null)
+ if (useHttpContext)
{
//string retval;
if (String.IsNullOrEmpty(path) == false && (path.StartsWith("~") || path.StartsWith(SystemDirectories.Root)))
diff --git a/src/Umbraco.Core/IO/MediaFileSystem.cs b/src/Umbraco.Core/IO/MediaFileSystem.cs
index 05c02171ba..6743275be0 100644
--- a/src/Umbraco.Core/IO/MediaFileSystem.cs
+++ b/src/Umbraco.Core/IO/MediaFileSystem.cs
@@ -51,7 +51,7 @@ namespace Umbraco.Core.IO
}
catch (Exception e)
{
- _logger.Error(e, "Failed to delete media file '{File}'.", file);
+ _logger.Error(e, "Failed to delete media file '{File}'.", file);
}
});
}
diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs
index a833ba43af..5ebe6817e5 100644
--- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs
+++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs
@@ -74,11 +74,11 @@ namespace Umbraco.Core.IO
}
catch (UnauthorizedAccessException ex)
{
- Current.Logger.Error(ex, "Not authorized to get directories for '{Path}'", fullPath);
+ Current.Logger.Error(ex, "Not authorized to get directories for '{Path}'", fullPath);
}
catch (DirectoryNotFoundException ex)
{
- Current.Logger.Error(ex, "Directory not found for '{Path}'", fullPath);
+ Current.Logger.Error(ex, "Directory not found for '{Path}'", fullPath);
}
return Enumerable.Empty();
@@ -110,7 +110,7 @@ namespace Umbraco.Core.IO
}
catch (DirectoryNotFoundException ex)
{
- Current.Logger.Error(ex, "Directory not found for '{Path}'", fullPath);
+ Current.Logger.Error(ex, "Directory not found for '{Path}'", fullPath);
}
}
@@ -190,11 +190,11 @@ namespace Umbraco.Core.IO
}
catch (UnauthorizedAccessException ex)
{
- Current.Logger.Error(ex, "Not authorized to get directories for '{Path}'", fullPath);
+ Current.Logger.Error(ex, "Not authorized to get directories for '{Path}'", fullPath);
}
catch (DirectoryNotFoundException ex)
{
- Current.Logger.Error(ex, "Directory not found for '{FullPath}'", fullPath);
+ Current.Logger.Error(ex, "Directory not found for '{FullPath}'", fullPath);
}
return Enumerable.Empty();
@@ -227,7 +227,7 @@ namespace Umbraco.Core.IO
}
catch (FileNotFoundException ex)
{
- Current.Logger.Error(ex.InnerException, "DeleteFile failed with FileNotFoundException for '{Path}'", fullPath);
+ Current.Logger.Error(ex.InnerException, "DeleteFile failed with FileNotFoundException for '{Path}'", fullPath);
}
}
diff --git a/src/Umbraco.Core/IO/SystemDirectories.cs b/src/Umbraco.Core/IO/SystemDirectories.cs
index 485fd7f965..9d09bf2f0d 100644
--- a/src/Umbraco.Core/IO/SystemDirectories.cs
+++ b/src/Umbraco.Core/IO/SystemDirectories.cs
@@ -25,6 +25,8 @@ namespace Umbraco.Core.IO
public static string AppPlugins => "~/App_Plugins";
+ public static string AppPluginIcons => "/Backoffice/Icons";
+
public static string MvcViews => "~/Views";
public static string PartialViews => MvcViews + "/Partials/";
diff --git a/src/Umbraco.Core/Logging/DebugDiagnosticsLogger.cs b/src/Umbraco.Core/Logging/DebugDiagnosticsLogger.cs
index d1bde55306..8f26f7e75c 100644
--- a/src/Umbraco.Core/Logging/DebugDiagnosticsLogger.cs
+++ b/src/Umbraco.Core/Logging/DebugDiagnosticsLogger.cs
@@ -129,5 +129,65 @@ namespace Umbraco.Core.Logging
{
System.Diagnostics.Debug.WriteLine(MessageTemplates.Render(messageTemplate, propertyValues), reporting.FullName);
}
+ ///
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0,
+ T1 propertyValue1, T2 propertyValue2)
+ => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 });
+ ///
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 });
+ ///
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0 });
+ ///
+ public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0,
+ T1 propertyValue1, T2 propertyValue2)
+ => Error(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 });
+ ///
+ public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Error(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 });
+ ///
+ public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ => Error(reporting, exception, messageTemplate, new object[] { propertyValue0 });
+ ///
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0,
+ T1 propertyValue1, T2 propertyValue2)
+ => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1,propertyValue2 });
+ ///
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 });
+
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0 });
+
+ public void Warn(Type reporting, string message, T0 propertyValue0)
+ => Warn(reporting, message, new object[] { propertyValue0 });
+
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ => Info(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 });
+
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Info(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 });
+
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0)
+ => Info(reporting, messageTemplate, new object[] { propertyValue0 });
+
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ => Debug(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 });
+
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Debug(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 });
+
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0)
+ => Debug(reporting, messageTemplate, new object[] { propertyValue0 });
+
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ => Verbose(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1,propertyValue2 });
+
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Verbose(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 });
+
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0)
+ => Verbose(reporting, messageTemplate, new object[] { propertyValue0 });
}
}
diff --git a/src/Umbraco.Core/Logging/DisposableTimer.cs b/src/Umbraco.Core/Logging/DisposableTimer.cs
index ed98e5cfab..63ae3c2792 100644
--- a/src/Umbraco.Core/Logging/DisposableTimer.cs
+++ b/src/Umbraco.Core/Logging/DisposableTimer.cs
@@ -37,10 +37,10 @@ namespace Umbraco.Core.Logging
switch (_level)
{
case LogLevel.Debug:
- logger.Debug(loggerType, "{StartMessage} [Timing {TimingId}]", startMessage, _timingId);
+ logger.Debug(loggerType, "{StartMessage} [Timing {TimingId}]", startMessage, _timingId);
break;
case LogLevel.Information:
- logger.Info(loggerType, "{StartMessage} [Timing {TimingId}]", startMessage, _timingId);
+ logger.Info(loggerType, "{StartMessage} [Timing {TimingId}]", startMessage, _timingId);
break;
default:
throw new ArgumentOutOfRangeException(nameof(level));
@@ -84,15 +84,15 @@ namespace Umbraco.Core.Logging
{
if (_failed)
{
- _logger.Error(_loggerType, _failException, "{FailMessage} ({Duration}ms) [Timing {TimingId}]", _failMessage, Stopwatch.ElapsedMilliseconds, _timingId);
+ _logger.Error(_loggerType, _failException, "{FailMessage} ({Duration}ms) [Timing {TimingId}]", _failMessage, Stopwatch.ElapsedMilliseconds, _timingId);
}
else switch (_level)
{
case LogLevel.Debug:
- _logger.Debug(_loggerType, "{EndMessage} ({Duration}ms) [Timing {TimingId}]", _endMessage, Stopwatch.ElapsedMilliseconds, _timingId);
+ _logger.Debug(_loggerType, "{EndMessage} ({Duration}ms) [Timing {TimingId}]", _endMessage, Stopwatch.ElapsedMilliseconds, _timingId);
break;
case LogLevel.Information:
- _logger.Info(_loggerType, "{EndMessage} ({Duration}ms) [Timing {TimingId}]", _endMessage, Stopwatch.ElapsedMilliseconds, _timingId);
+ _logger.Info(_loggerType, "{EndMessage} ({Duration}ms) [Timing {TimingId}]", _endMessage, Stopwatch.ElapsedMilliseconds, _timingId);
break;
// filtered in the ctor
//default:
diff --git a/src/Umbraco.Core/Logging/ILogger.cs b/src/Umbraco.Core/Logging/ILogger.cs
index 4f49d0b3b4..d8272b6aa0 100644
--- a/src/Umbraco.Core/Logging/ILogger.cs
+++ b/src/Umbraco.Core/Logging/ILogger.cs
@@ -52,7 +52,7 @@ namespace Umbraco.Core.Logging
/// A message template.
/// Property values.
void Fatal(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues);
-
+
///
/// Logs a fatal message.
///
@@ -92,7 +92,7 @@ namespace Umbraco.Core.Logging
/// A message template.
/// Property values.
void Error(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues);
-
+
///
/// Logs an error message.
///
@@ -132,6 +132,7 @@ namespace Umbraco.Core.Logging
/// A message template.
/// Property values.
void Warn(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues);
+
///
/// Logs an information message.
@@ -147,6 +148,7 @@ namespace Umbraco.Core.Logging
/// A message template.
/// Property values.
void Info(Type reporting, string messageTemplate, params object[] propertyValues);
+
///
/// Logs a debugging message.
@@ -177,5 +179,6 @@ namespace Umbraco.Core.Logging
/// A message template.
/// Property values.
void Verbose(Type reporting, string messageTemplate, params object[] propertyValues);
+
}
}
diff --git a/src/Umbraco.Core/Logging/ILogger2.cs b/src/Umbraco.Core/Logging/ILogger2.cs
new file mode 100644
index 0000000000..0db8021f58
--- /dev/null
+++ b/src/Umbraco.Core/Logging/ILogger2.cs
@@ -0,0 +1,240 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Umbraco.Core.Logging
+{
+ public interface ILogger2 : ILogger
+ {
+ ///
+ /// Logs a fatal message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+ ///
+ /// Logs a fatal message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+ ///
+ /// Logs a fatal message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0);
+
+ ///
+ /// Logs an error message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+ ///
+ /// Logs an error message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+ ///
+ /// Logs an error message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0);
+
+ ///
+ /// Logs a warning message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+ ///
+ /// Logs a warning message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+ ///
+ /// Logs a warning message with an exception.
+ ///
+ /// The reporting type.
+ /// An exception.
+ /// A message template.
+ /// Property value 0
+ void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0);
+ ///
+ /// Logs a warning message with an exception.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ void Warn(Type reporting, string message, T0 propertyValue0);
+
+ ///
+ /// Logs a info message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+ ///
+ /// Logs a info message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+ ///
+ /// Logs a info message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ void Info(Type reporting, string messageTemplate, T0 propertyValue0);
+
+ ///
+ /// Logs a debug message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+ ///
+ /// Logs a debug message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+ ///
+ /// Logs a debug message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ void Debug(Type reporting, string messageTemplate, T0 propertyValue0);
+
+ ///
+ /// Logs a verbose message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+ ///
+ /// Logs a verbose message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+ ///
+ /// Logs a verbose message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ void Verbose(Type reporting, string messageTemplate, T0 propertyValue0);
+
+
+ ///
+ /// Logs a error message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ void Error(Type reporting, string messageTemplate, T0 propertyValue0);
+
+ ///
+ /// Logs a error message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Error(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+
+ ///
+ /// Logs a error message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Error(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+
+ ///
+ /// Logs a warning message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Warn(string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+ ///
+ /// Logs a warning message.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Warn(string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+ ///
+ /// Logs a warning message with an exception.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ /// Property value 2
+ void Warn(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2);
+ ///
+ /// Logs a warning message with an exception.
+ ///
+ /// The reporting type.
+ /// A message template.
+ /// Property value 0
+ /// Property value 1
+ void Warn(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1);
+ }
+}
diff --git a/src/Umbraco.Core/Logging/LogProfiler.cs b/src/Umbraco.Core/Logging/LogProfiler.cs
index 74dae545b4..c0f8d1b525 100644
--- a/src/Umbraco.Core/Logging/LogProfiler.cs
+++ b/src/Umbraco.Core/Logging/LogProfiler.cs
@@ -24,8 +24,8 @@ namespace Umbraco.Core.Logging
///
public IDisposable Step(string name)
{
- _logger.Debug("Begin: {ProfileName}", name);
- return new LightDisposableTimer(duration => _logger.Info("End {ProfileName} ({ProfileDuration}ms)", name, duration));
+ _logger.Debug("Begin: {ProfileName}", name);
+ return new LightDisposableTimer(duration => _logger.Info("End {ProfileName} ({ProfileDuration}ms)", name, duration));
}
///
diff --git a/src/Umbraco.Core/Logging/Logger2Extensions.cs b/src/Umbraco.Core/Logging/Logger2Extensions.cs
new file mode 100644
index 0000000000..c6c1352055
--- /dev/null
+++ b/src/Umbraco.Core/Logging/Logger2Extensions.cs
@@ -0,0 +1,442 @@
+using System;
+
+namespace Umbraco.Core.Logging
+{
+ public static class Logger2Extensions
+ {
+ public static void Debug(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Debug(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Debug(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+
+ public static void Debug(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Debug(reporting, messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Debug(reporting, messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+
+ public static void Debug(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Debug(reporting, messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Debug(reporting, messageTemplate, propertyValue0);
+ }
+ }
+
+ public static void Error(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+
+ public static void Error(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+
+ public static void Error(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(reporting, exception, messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Error(reporting, exception, messageTemplate, propertyValue0);
+ }
+ }
+
+ public static void Fatal(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+
+ public static void Fatal(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+
+ public static void Fatal(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Fatal(reporting, exception, messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Fatal(reporting, exception, messageTemplate, propertyValue0);
+ }
+ }
+
+ public static void Info(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Info(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Info(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+
+ public static void Info(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Info(reporting, messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Info(reporting, messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+
+ public static void Info(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Info(reporting, messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Info(reporting, messageTemplate, propertyValue0);
+ }
+ }
+
+ public static void Verbose(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+
+ public static void Verbose(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+
+ public static void Verbose(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Verbose(reporting, messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Verbose(reporting, messageTemplate, propertyValue0);
+ }
+ }
+
+ public static void Warn(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(reporting, messageTemplate, exception, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Warn(reporting, messageTemplate, exception, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+
+ public static void Warn(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(reporting, messageTemplate, exception, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Warn(reporting, messageTemplate, exception, propertyValue0, propertyValue1);
+ }
+ }
+
+ public static void Warn(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(reporting, messageTemplate, exception, propertyValue0);
+ }
+ else
+ {
+ logger.Warn(reporting, messageTemplate, exception, propertyValue0);
+ }
+ }
+
+ public static void Warn(this ILogger logger, Type reporting, string message, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(reporting, message, propertyValue0);
+ }
+ else
+ {
+ logger.Warn(reporting, message, propertyValue0);
+ }
+ }
+
+ //
+ public static void Error(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(typeof(T), exception, messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Error(typeof(T), exception, messageTemplate, propertyValue0);
+ }
+ }
+
+ public static void Error(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Error(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+
+ public static void Error(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Error(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+ public static void Error(this ILogger logger, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(typeof(T), messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Error(typeof(T), messageTemplate, propertyValue0);
+ }
+ }
+ public static void Error(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(typeof(T), messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Error(typeof(T), messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+ public static void Error(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Error(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Error(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+ public static void Warn(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(typeof(T), exception, messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Warn(typeof(T), exception, messageTemplate, propertyValue0);
+ }
+ }
+
+ public static void Warn(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Warn(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+
+ public static void Warn(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Warn(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+
+ public static void Warn(this ILogger logger, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(typeof(T), messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Warn(typeof(T), messageTemplate, propertyValue0);
+ }
+ }
+ public static void Warn(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(typeof(T), messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Warn(typeof(T), messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+ public static void Warn(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Warn(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Warn(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+
+
+ public static void Info(this ILogger logger, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Info(typeof(T), messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Info(typeof(T), messageTemplate, propertyValue0);
+ }
+ }
+ public static void Info(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Info(typeof(T), messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Info(typeof(T), messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+ public static void Info(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Info(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Info(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+ public static void Debug(this ILogger logger, string messageTemplate, T0 propertyValue0)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Debug(typeof(T), messageTemplate, propertyValue0);
+ }
+ else
+ {
+ logger.Debug(typeof(T), messageTemplate, propertyValue0);
+ }
+ }
+ public static void Debug(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Debug(typeof(T), messageTemplate, propertyValue0, propertyValue1);
+ }
+ else
+ {
+ logger.Debug(typeof(T), messageTemplate, propertyValue0, propertyValue1);
+ }
+ }
+ public static void Debug(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ if (logger is ILogger2 logger2)
+ {
+ logger2.Debug(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ else
+ {
+ logger.Debug(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Logging/OwinLogger.cs b/src/Umbraco.Core/Logging/OwinLogger.cs
index 5601cb53f2..7fc36e748c 100644
--- a/src/Umbraco.Core/Logging/OwinLogger.cs
+++ b/src/Umbraco.Core/Logging/OwinLogger.cs
@@ -26,34 +26,34 @@ namespace Umbraco.Core.Logging
switch (eventType)
{
case TraceEventType.Critical:
- _logger.Fatal(_type.Value, exception, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Fatal(_type.Value, exception, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Error:
- _logger.Error(_type.Value, exception, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Error(_type.Value, exception, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Warning:
_logger.Warn(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Information:
- _logger.Info(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Info(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Verbose:
- _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Start:
- _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Stop:
- _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Suspend:
- _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Resume:
- _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
case TraceEventType.Transfer:
- _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
+ _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state);
return true;
default:
throw new ArgumentOutOfRangeException("eventType");
diff --git a/src/Umbraco.Core/Logging/ProfilingLogger.cs b/src/Umbraco.Core/Logging/ProfilingLogger.cs
index d642926147..e49aaa26c6 100644
--- a/src/Umbraco.Core/Logging/ProfilingLogger.cs
+++ b/src/Umbraco.Core/Logging/ProfilingLogger.cs
@@ -127,6 +127,64 @@ namespace Umbraco.Core.Logging
public void Verbose(Type reporting, string messageTemplate, params object[] propertyValues)
=> Logger.Verbose(reporting, messageTemplate, propertyValues);
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0,
+ T1 propertyValue1, T2 propertyValue2)
+ => Logger.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Logger.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1);
+
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ => Logger.Fatal(reporting, exception, messageTemplate, propertyValue0);
+
+ public void Error(Type reporting, Exception exception, string messageTemplate,
+ T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ => Logger.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+
+ public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Logger.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1);
+
+ public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ => Logger.Error(reporting, exception, messageTemplate, propertyValue0);
+
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ => Logger.Warn(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Logger.Warn(reporting, exception, messageTemplate, propertyValue0, propertyValue1);
+
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ => Logger.Warn(reporting, exception, messageTemplate, propertyValue0);
+
+ public void Warn(Type reporting, string message, T0 propertyValue0) => Logger.Warn(reporting, message, propertyValue0);
+
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ => Logger.Info(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Logger.Info(reporting, messageTemplate, propertyValue0, propertyValue1);
+
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0)
+ => Logger.Info(reporting, messageTemplate, propertyValue0);
+
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ => Logger.Debug(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Logger.Debug(reporting, messageTemplate, propertyValue0, propertyValue1);
+
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0)
+ => Logger.Debug(reporting, messageTemplate, propertyValue0);
+
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ => Logger.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ => Logger.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1);
+
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0)
+ => Logger.Verbose(reporting, messageTemplate, propertyValue0);
+
#endregion
}
}
diff --git a/src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs b/src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs
index a51628030e..0f6121c1ee 100644
--- a/src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs
+++ b/src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs
@@ -118,6 +118,30 @@ namespace Umbraco.Core.Logging.Serilog
logger.Fatal(exception, messageTemplate, propertyValues);
}
+ ///
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Fatal, exception, ref messageTemplate);
+ logger.Fatal(exception, messageTemplate, propertyValue0);
+ }
+
+ ///
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Fatal, exception, ref messageTemplate);
+ logger.Fatal(exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+
+ ///
+ public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Fatal, exception, ref messageTemplate);
+ logger.Fatal(exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+
///
public void Error(Type reporting, Exception exception, string message)
{
@@ -154,6 +178,29 @@ namespace Umbraco.Core.Logging.Serilog
DumpThreadAborts(logger, LogEventLevel.Error, exception, ref messageTemplate);
logger.Error(exception, messageTemplate, propertyValues);
}
+ ///
+ public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Error, exception, ref messageTemplate);
+ logger.Error(exception, messageTemplate, propertyValue0);
+ }
+
+ ///
+ public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Error, exception, ref messageTemplate);
+ logger.Error(exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+
+ ///
+ public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Error, exception, ref messageTemplate);
+ logger.Error(exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
private static void DumpThreadAborts(global::Serilog.ILogger logger, LogEventLevel level, Exception exception, ref string messageTemplate)
{
@@ -224,6 +271,12 @@ namespace Umbraco.Core.Logging.Serilog
LoggerFor(reporting).Warning(message, propertyValues);
}
+ ///
+ public void Warn(Type reporting, string message, T0 propertyValue0)
+ {
+ LoggerFor(reporting).Warning(message, propertyValue0);
+ }
+
///
public void Warn(Type reporting, Exception exception, string message)
{
@@ -235,6 +288,29 @@ namespace Umbraco.Core.Logging.Serilog
{
LoggerFor(reporting).Warning(exception, messageTemplate, propertyValues);
}
+ ///
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Warning, exception, ref messageTemplate);
+ logger.Warning(exception, messageTemplate, propertyValue0);
+ }
+
+ ///
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Warning, exception, ref messageTemplate);
+ logger.Warning(exception, messageTemplate, propertyValue0, propertyValue1);
+ }
+
+ ///
+ public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ var logger = LoggerFor(reporting);
+ DumpThreadAborts(logger, LogEventLevel.Warning, exception, ref messageTemplate);
+ logger.Warning(exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
///
public void Info(Type reporting, string message)
@@ -248,6 +324,23 @@ namespace Umbraco.Core.Logging.Serilog
LoggerFor(reporting).Information(messageTemplate, propertyValues);
}
+
+ ///
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0)
+ {
+ LoggerFor(reporting).Information(messageTemplate, propertyValue0);
+ }
+ ///
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ LoggerFor(reporting).Information(messageTemplate, propertyValue0, propertyValue1);
+ }
+ ///
+ public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ LoggerFor(reporting).Information(messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+
///
public void Debug(Type reporting, string message)
{
@@ -259,6 +352,21 @@ namespace Umbraco.Core.Logging.Serilog
{
LoggerFor(reporting).Debug(messageTemplate, propertyValues);
}
+ ///
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0)
+ {
+ LoggerFor(reporting).Debug(messageTemplate, propertyValue0);
+ }
+ ///
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ LoggerFor(reporting).Debug(messageTemplate, propertyValue0, propertyValue1);
+ }
+ ///
+ public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ LoggerFor(reporting).Debug(messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
///
public void Verbose(Type reporting, string message)
@@ -272,6 +380,22 @@ namespace Umbraco.Core.Logging.Serilog
LoggerFor(reporting).Verbose(messageTemplate, propertyValues);
}
+ ///
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0)
+ {
+ LoggerFor(reporting).Verbose(messageTemplate, propertyValue0);
+ }
+ ///
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1)
+ {
+ LoggerFor(reporting).Verbose(messageTemplate, propertyValue0, propertyValue1);
+ }
+ ///
+ public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2)
+ {
+ LoggerFor(reporting).Verbose(messageTemplate, propertyValue0, propertyValue1, propertyValue2);
+ }
+
public void Dispose()
{
Log.CloseAndFlush();
diff --git a/src/Umbraco.Core/Manifest/DataEditorConverter.cs b/src/Umbraco.Core/Manifest/DataEditorConverter.cs
index 86982e17f2..efa9347edb 100644
--- a/src/Umbraco.Core/Manifest/DataEditorConverter.cs
+++ b/src/Umbraco.Core/Manifest/DataEditorConverter.cs
@@ -62,7 +62,7 @@ namespace Umbraco.Core.Manifest
PrepareForPropertyEditor(jobject, dataEditor);
else
PrepareForParameterEditor(jobject, dataEditor);
-
+
base.Deserialize(jobject, target, serializer);
}
@@ -86,26 +86,33 @@ namespace Umbraco.Core.Manifest
if (jobject["editor"]["validation"] is JObject validation)
jobject["editor"]["validation"] = RewriteValidators(validation);
- if (jobject["prevalues"] is JObject config)
+ var prevalues = jobject["prevalues"] as JObject;
+ var defaultConfig = jobject["defaultConfig"] as JObject;
+ if (prevalues != null || defaultConfig != null)
{
// explicitly assign a configuration editor of type ConfigurationEditor
// (else the deserializer will try to read it before setting it)
// (and besides it's an interface)
target.ExplicitConfigurationEditor = new ConfigurationEditor();
- // see note about validators, above - same applies to field validators
- if (config["fields"] is JArray jarray)
+ var config = new JObject();
+ if (prevalues != null)
{
- foreach (var field in jarray)
+ config = prevalues;
+ // see note about validators, above - same applies to field validators
+ if (config["fields"] is JArray jarray)
{
- if (field["validation"] is JObject fvalidation)
- field["validation"] = RewriteValidators(fvalidation);
+ foreach (var field in jarray)
+ {
+ if (field["validation"] is JObject fvalidation)
+ field["validation"] = RewriteValidators(fvalidation);
+ }
}
}
// in the manifest, default configuration is at editor level
// move it down to configuration editor level so it can be deserialized properly
- if (jobject["defaultConfig"] is JObject defaultConfig)
+ if (defaultConfig != null)
{
config["defaultConfig"] = defaultConfig;
jobject.Remove("defaultConfig");
diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs
index 1ecc738b95..9bbb0875d8 100644
--- a/src/Umbraco.Core/Manifest/ManifestParser.cs
+++ b/src/Umbraco.Core/Manifest/ManifestParser.cs
@@ -85,7 +85,7 @@ namespace Umbraco.Core.Manifest
}
catch (Exception e)
{
- _logger.Error(e, "Failed to parse manifest at '{Path}', ignoring.", path);
+ _logger.Error(e, "Failed to parse manifest at '{Path}', ignoring.", path);
}
}
diff --git a/src/Umbraco.Core/Manifest/ManifestWatcher.cs b/src/Umbraco.Core/Manifest/ManifestWatcher.cs
index 4c0ddbf822..6c195edb45 100644
--- a/src/Umbraco.Core/Manifest/ManifestWatcher.cs
+++ b/src/Umbraco.Core/Manifest/ManifestWatcher.cs
@@ -54,7 +54,7 @@ namespace Umbraco.Core.Manifest
if (_isRestarting) return;
_isRestarting = true;
- _logger.Info("Manifest has changed, app pool is restarting ({Path})", e.FullPath);
+ _logger.Info("Manifest has changed, app pool is restarting ({Path})", e.FullPath);
HttpRuntime.UnloadAppDomain();
Dispose(); // uh? if the app restarts then this should be disposed anyways?
}
diff --git a/src/Umbraco.Core/Mapping/UmbracoMapper.cs b/src/Umbraco.Core/Mapping/UmbracoMapper.cs
index e62825101c..36e3f9eab9 100644
--- a/src/Umbraco.Core/Mapping/UmbracoMapper.cs
+++ b/src/Umbraco.Core/Mapping/UmbracoMapper.cs
@@ -3,7 +3,9 @@ using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
+using Umbraco.Core.Composing;
using Umbraco.Core.Exceptions;
+using Umbraco.Core.Scoping;
namespace Umbraco.Core.Mapping
{
@@ -42,16 +44,29 @@ namespace Umbraco.Core.Mapping
private readonly ConcurrentDictionary>> _maps
= new ConcurrentDictionary>>();
+ private readonly IScopeProvider _scopeProvider;
+
///
/// Initializes a new instance of the class.
///
///
- public UmbracoMapper(MapDefinitionCollection profiles)
+ ///
+ public UmbracoMapper(MapDefinitionCollection profiles, IScopeProvider scopeProvider)
{
+ _scopeProvider = scopeProvider;
+
foreach (var profile in profiles)
profile.DefineMaps(this);
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ [Obsolete("This constructor is no longer used and will be removed in future versions, use the other constructor instead")]
+ public UmbracoMapper(MapDefinitionCollection profiles) : this(profiles, Current.ScopeProvider)
+ {}
+
#region Define
private static TTarget ThrowCtor(TSource source, MapperContext context)
@@ -203,7 +218,10 @@ namespace Umbraco.Core.Mapping
if (ctor != null && map != null)
{
var target = ctor(source, context);
- map(source, target, context);
+ using (var scope = _scopeProvider.CreateScope(autoComplete: true))
+ {
+ map(source, target, context);
+ }
return (TTarget)target;
}
@@ -248,11 +266,14 @@ namespace Umbraco.Core.Mapping
{
var targetList = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(targetGenericArg));
- foreach (var sourceItem in source)
+ using (var scope = _scopeProvider.CreateScope(autoComplete: true))
{
- var targetItem = ctor(sourceItem, context);
- map(sourceItem, targetItem, context);
- targetList.Add(targetItem);
+ foreach (var sourceItem in source)
+ {
+ var targetItem = ctor(sourceItem, context);
+ map(sourceItem, targetItem, context);
+ targetList.Add(targetItem);
+ }
}
object target = targetList;
@@ -315,7 +336,10 @@ namespace Umbraco.Core.Mapping
// if there is a direct map, map
if (map != null)
{
- map(source, target, context);
+ using (var scope = _scopeProvider.CreateScope(autoComplete: true))
+ {
+ map(source, target, context);
+ }
return target;
}
diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs
index fb9b8af46d..7106ef188e 100644
--- a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs
+++ b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs
@@ -332,9 +332,9 @@ namespace Umbraco.Core.Migrations.Install
}
// save
- logger.Info("Saving connection string to {ConfigFile}.", fileSource);
+ logger.Info("Saving connection string to {ConfigFile}.", fileSource);
xml.Save(fileName, SaveOptions.DisableFormatting);
- logger.Info("Saved connection string to {ConfigFile}.", fileSource);
+ logger.Info("Saved connection string to {ConfigFile}.", fileSource);
}
private static void AddOrUpdateAttribute(XElement element, string name, string value)
@@ -459,7 +459,7 @@ namespace Umbraco.Core.Migrations.Install
message = message + "Installation completed!
";
//now that everything is done, we need to determine the version of SQL server that is executing
- _logger.Info("Database configuration status: {DbConfigStatus}", message);
+ _logger.Info("Database configuration status: {DbConfigStatus}", message);
return new Result { Message = message, Success = true, Percentage = "100" };
}
@@ -508,7 +508,7 @@ namespace Umbraco.Core.Migrations.Install
//now that everything is done, we need to determine the version of SQL server that is executing
- _logger.Info("Database configuration status: {DbConfigStatus}", message);
+ _logger.Info("Database configuration status: {DbConfigStatus}", message);
return new Result { Message = message, Success = true, Percentage = "100" };
}
@@ -539,7 +539,7 @@ namespace Umbraco.Core.Migrations.Install
if (_databaseSchemaValidationResult != null)
{
- _logger.Info("The database schema validation produced the following summary: {DbSchemaSummary}", _databaseSchemaValidationResult.GetSummary());
+ _logger.Info("The database schema validation produced the following summary: {DbSchemaSummary}", _databaseSchemaValidationResult.GetSummary());
}
return new Result
diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs
index 9bd26749ad..44de611348 100644
--- a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs
+++ b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs
@@ -29,7 +29,7 @@ namespace Umbraco.Core.Migrations.Install
/// Name of the table to create base data for
public void InitializeBaseData(string tableName)
{
- _logger.Info("Creating data in {TableName}", tableName);
+ _logger.Info("Creating data in {TableName}", tableName);
if (tableName.Equals(Constants.DatabaseSchema.Tables.Node))
CreateNodeData();
@@ -73,7 +73,7 @@ namespace Umbraco.Core.Migrations.Install
if (tableName.Equals(Constants.DatabaseSchema.Tables.KeyValue))
CreateKeyValueData();
- _logger.Info("Done creating table {TableName} data.", tableName);
+ _logger.Info("Done creating table {TableName} data.", tableName);
}
private void CreateNodeData()
diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseSchemaCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseSchemaCreator.cs
index e9580da74a..c3756cfaad 100644
--- a/src/Umbraco.Core/Migrations/Install/DatabaseSchemaCreator.cs
+++ b/src/Umbraco.Core/Migrations/Install/DatabaseSchemaCreator.cs
@@ -100,7 +100,7 @@ namespace Umbraco.Core.Migrations.Install
var tableNameAttribute = table.FirstAttribute();
var tableName = tableNameAttribute == null ? table.Name : tableNameAttribute.Value;
- _logger.Info("Uninstall {TableName}", tableName);
+ _logger.Info("Uninstall {TableName}", tableName);
try
{
@@ -111,7 +111,7 @@ namespace Umbraco.Core.Migrations.Install
{
//swallow this for now, not sure how best to handle this with diff databases... though this is internal
// and only used for unit tests. If this fails its because the table doesn't exist... generally!
- _logger.Error(ex, "Could not drop table {TableName}", tableName);
+ _logger.Error(ex, "Could not drop table {TableName}", tableName);
}
}
}
@@ -436,7 +436,7 @@ namespace Umbraco.Core.Migrations.Install
var tableExist = TableExists(tableName);
if (overwrite && tableExist)
{
- _logger.Info("Table {TableName} already exists, but will be recreated", tableName);
+ _logger.Info("Table {TableName} already exists, but will be recreated", tableName);
DropTable(tableName);
tableExist = false;
@@ -445,19 +445,19 @@ namespace Umbraco.Core.Migrations.Install
if (tableExist)
{
// The table exists and was not recreated/overwritten.
- _logger.Info("Table {TableName} already exists - no changes were made", tableName);
+ _logger.Info("Table {TableName} already exists - no changes were made", tableName);
return;
}
//Execute the Create Table sql
_database.Execute(new Sql(createSql));
- _logger.Info("Create Table {TableName}: \n {Sql}", tableName, createSql);
+ _logger.Info("Create Table {TableName}: \n {Sql}", tableName, createSql);
//If any statements exists for the primary key execute them here
if (string.IsNullOrEmpty(createPrimaryKeySql) == false)
{
_database.Execute(new Sql(createPrimaryKeySql));
- _logger.Info("Create Primary Key:\n {Sql}", createPrimaryKeySql);
+ _logger.Info("Create Primary Key:\n {Sql}", createPrimaryKeySql);
}
if (SqlSyntax.SupportsIdentityInsert() && tableDefinition.Columns.Any(x => x.IsIdentity))
@@ -475,23 +475,23 @@ namespace Umbraco.Core.Migrations.Install
foreach (var sql in indexSql)
{
_database.Execute(new Sql(sql));
- _logger.Info("Create Index:\n {Sql}", sql);
+ _logger.Info("Create Index:\n {Sql}", sql);
}
//Loop through foreignkey statements and execute sql
foreach (var sql in foreignSql)
{
_database.Execute(new Sql(sql));
- _logger.Info("Create Foreign Key:\n {Sql}", sql);
+ _logger.Info("Create Foreign Key:\n {Sql}", sql);
}
if (overwrite)
{
- _logger.Info("Table {TableName} was recreated", tableName);
+ _logger.Info("Table {TableName} was recreated", tableName);
}
else
{
- _logger.Info("New table {TableName} was created", tableName);
+ _logger.Info("New table {TableName} was created", tableName);
}
}
diff --git a/src/Umbraco.Core/Migrations/MigrationPlan.cs b/src/Umbraco.Core/Migrations/MigrationPlan.cs
index 89c3c809e8..088d990221 100644
--- a/src/Umbraco.Core/Migrations/MigrationPlan.cs
+++ b/src/Umbraco.Core/Migrations/MigrationPlan.cs
@@ -294,11 +294,11 @@ namespace Umbraco.Core.Migrations
if (migrationBuilder == null) throw new ArgumentNullException(nameof(migrationBuilder));
if (logger == null) throw new ArgumentNullException(nameof(logger));
- logger.Info("Starting '{MigrationName}'...", Name);
+ logger.Info("Starting '{MigrationName}'...", Name);
var origState = fromState ?? string.Empty;
- logger.Info("At {OrigState}", string.IsNullOrWhiteSpace(origState) ? "origin": origState);
+ logger.Info("At {OrigState}", string.IsNullOrWhiteSpace(origState) ? "origin": origState);
if (!_transitions.TryGetValue(origState, out var transition))
ThrowOnUnknownInitialState(origState);
@@ -308,7 +308,7 @@ namespace Umbraco.Core.Migrations
while (transition != null)
{
- logger.Info("Execute {MigrationType}", transition.MigrationType.Name);
+ logger.Info("Execute {MigrationType}", transition.MigrationType.Name);
var migration = migrationBuilder.Build(transition.MigrationType, context);
migration.Migrate();
@@ -316,7 +316,7 @@ namespace Umbraco.Core.Migrations
var nextState = transition.TargetState;
origState = nextState;
- logger.Info("At {OrigState}", origState);
+ logger.Info("At {OrigState}", origState);
// throw a raw exception here: this should never happen as the plan has
// been validated - this is just a paranoid safety test
diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypeMigration.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypeMigration.cs
index 95b272dcb4..b69158e433 100644
--- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypeMigration.cs
+++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypeMigration.cs
@@ -94,7 +94,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
if (!LegacyAliases.Contains(dataType.EditorAlias))
{
- _logger.Warn(
+ _logger.Warn(
"Skipping validation of configuration for data type {NodeId} : {EditorAlias}."
+ " Please ensure that the configuration is valid. The site may fail to start and / or load data types and run.",
dataType.NodeId, dataType.EditorAlias);
@@ -104,7 +104,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
if (!LegacyAliases.Contains(newAlias))
{
- _logger.Warn("Skipping validation of configuration for data type {NodeId} : {NewEditorAlias} (was: {EditorAlias})"
+ _logger.Warn("Skipping validation of configuration for data type {NodeId} : {NewEditorAlias} (was: {EditorAlias})"
+ " because no property editor with that alias was found."
+ " Please ensure that the configuration is valid. The site may fail to start and / or load data types and run.",
dataType.NodeId, newAlias, dataType.EditorAlias);
@@ -119,7 +119,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
}
catch (Exception e)
{
- _logger.Warn(e, "Failed to validate configuration for data type {NodeId} : {NewEditorAlias} (was: {EditorAlias})."
+ _logger.Warn(e, "Failed to validate configuration for data type {NodeId} : {NewEditorAlias} (was: {EditorAlias})."
+ " Please fix the configuration and ensure it is valid. The site may fail to start and / or load data types and run.",
dataType.NodeId, newAlias, dataType.EditorAlias);
}
diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs
index 06f5d45deb..2eadb6c045 100644
--- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs
+++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes
public IPreValueMigrator GetMigrator(string editorAlias)
{
var migrator = this.FirstOrDefault(x => x.CanMigrate(editorAlias));
- _logger.Debug(GetType(), "Getting migrator for \"{EditorAlias}\" = {MigratorType}", editorAlias, migrator == null ? "" : migrator.GetType().Name);
+ _logger.Debug(GetType(), "Getting migrator for \"{EditorAlias}\" = {MigratorType}", editorAlias, migrator == null ? "" : migrator.GetType().Name);
return migrator;
}
}
diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs
index d30719231a..ed2681e6f1 100644
--- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs
+++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs
@@ -46,7 +46,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
}
catch (Exception ex)
{
- Logger.Error(
+ Logger.Error