Compare commits
171 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 244977dc95 | |||
| efc3261163 | |||
| 8c6aa9875d | |||
| f89ce1ff26 | |||
| d24b0aa9eb | |||
| 9f505a7976 | |||
| 1b27114014 | |||
| d8b235ad62 | |||
| 56581478c8 | |||
| 2be330d237 | |||
| 4381a700ba | |||
| 99821954f1 | |||
| 10a15be8ad | |||
| d1094eea7a | |||
| c629a50f39 | |||
| 430f906ae6 | |||
| 736798c769 | |||
| e913034d93 | |||
| bed5f8a03b | |||
| 0291ab615d | |||
| ceeea7827e | |||
| 756b4d24c0 | |||
| ffe3fc9257 | |||
| 26bd3c7c0b | |||
| 944b3dcaac | |||
| ba489afe9a | |||
| 968d52e490 | |||
| ebbe9f6ed0 | |||
| ba32636fe7 | |||
| a6f9d14a1b | |||
| 7cd385dd6b | |||
| 5d4a97591a | |||
| bfb81f6362 | |||
| ca3dc030bc | |||
| 4775aff749 | |||
| 9d20ee293b | |||
| a9b820de31 | |||
| 3813653852 | |||
| a4720a2221 | |||
| 728b71c4bd | |||
| 9d7975d970 | |||
| 7505401511 | |||
| 7ee0a278f7 | |||
| 1adbe9ddcb | |||
| 67e3ec2ae0 | |||
| d6272b0cdb | |||
| ce7dd19a8f | |||
| d295174e53 | |||
| 55022e2aaf | |||
| 4ffca2e4bf | |||
| 4a38b8acd1 | |||
| d93b8b869e | |||
| bec4e442fb | |||
| da8c46e426 | |||
| 72cc5ce88b | |||
| 63763d025e | |||
| f76fa6bde6 | |||
| c34a1060f7 | |||
| a231cedd8e | |||
| 20526b40bf | |||
| 5008a2be7f | |||
| 03a395d1f9 | |||
| 734df8685d | |||
| 92dad1af1c | |||
| d897e78b27 | |||
| d79115fcdf | |||
| 992073ab4e | |||
| 3c9b144927 | |||
| b7e4f58503 | |||
| 5880df3859 | |||
| c11dce7b6e | |||
| 004a3e2808 | |||
| d05bfc8983 | |||
| 5bb7223a79 | |||
| c9a816f25e | |||
| 13cfb42287 | |||
| 334fcf38ec | |||
| 8873d0f79d | |||
| b499b45a5c | |||
| d5a71ec1da | |||
| 1402494e47 | |||
| 7c491c1fc1 | |||
| 460dd69884 | |||
| beda99963e | |||
| b06f16f5f7 | |||
| f9d79871b4 | |||
| 777b02b84c | |||
| e322ab6f75 | |||
| d19bebc404 | |||
| 46dd86c745 | |||
| 62af834176 | |||
| 2dac1b3cf5 | |||
| 68fb951283 | |||
| 1ca825de62 | |||
| 54b57f7d51 | |||
| 2f6e161120 | |||
| 379bbe5bc4 | |||
| 5c558b0eeb | |||
| 298e56ad05 | |||
| d74d2cd945 | |||
| e2dc4f36ad | |||
| 9620c902cc | |||
| abda579da6 | |||
| 2e43e97ae2 | |||
| c7ac3e7691 | |||
| a209a2067c | |||
| b1c6276a67 | |||
| 3950b35539 | |||
| 2f63364925 | |||
| 376c78381d | |||
| 0a09810f0f | |||
| 43018e2793 | |||
| ba559f6836 | |||
| a320b63fd6 | |||
| 200497b865 | |||
| 8bd38b3cdd | |||
| f2c7c1e2c6 | |||
| 9f2c428a7c | |||
| a958f946ef | |||
| ac642619e7 | |||
| 688652fb91 | |||
| 4ef1eeb8bc | |||
| 0d7661a779 | |||
| 17f36c62cb | |||
| 5a98150f15 | |||
| d6bc0934ff | |||
| 29caacf3c3 | |||
| f091219f48 | |||
| 372a2f5df4 | |||
| 1397bc6dbf | |||
| 7c5a4d9d67 | |||
| 183103dc16 | |||
| 4b2a5f8768 | |||
| 2c3693ac68 | |||
| 7d90296e15 | |||
| d4c831864d | |||
| 1a56bb9948 | |||
| 4e84260619 | |||
| 62ddce60a5 | |||
| bc8829ce14 | |||
| d582d5c827 | |||
| 604bddabdf | |||
| e5af5bcc22 | |||
| 9f7f920229 | |||
| d1d98372cd | |||
| 9feee42430 | |||
| 876cb374ad | |||
| 16582c8207 | |||
| 2ee1df3dec | |||
| fc862f8434 | |||
| 8d7891d203 | |||
| 5af773d1b0 | |||
| 847ef34281 | |||
| a728f475aa | |||
| 60f91d95e9 | |||
| 821532cbd4 | |||
| e3a639b424 | |||
| 5c49aa9b43 | |||
| f040754547 | |||
| 0da8604639 | |||
| dd09ba3e12 | |||
| 896ea389a3 | |||
| 759c6dfef2 | |||
| 809a3f952e | |||
| dce9dea8f3 | |||
| b2a497ddba | |||
| ea030d990f | |||
| de9739118e | |||
| ce08749d85 | |||
| 1eea1f5f8f | |||
| 00a32c4479 |
@@ -0,0 +1,10 @@
|
||||
root=true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{cs,cshtml,csx,vb,vbx,vbhtml,fs,fsx,txt,ps1,sql}]
|
||||
indent_size = 4
|
||||
@@ -14,12 +14,13 @@
|
||||
<summary>Contains the core assemblies needed to run Umbraco Cms</summary>
|
||||
<language>en-US</language>
|
||||
<tags>umbraco</tags>
|
||||
<dependencies>
|
||||
<!--Must be this way because 2.0.5 is actually 1.2.15.0 and 2.0.6 is actually 2.0.6 !-->
|
||||
<dependency id="log4net" version="[2.0.5,2.0.6)" />
|
||||
<dependencies>
|
||||
<dependency id="log4net" version="[2.0.8,3.0.0)" />
|
||||
<dependency id="Log4Net.Async" version="[2.0.4,3.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.Mvc" version="[5.2.3,6.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.WebApi" version="[5.2.3,6.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.Identity.Owin" version="[2.2.1, 3.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.SignalR.Core" version="[2.2.1, 3.0.0)" />
|
||||
<dependency id="Microsoft.Owin.Security.Cookies" version="[3.0.1, 4.0.0)" />
|
||||
<dependency id="Microsoft.Owin.Security.OAuth" version="[3.0.1, 4.0.0)" />
|
||||
<dependency id="Microsoft.Owin.Host.SystemWeb" version="[3.0.1, 4.0.0)" />
|
||||
@@ -27,19 +28,19 @@
|
||||
<dependency id="HtmlAgilityPack" version="[1.4.9.5, 2.0.0)" />
|
||||
<dependency id="Lucene.Net" version="[2.9.4.1, 3.0.0.0)" />
|
||||
<dependency id="SharpZipLib" version="[0.86.0, 1.0.0)" />
|
||||
<dependency id="MySql.Data" version="[6.9.8, 7.0.0)" />
|
||||
<dependency id="MySql.Data" version="[6.9.9, 7.0.0)" />
|
||||
<dependency id="xmlrpcnet" version="[2.5.0, 3.0.0)" />
|
||||
<dependency id="ClientDependency" version="[1.9.2, 2.0.0)" />
|
||||
<dependency id="ClientDependency-Mvc5" version="[1.8.0.0, 2.0.0)" />
|
||||
<dependency id="AutoMapper" version="[3.3.1, 4.0.0)" />
|
||||
<dependency id="Newtonsoft.Json" version="[9.0.1, 10.0.0)" />
|
||||
<dependency id="Newtonsoft.Json" version="[10.0.2, 11.0.0)" />
|
||||
<dependency id="Examine" version="[0.1.82, 1.0.0)" />
|
||||
<dependency id="ImageProcessor" version="[2.5.2, 3.0.0)" />
|
||||
<dependency id="ImageProcessor.Web" version="[4.8.2, 5.0.0)" />
|
||||
<dependency id="ImageProcessor" version="[2.5.3, 3.0.0)" />
|
||||
<dependency id="ImageProcessor.Web" version="[4.8.3, 5.0.0)" />
|
||||
<dependency id="semver" version="[2.0.4, 3.0.0)" />
|
||||
<!-- Markdown can not be updated due to: https://github.com/hey-red/markdownsharp/issues/71#issuecomment-233585487 -->
|
||||
<dependency id="Markdown" version="[1.14.7, 2.0.0)" />
|
||||
<dependency id="System.Threading.Tasks.Dataflow" version="[4.6.0, 5.0.0)" />
|
||||
<dependency id="System.Threading.Tasks.Dataflow" version="[4.7.0, 5.0.0)" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
<tags>umbraco</tags>
|
||||
<dependencies>
|
||||
<dependency id="UmbracoCms.Core" version="[$version$]" />
|
||||
<dependency id="Newtonsoft.Json" version="[9.0.1, 10.0.0)" />
|
||||
<dependency id="Umbraco.ModelsBuilder" version="[3.0.6, 4.0.0)" />
|
||||
<dependency id="Newtonsoft.Json" version="[10.0.2, 11.0.0)" />
|
||||
<dependency id="Umbraco.ModelsBuilder" version="[3.0.7, 4.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.SignalR.Core" version="[2.2.1, 3.0.0)" />
|
||||
<dependency id="ImageProcessor.Web.Config" version="[2.3.0, 3.0.0)" />
|
||||
</dependencies>
|
||||
|
||||
@@ -8,8 +8,16 @@
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
Don't forget to build!
|
||||
*** IMPORTANT NOTICE FOR 7.6 UPGRADES ***
|
||||
|
||||
Be sure to read the version specific upgrade information before proceeding:
|
||||
https://our.umbraco.org/documentation/Getting-Started/Setup/Upgrading/version-specific#version-7-6-0
|
||||
|
||||
You will most likely need to make some changes to your web.config and you will need to be
|
||||
aware of the breaking changes listed there to see if these affect your installation.
|
||||
|
||||
|
||||
Don't forget to build!
|
||||
|
||||
We've done our best to transform your configuration files but in case something is not quite right: remember we
|
||||
backed up your files in App_Data\NuGetBackup so you can find the original files before they were transformed.
|
||||
|
||||
@@ -330,6 +330,8 @@
|
||||
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Owin.Security')" xdt:Transform="Remove" />
|
||||
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Owin.Security.Cookies')" xdt:Transform="Remove" />
|
||||
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Net.Http.Formatting')" xdt:Transform="Remove" />
|
||||
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.CodeAnalysis.CSharp')" xdt:Transform="Remove" />
|
||||
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='log4net')" xdt:Transform="Remove" />
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
@@ -349,7 +351,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
@@ -383,6 +385,10 @@
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
|
||||
7.6.0
|
||||
RC
|
||||
RC3
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
@@ -30,6 +30,10 @@
|
||||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>
|
||||
|
||||
+1
-1
@@ -12,4 +12,4 @@ using System.Resources;
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyFileVersion("7.6.0")]
|
||||
[assembly: AssemblyInformationalVersion("7.6.0-RC")]
|
||||
[assembly: AssemblyInformationalVersion("7.6.0-RC3")]
|
||||
@@ -4,12 +4,14 @@ using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
|
||||
[assembly: PreApplicationStartMethod(typeof(BindingRedirects), "Initialize")]
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages any assembly binding redirects that cannot be done via config
|
||||
/// Manages any assembly binding redirects that cannot be done via config (i.e. unsigned --> signed assemblies)
|
||||
/// </summary>
|
||||
internal class BindingRedirects
|
||||
public sealed class BindingRedirects
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
@@ -17,12 +19,9 @@ namespace Umbraco.Core
|
||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
||||
}
|
||||
|
||||
private static readonly Regex Log4NetAssemblyPattern = new Regex("log4net, Version=([\\d\\.]+?), Culture=neutral, PublicKeyToken=null");
|
||||
private const string Log4NetReplacement = "log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a";
|
||||
|
||||
private static readonly Regex HtmlAgilityAssemblyPattern = new Regex("HtmlAgilityPack, Version=([\\d\\.]+?), Culture=neutral, PublicKeyToken=bd319b19eaf3b43a");
|
||||
private const string HtmlAgilityReplacement = "HtmlAgilityPack, Version=1.4.9.5, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a";
|
||||
|
||||
private static readonly Regex Log4NetAssemblyPattern = new Regex("log4net, Version=([\\d\\.]+?), Culture=neutral, PublicKeyToken=\\w+$", RegexOptions.Compiled);
|
||||
private const string Log4NetReplacement = "log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a";
|
||||
|
||||
/// <summary>
|
||||
/// This is used to do an assembly binding redirect via code - normally required due to signature changes in assemblies
|
||||
/// </summary>
|
||||
@@ -36,13 +35,7 @@ namespace Umbraco.Core
|
||||
{
|
||||
return Assembly.Load(Log4NetAssemblyPattern.Replace(args.Name, Log4NetReplacement));
|
||||
}
|
||||
|
||||
//HtmlAgility:
|
||||
if (HtmlAgilityAssemblyPattern.IsMatch(args.Name) && args.Name != HtmlAgilityReplacement)
|
||||
{
|
||||
return Assembly.Load(HtmlAgilityAssemblyPattern.Replace(args.Name, HtmlAgilityReplacement));
|
||||
}
|
||||
|
||||
|
||||
//AutoMapper:
|
||||
// ensure the assembly is indeed AutoMapper and that the PublicKeyToken is null before trying to Load again
|
||||
// do NOT just replace this with 'return Assembly', as it will cause an infinite loop -> stackoverflow
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
Guid Id { get; }
|
||||
string RepositoryUrl { get; }
|
||||
string WebServiceUrl { get; }
|
||||
bool HasCustomWebServiceUrl { get; }
|
||||
bool HasCustomWebServiceUrl { get; }
|
||||
string RestApiUrl { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
public static class RepositoryConfigExtensions
|
||||
{
|
||||
//Our package repo
|
||||
private static readonly Guid RepoGuid = new Guid("65194810-1f85-11dd-bd0b-0800200c9a66");
|
||||
|
||||
public static IRepository GetDefault(this IRepositoriesSection repos)
|
||||
{
|
||||
var found = repos.Repositories.FirstOrDefault(x => x.Id == RepoGuid);
|
||||
if (found == null)
|
||||
throw new InvalidOperationException("No default package repository found with id " + RepoGuid);
|
||||
return found;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,16 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
get
|
||||
{
|
||||
var prop = Properties["webserviceurl"];
|
||||
var repoUrl = this[prop] as ConfigurationElement;
|
||||
return (repoUrl != null && repoUrl.ElementInformation.IsPresent);
|
||||
return (string) prop.DefaultValue != (string) this[prop];
|
||||
}
|
||||
}
|
||||
|
||||
[ConfigurationProperty("restapiurl", DefaultValue = "https://our.umbraco.org/webapi/packages/v1")]
|
||||
public string RestApiUrl
|
||||
{
|
||||
get { return (string)base["restapiurl"]; }
|
||||
set { base["restapiurl"] = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration
|
||||
/// Gets the version comment (like beta or RC).
|
||||
/// </summary>
|
||||
/// <value>The version comment.</value>
|
||||
public static string CurrentComment { get { return "RC"; } }
|
||||
public static string CurrentComment { get { return "RC3"; } }
|
||||
|
||||
// Get the version of the umbraco.dll by looking at a class in that dll
|
||||
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
|
||||
|
||||
@@ -124,6 +124,11 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
public const string MemberGroup = "366E63B9-880F-4E13-A61C-98069B029728";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Member Group object.
|
||||
/// </summary>
|
||||
public static readonly Guid MemberGroupGuid = new Guid(MemberGroup);
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Member Type object.
|
||||
/// </summary>
|
||||
|
||||
@@ -5,8 +5,10 @@ using System.Linq;
|
||||
namespace Umbraco.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// This event manager supports event cancellation and will raise the events as soon as they are tracked, it does not store tracked events
|
||||
/// An IEventDispatcher that immediately raise all events.
|
||||
/// </summary>
|
||||
/// <remarks>This means that events will be raised during the scope transaction,
|
||||
/// whatever happens, and the transaction could roll back in the end.</remarks>
|
||||
internal class PassThroughEventDispatcher : IEventDispatcher
|
||||
{
|
||||
public bool DispatchCancelable(EventHandler eventHandler, object sender, CancellableEventArgs args, string eventName = null)
|
||||
|
||||
@@ -3,11 +3,9 @@ using Umbraco.Core.IO;
|
||||
namespace Umbraco.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// This event manager is created for each scope and is aware of if it is nested in an outer scope
|
||||
/// An IEventDispatcher that queues events, and raise them when the scope
|
||||
/// exits and has been completed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The outer scope is the only scope that can raise events, the inner scope's will defer to the outer scope
|
||||
/// </remarks>
|
||||
internal class ScopeEventDispatcher : ScopeEventDispatcherBase
|
||||
{
|
||||
public ScopeEventDispatcher()
|
||||
|
||||
@@ -4,6 +4,15 @@ using System.Linq;
|
||||
|
||||
namespace Umbraco.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// An IEventDispatcher that queues events.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Can raise, or ignore, cancelable events, depending on option.</para>
|
||||
/// <para>Implementations must override ScopeExitCompleted to define what
|
||||
/// to do with the events when the scope exits and has been completed.</para>
|
||||
/// <para>If the scope exits without being completed, events are ignored.</para>
|
||||
/// </remarks>
|
||||
public abstract class ScopeEventDispatcherBase : IEventDispatcher
|
||||
{
|
||||
private List<IEventDefinition> _events;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Exceptions
|
||||
{
|
||||
internal class ConnectionException : Exception
|
||||
{
|
||||
public ConnectionException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Exceptions
|
||||
public T Operation { get; private set; }
|
||||
|
||||
public DataOperationException(T operation, string message)
|
||||
:base(message)
|
||||
: base(message)
|
||||
{
|
||||
Operation = operation;
|
||||
}
|
||||
|
||||
@@ -4,38 +4,144 @@ using System.IO;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
public interface IFileSystem
|
||||
/// <summary>
|
||||
/// Provides methods allowing the manipulation of files within an Umbraco application.
|
||||
/// </summary>
|
||||
public interface IFileSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all directories matching the given path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the directories.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="IEnumerable{String}"/> representing the matched directories.
|
||||
/// </returns>
|
||||
IEnumerable<string> GetDirectories(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified directory.
|
||||
/// </summary>
|
||||
/// <param name="path">The name of the directory to remove.</param>
|
||||
void DeleteDirectory(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified directory and, if indicated, any subdirectories and files in the directory.
|
||||
/// </summary>
|
||||
/// <remarks>Azure blob storage has no real concept of directories so deletion is always recursive.</remarks>
|
||||
/// <param name="path">The name of the directory to remove.</param>
|
||||
/// <param name="recursive">Whether to remove directories, subdirectories, and files in path.</param>
|
||||
void DeleteDirectory(string path, bool recursive);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified directory exists.
|
||||
/// </summary>
|
||||
/// <param name="path">The directory to check.</param>
|
||||
/// <returns>
|
||||
/// <c>True</c> if the directory exists and the user has permission to view it; otherwise <c>false</c>.
|
||||
/// </returns>
|
||||
bool DirectoryExists(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a file to the file system.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the given file.</param>
|
||||
/// <param name="stream">The <see cref="Stream"/> containing the file contents.</param>
|
||||
void AddFile(string path, Stream stream);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a file to the file system.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the given file.</param>
|
||||
/// <param name="stream">The <see cref="Stream"/> containing the file contents.</param>
|
||||
/// <param name="overrideIfExists">Whether to override the file if it already exists.</param>
|
||||
void AddFile(string path, Stream stream, bool overrideIfExists);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all files matching the given path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the files.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="IEnumerable{String}"/> representing the matched files.
|
||||
/// </returns>
|
||||
IEnumerable<string> GetFiles(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all files matching the given path and filter.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the files.</param>
|
||||
/// <param name="filter">A filter that allows the querying of file extension. <example>*.jpg</example></param>
|
||||
/// <returns>
|
||||
/// The <see cref="IEnumerable{String}"/> representing the matched files.
|
||||
/// </returns>
|
||||
IEnumerable<string> GetFiles(string path, string filter);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Stream"/> representing the file at the gieven path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the file.</param>
|
||||
/// <returns>
|
||||
/// <see cref="Stream"/>.
|
||||
/// </returns>
|
||||
Stream OpenFile(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified file.
|
||||
/// </summary>
|
||||
/// <param name="path">The name of the file to remove.</param>
|
||||
void DeleteFile(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified file exists.
|
||||
/// </summary>
|
||||
/// <param name="path">The file to check.</param>
|
||||
/// <returns>
|
||||
/// <c>True</c> if the file exists and the user has permission to view it; otherwise <c>false</c>.
|
||||
/// </returns>
|
||||
bool FileExists(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the application relative path to the file.
|
||||
/// </summary>
|
||||
/// <param name="fullPathOrUrl">The full path or url.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="string"/> representing the relative path.
|
||||
/// </returns>
|
||||
string GetRelativePath(string fullPathOrUrl);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full qualified path to the file.
|
||||
/// </summary>
|
||||
/// <param name="path">The file to return the full path for.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="string"/> representing the full path.
|
||||
/// </returns>
|
||||
string GetFullPath(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the application relative url to the file.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to return the url for.</param>
|
||||
/// <returns>
|
||||
/// <see cref="string"/> representing the relative url.
|
||||
/// </returns>
|
||||
string GetUrl(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last modified date/time of the file, expressed as a UTC value.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the file.</param>
|
||||
/// <returns>
|
||||
/// <see cref="DateTimeOffset"/>.
|
||||
/// </returns>
|
||||
DateTimeOffset GetLastModified(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the created date/time of the file, expressed as a UTC value.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the file.</param>
|
||||
/// <returns>
|
||||
/// <see cref="DateTimeOffset"/>.
|
||||
/// </returns>
|
||||
DateTimeOffset GetCreated(string path);
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Umbraco.Core.IO
|
||||
// if can seek, be safe and go back to start, else...
|
||||
// hope that the stream hasn't been read already
|
||||
if (stream.CanSeek)
|
||||
stream.Seek(0, 0);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
using (var destination = (Stream) File.Create(fullPath))
|
||||
stream.CopyTo(destination);
|
||||
|
||||
@@ -52,9 +52,20 @@ namespace Umbraco.Core.IO
|
||||
try
|
||||
{
|
||||
Directory.Delete(dir, true);
|
||||
dir = dir.Substring(0, dir.Length - _shadowPath.Length - 1);
|
||||
if (Directory.EnumerateFileSystemEntries(dir).Any() == false)
|
||||
Directory.Delete(dir, true);
|
||||
|
||||
// shadowPath make be path/to/dir, remove each
|
||||
dir = dir.Replace("/", "\\");
|
||||
var min = IOHelper.MapPath("~/App_Data/TEMP/ShadowFs").Length;
|
||||
var pos = dir.LastIndexOf("\\", StringComparison.OrdinalIgnoreCase);
|
||||
while (pos > min)
|
||||
{
|
||||
dir = dir.Substring(0, pos);
|
||||
if (Directory.EnumerateFileSystemEntries(dir).Any() == false)
|
||||
Directory.Delete(dir, true);
|
||||
else
|
||||
break;
|
||||
pos = dir.LastIndexOf("\\", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Umbraco.Core.Logging
|
||||
/// This is an old/deprecated logger and has been superceded by ParallelForwardingAppender which is included in Umbraco and
|
||||
/// also by AsyncForwardingAppender in the Log4Net.Async library.
|
||||
/// </summary>
|
||||
[Obsolete("This is superceded by the ParallelForwardingAppender, this will be removed in v8")]
|
||||
[Obsolete("This is superceded by the ParallelForwardingAppender, this will be removed in v8, do not use this")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public class AsynchronousRollingFileAppender : RollingFileAppender
|
||||
{
|
||||
|
||||
@@ -13,301 +13,8 @@ namespace Umbraco.Core.Logging
|
||||
/// <remarks>
|
||||
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
|
||||
/// </remarks>
|
||||
public class ParallelForwardingAppender : AsyncForwardingAppenderBase, IDisposable
|
||||
[Obsolete("Use the Log4Net.Async.ParallelForwardingAppender instead this will be removed in future versions")]
|
||||
public class ParallelForwardingAppender : Log4Net.Async.ParallelForwardingAppender
|
||||
{
|
||||
#region Private Members
|
||||
|
||||
private const int DefaultBufferSize = 1000;
|
||||
private BlockingCollection<LoggingEventContext> _loggingEvents;
|
||||
private CancellationTokenSource _loggingCancelationTokenSource;
|
||||
private CancellationToken _loggingCancelationToken;
|
||||
private Task _loggingTask;
|
||||
private Double _shutdownFlushTimeout = 2;
|
||||
private TimeSpan _shutdownFlushTimespan = TimeSpan.FromSeconds(2);
|
||||
private static readonly Type ThisType = typeof(ParallelForwardingAppender);
|
||||
private volatile bool shutDownRequested;
|
||||
private int? bufferSize = DefaultBufferSize;
|
||||
|
||||
#endregion Private Members
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of LoggingEvents that will be buffered. Set to null for unlimited.
|
||||
/// </summary>
|
||||
public override int? BufferSize
|
||||
{
|
||||
get { return bufferSize; }
|
||||
set { bufferSize = value; }
|
||||
}
|
||||
|
||||
public int BufferEntryCount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_loggingEvents == null) return 0;
|
||||
return _loggingEvents.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time period in which the system will wait for appenders to flush before canceling the background task.
|
||||
/// </summary>
|
||||
public Double ShutdownFlushTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return _shutdownFlushTimeout;
|
||||
}
|
||||
set
|
||||
{
|
||||
_shutdownFlushTimeout = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override string InternalLoggerName
|
||||
{
|
||||
get
|
||||
{
|
||||
{
|
||||
return "ParallelForwardingAppender";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Startup
|
||||
|
||||
public override void ActivateOptions()
|
||||
{
|
||||
base.ActivateOptions();
|
||||
_shutdownFlushTimespan = TimeSpan.FromSeconds(_shutdownFlushTimeout);
|
||||
StartForwarding();
|
||||
}
|
||||
|
||||
private void StartForwarding()
|
||||
{
|
||||
if (shutDownRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//Create a collection which will block the thread and wait for new entries
|
||||
//if the collection is empty
|
||||
if (BufferSize.HasValue && BufferSize > 0)
|
||||
{
|
||||
_loggingEvents = new BlockingCollection<LoggingEventContext>(BufferSize.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
//No limit on the number of events.
|
||||
_loggingEvents = new BlockingCollection<LoggingEventContext>();
|
||||
}
|
||||
//The cancellation token is used to cancel a running task gracefully.
|
||||
_loggingCancelationTokenSource = new CancellationTokenSource();
|
||||
_loggingCancelationToken = _loggingCancelationTokenSource.Token;
|
||||
_loggingTask = new Task(SubscriberLoop, _loggingCancelationToken);
|
||||
_loggingTask.Start();
|
||||
}
|
||||
|
||||
#endregion Startup
|
||||
|
||||
#region Shutdown
|
||||
|
||||
private void CompleteSubscriberTask()
|
||||
{
|
||||
shutDownRequested = true;
|
||||
if (_loggingEvents == null || _loggingEvents.IsAddingCompleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//Don't allow more entries to be added.
|
||||
_loggingEvents.CompleteAdding();
|
||||
//Allow some time to flush
|
||||
Thread.Sleep(_shutdownFlushTimespan);
|
||||
if (!_loggingTask.IsCompleted && !_loggingCancelationToken.IsCancellationRequested)
|
||||
{
|
||||
_loggingCancelationTokenSource.Cancel();
|
||||
//Wait here so that the error logging messages do not get into a random order.
|
||||
//Don't pass the cancellation token because we are not interested
|
||||
//in catching the OperationCanceledException that results.
|
||||
_loggingTask.Wait();
|
||||
}
|
||||
if (!_loggingEvents.IsCompleted)
|
||||
{
|
||||
ForwardInternalError("The buffer was not able to be flushed before timeout occurred.", null, ThisType);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
CompleteSubscriberTask();
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
#endregion Shutdown
|
||||
|
||||
#region Appending
|
||||
|
||||
protected override void Append(LoggingEvent loggingEvent)
|
||||
{
|
||||
if (_loggingEvents == null || _loggingEvents.IsAddingCompleted || loggingEvent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
loggingEvent.Fix = Fix;
|
||||
//In the case where blocking on a full collection, and the task is subsequently completed, the cancellation token
|
||||
//will prevent the entry from attempting to add to the completed collection which would result in an exception.
|
||||
_loggingEvents.Add(new LoggingEventContext(loggingEvent, HttpContext), _loggingCancelationToken);
|
||||
}
|
||||
|
||||
protected override void Append(LoggingEvent[] loggingEvents)
|
||||
{
|
||||
if (_loggingEvents == null || _loggingEvents.IsAddingCompleted || loggingEvents == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var loggingEvent in loggingEvents)
|
||||
{
|
||||
Append(loggingEvent);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Appending
|
||||
|
||||
#region Forwarding
|
||||
|
||||
/// <summary>
|
||||
/// Iterates over a BlockingCollection containing LoggingEvents.
|
||||
/// </summary>
|
||||
private void SubscriberLoop()
|
||||
{
|
||||
Thread.CurrentThread.Name = String.Format("{0} ParallelForwardingAppender Subscriber Task", Name);
|
||||
//The task will continue in a blocking loop until
|
||||
//the queue is marked as adding completed, or the task is canceled.
|
||||
try
|
||||
{
|
||||
//This call blocks until an item is available or until adding is completed
|
||||
foreach (var entry in _loggingEvents.GetConsumingEnumerable(_loggingCancelationToken))
|
||||
{
|
||||
HttpContext = entry.HttpContext;
|
||||
ForwardLoggingEvent(entry.LoggingEvent, ThisType);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException ex)
|
||||
{
|
||||
//The thread was canceled before all entries could be forwarded and the collection completed.
|
||||
ForwardInternalError("Subscriber task was canceled before completion.", ex, ThisType);
|
||||
//Cancellation is called in the CompleteSubscriberTask so don't call that again.
|
||||
}
|
||||
catch (ThreadAbortException ex)
|
||||
{
|
||||
//Thread abort may occur on domain unload.
|
||||
ForwardInternalError("Subscriber task was aborted.", ex, ThisType);
|
||||
//Cannot recover from a thread abort so complete the task.
|
||||
CompleteSubscriberTask();
|
||||
//The exception is swallowed because we don't want the client application
|
||||
//to halt due to a logging issue.
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//On exception, try to log the exception
|
||||
ForwardInternalError("Subscriber task error in forwarding loop.", ex, ThisType);
|
||||
//Any error in the loop is going to be some sort of extenuating circumstance from which we
|
||||
//probably cannot recover anyway. Complete subscribing.
|
||||
CompleteSubscriberTask();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Forwarding
|
||||
|
||||
#region IDisposable Implementation
|
||||
|
||||
private bool _disposed = false;
|
||||
|
||||
//Implement IDisposable.
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_loggingTask != null)
|
||||
{
|
||||
if (!(_loggingTask.IsCanceled || _loggingTask.IsCompleted || _loggingTask.IsFaulted))
|
||||
{
|
||||
try
|
||||
{
|
||||
CompleteSubscriberTask();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogLog.Error(ThisType, "Exception Completing Subscriber Task in Dispose Method", ex);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
_loggingTask.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogLog.Error(ThisType, "Exception Disposing Logging Task", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_loggingTask = null;
|
||||
}
|
||||
}
|
||||
if (_loggingEvents != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_loggingEvents.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogLog.Error(ThisType, "Exception Disposing BlockingCollection", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_loggingEvents = null;
|
||||
}
|
||||
}
|
||||
if (_loggingCancelationTokenSource != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_loggingCancelationTokenSource.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogLog.Error(ThisType, "Exception Disposing CancellationTokenSource", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_loggingCancelationTokenSource = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Use C# destructor syntax for finalization code.
|
||||
~ParallelForwardingAppender()
|
||||
{
|
||||
// Simply call Dispose(false).
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
#endregion IDisposable Implementation
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
|
||||
using System;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
@@ -25,6 +26,15 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter
|
||||
return new AlterTableBuilder(_context, _databaseProviders, expression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The problem with this is that only under particular circumstances is the expression added to the context
|
||||
/// so you wouldn't actually know if you are using it correctly or not and chances are you are not and therefore
|
||||
/// the statement won't even execute whereas using the IAlterTableSyntax to modify a column is guaranteed to add
|
||||
/// the expression to the context.
|
||||
/// </summary>
|
||||
/// <param name="columnName"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("Use the IAlterTableSyntax to modify a column instead, this will be removed in future versions")]
|
||||
public IAlterColumnSyntax Column(string columnName)
|
||||
{
|
||||
var expression = new AlterColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) {Column = {Name = columnName}};
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
|
||||
using System;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter
|
||||
{
|
||||
public interface IAlterSyntaxBuilder : IFluentSyntax
|
||||
{
|
||||
IAlterTableSyntax Table(string tableName);
|
||||
IAlterTableSyntax Table(string tableName);
|
||||
|
||||
/// <summary>
|
||||
/// The problem with this is that only under particular circumstances is the expression added to the context
|
||||
/// so you wouldn't actually know if you are using it correctly or not and chances are you are not and therefore
|
||||
/// the statement won't even execute whereas using the IAlterTableSyntax to modify a column is guaranteed to add
|
||||
/// the expression to the context.
|
||||
/// </summary>
|
||||
/// <param name="columnName"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("Use the IAlterTableSyntax to modify a column instead, this will be removed in future versions")]
|
||||
IAlterColumnSyntax Column(string columnName);
|
||||
}
|
||||
}
|
||||
+37
-12
@@ -4,7 +4,7 @@ using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
|
||||
{
|
||||
[Migration("7.6.0", 0, Constants.System.UmbracoMigrationName)]
|
||||
[Migration("7.6.0", 3, Constants.System.UmbracoMigrationName)]
|
||||
public class AddIndexToCmsMemberLoginName : MigrationBase
|
||||
{
|
||||
public AddIndexToCmsMemberLoginName(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
@@ -12,18 +12,43 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
|
||||
{ }
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
var dbIndexes = SqlSyntax.GetDefinedIndexesDefinitions(Context.Database);
|
||||
|
||||
//make sure it doesn't already exist
|
||||
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_cmsMember_LoginName")) == false)
|
||||
{
|
||||
Execute.Code(database =>
|
||||
{
|
||||
Create.Index("IX_cmsMember_LoginName").OnTable("cmsMember")
|
||||
.OnColumn("LoginName")
|
||||
.Ascending()
|
||||
.WithOptions()
|
||||
.NonClustered();
|
||||
}
|
||||
//Now we need to check if we can actually d6 this because we won't be able to if there's data in there that is too long
|
||||
//http://issues.umbraco.org/issue/U4-9758
|
||||
|
||||
var colLen = (SqlSyntax is MySqlSyntaxProvider)
|
||||
? database.ExecuteScalar<int?>("select max(LENGTH(LoginName)) from cmsMember")
|
||||
: database.ExecuteScalar<int?>("select max(datalength(LoginName)) from cmsMember");
|
||||
|
||||
if (colLen < 900 == false && colLen != null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var dbIndexes = SqlSyntax.GetDefinedIndexesDefinitions(Context.Database);
|
||||
|
||||
//make sure it doesn't already exist
|
||||
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_cmsMember_LoginName")) == false)
|
||||
{
|
||||
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
|
||||
|
||||
//we can apply the index
|
||||
localContext.Create.Index("IX_cmsMember_LoginName").OnTable("cmsMember")
|
||||
.OnColumn("LoginName")
|
||||
.Ascending()
|
||||
.WithOptions()
|
||||
.NonClustered();
|
||||
|
||||
return localContext.GetSql();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
|
||||
+3
-4
@@ -1,11 +1,10 @@
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveFive
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
|
||||
{
|
||||
[Migration("7.5.5", 101, Constants.System.UmbracoMigrationName)]
|
||||
[Migration("7.6.0", 101, Constants.System.UmbracoMigrationName)]
|
||||
public class AddLockObjects : MigrationBase
|
||||
{
|
||||
public AddLockObjects(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
+2
-3
@@ -1,11 +1,10 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveFive
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
|
||||
{
|
||||
[Migration("7.5.5", 100, Constants.System.UmbracoMigrationName)]
|
||||
[Migration("7.6.0", 100, Constants.System.UmbracoMigrationName)]
|
||||
public class AddLockTable : MigrationBase
|
||||
{
|
||||
public AddLockTable(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
|
||||
{
|
||||
[Migration("7.6.0", 0, Constants.System.UmbracoMigrationName)]
|
||||
public class NormalizeTemplateGuids : MigrationBase
|
||||
{
|
||||
public NormalizeTemplateGuids(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
: base(sqlSyntax, logger)
|
||||
{ }
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
Execute.Code(UpdateTemplateGuids);
|
||||
}
|
||||
|
||||
private static string UpdateTemplateGuids(Database database)
|
||||
{
|
||||
// we need this migration because ppl running pre-7.6 on Cloud and Courier have templates in different
|
||||
// environments having different GUIDs (Courier does not sync template GUIDs) and we need to normalize
|
||||
// these GUIDs so templates with the same alias on different environments have the same GUID.
|
||||
// however, if already running a prerelease version of 7.6, we do NOT want to normalize the GUIDs as quite
|
||||
// probably, we are already running Deploy and the GUIDs are OK. assuming noone is running a prerelease
|
||||
// of 7.6 on Courier.
|
||||
// so... testing if we already have a 7.6.0 version installed. not pretty but...?
|
||||
//
|
||||
var version = database.FirstOrDefault<string>("SELECT version FROM umbracoMigration WHERE name=@name ORDER BY version DESC", new { name = Constants.System.UmbracoMigrationName });
|
||||
if (version != null && version.StartsWith("7.6.0")) return string.Empty;
|
||||
|
||||
var updates = database.Query<dynamic>(@"SELECT umbracoNode.id, cmsTemplate.alias FROM umbracoNode
|
||||
JOIN cmsTemplate ON umbracoNode.id=cmsTemplate.nodeId
|
||||
WHERE nodeObjectType = @guid", new { guid = Constants.ObjectTypes.TemplateTypeGuid})
|
||||
.Select(template => Tuple.Create((int) template.id, ("template____" + (string) template.alias).ToGuid()))
|
||||
.ToList();
|
||||
|
||||
foreach (var update in updates)
|
||||
database.Execute("UPDATE umbracoNode set uniqueId=@guid WHERE id=@id", new { guid = update.Item2, id = update.Item1 });
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero
|
||||
{
|
||||
[Migration("7.6.0", 2, Constants.System.UmbracoMigrationName)]
|
||||
public class ReduceLoginNameColumnsSize : MigrationBase
|
||||
{
|
||||
public ReduceLoginNameColumnsSize(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
: base(sqlSyntax, logger)
|
||||
{ }
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
//Now we need to check if we can actually d6 this because we won't be able to if there's data in there that is too long
|
||||
//http://issues.umbraco.org/issue/U4-9758
|
||||
|
||||
Execute.Code(database =>
|
||||
{
|
||||
var dbIndexes = SqlSyntax.GetDefinedIndexesDefinitions(database);
|
||||
|
||||
var colLen = (SqlSyntax is MySqlSyntaxProvider)
|
||||
? database.ExecuteScalar<int?>("select max(LENGTH(LoginName)) from cmsMember")
|
||||
: database.ExecuteScalar<int?>("select max(datalength(LoginName)) from cmsMember");
|
||||
|
||||
if (colLen < 900 == false) return null;
|
||||
|
||||
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
|
||||
|
||||
//if it exists we need to drop it first
|
||||
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_cmsMember_LoginName")))
|
||||
{
|
||||
localContext.Delete.Index("IX_cmsMember_LoginName").OnTable("cmsMember");
|
||||
}
|
||||
|
||||
//we can apply the col length change
|
||||
localContext.Alter.Table("cmsMember")
|
||||
.AlterColumn("LoginName")
|
||||
.AsString(225)
|
||||
.NotNullable();
|
||||
|
||||
return localContext.GetSql();
|
||||
});
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe
|
||||
}).ToArray();
|
||||
|
||||
//must be non-nullable
|
||||
Alter.Column("uniqueID").OnTable("umbracoNode").AsGuid().NotNullable();
|
||||
Alter.Table("umbracoNode").AlterColumn("uniqueID").AsGuid().NotNullable();
|
||||
|
||||
//make sure it already exists
|
||||
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoNodeUniqueID")))
|
||||
|
||||
@@ -132,6 +132,11 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
|
||||
Database.Update(dto);
|
||||
|
||||
foreach (var removedRule in entity.RemovedRules)
|
||||
{
|
||||
Database.Delete<AccessRuleDto>("WHERE id=@Id", new { Id = removedRule });
|
||||
}
|
||||
|
||||
foreach (var rule in entity.Rules)
|
||||
{
|
||||
if (rule.HasIdentity)
|
||||
@@ -157,10 +162,6 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
rule.Id = rule.Key.GetHashCode();
|
||||
}
|
||||
}
|
||||
foreach (var removedRule in entity.RemovedRules)
|
||||
{
|
||||
Database.Delete<AccessRuleDto>("WHERE id=@Id", new {Id = removedRule});
|
||||
}
|
||||
|
||||
entity.ClearRemovedRules();
|
||||
|
||||
|
||||
@@ -8,5 +8,6 @@ namespace Umbraco.Core.Persistence.UnitOfWork
|
||||
IScope Scope { get; }
|
||||
EventMessages Messages { get; }
|
||||
IEventDispatcher Events { get; }
|
||||
void Flush();
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,33 @@ namespace Umbraco.Core.Persistence.UnitOfWork
|
||||
_key = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public object Key
|
||||
public void Flush()
|
||||
{
|
||||
if (_readOnly)
|
||||
throw new NotSupportedException("This unit of work is read-only.");
|
||||
|
||||
while (_operations.Count > 0)
|
||||
{
|
||||
var operation = _operations.Dequeue();
|
||||
switch (operation.Type)
|
||||
{
|
||||
case TransactionType.Insert:
|
||||
operation.Repository.PersistNewItem(operation.Entity);
|
||||
break;
|
||||
case TransactionType.Delete:
|
||||
operation.Repository.PersistDeletedItem(operation.Entity);
|
||||
break;
|
||||
case TransactionType.Update:
|
||||
operation.Repository.PersistUpdatedItem(operation.Entity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_operations.Clear();
|
||||
_key = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public object Key
|
||||
{
|
||||
get { return _key; }
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ namespace Umbraco.Core.PropertyEditors
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This resolver will contain any parameter editors defined in manifests as well as any property editors defined in manifests
|
||||
/// that have the IsParameterEditorFlag = true and any PropertyEditors found in c# that have this flag as well.
|
||||
/// that have the IsParameterEditorFlag = true and any PropertyEditors found in c# that have this flag as well.
|
||||
/// </remarks>
|
||||
internal class ParameterEditorResolver : LazyManyObjectsResolverBase<ParameterEditorResolver, IParameterEditor>
|
||||
{
|
||||
private readonly ManifestBuilder _builder;
|
||||
private readonly IContentSection _contentSection;
|
||||
|
||||
|
||||
public ParameterEditorResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> typeListProducerList, ManifestBuilder builder)
|
||||
: base(serviceProvider, logger, typeListProducerList, ObjectLifetimeScope.Application)
|
||||
{
|
||||
@@ -33,47 +33,51 @@ namespace Umbraco.Core.PropertyEditors
|
||||
/// </summary>
|
||||
public IEnumerable<IParameterEditor> ParameterEditors
|
||||
{
|
||||
get
|
||||
get { return GetParameterEditors(); }
|
||||
}
|
||||
|
||||
public IEnumerable<IParameterEditor> GetParameterEditors(bool includeDeprecated = false)
|
||||
{
|
||||
// all property editors and parameter editors
|
||||
// except property editors where !IsParameterEditor
|
||||
var values = Values
|
||||
.Where(x => x is PropertyEditor == false || ((PropertyEditor) x).IsParameterEditor);
|
||||
|
||||
// union all manifest parameter editors
|
||||
values = values
|
||||
.Union(_builder.ParameterEditors);
|
||||
|
||||
// union all manifest property editors where IsParameterEditor
|
||||
values = values
|
||||
.Union(_builder.PropertyEditors.Where(x => x.IsParameterEditor));
|
||||
|
||||
if (includeDeprecated == false && _contentSection.ShowDeprecatedPropertyEditors == false)
|
||||
{
|
||||
// all property editors and parameter editors
|
||||
// except property editors where !IsParameterEditor
|
||||
var values = Values
|
||||
.Where(x => x is PropertyEditor == false || ((PropertyEditor) x).IsParameterEditor);
|
||||
|
||||
// union all manifest parameter editors
|
||||
// except deprecated property editors
|
||||
values = values
|
||||
.Union(_builder.ParameterEditors);
|
||||
|
||||
// union all manifest property editors where IsParameterEditor
|
||||
values = values
|
||||
.Union(_builder.PropertyEditors.Where(x => x.IsParameterEditor));
|
||||
|
||||
if (_contentSection.ShowDeprecatedPropertyEditors == false)
|
||||
{
|
||||
// except deprecated property editors
|
||||
values = values
|
||||
.Where(x => x is PropertyEditor == false || ((PropertyEditor) x).IsDeprecated == false);
|
||||
}
|
||||
|
||||
return values;
|
||||
.Where(x => x is PropertyEditor == false || ((PropertyEditor) x).IsDeprecated == false);
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a property editor by alias
|
||||
/// </summary>
|
||||
/// <param name="alias"></param>
|
||||
/// <param name="includeDeprecated"></param>
|
||||
/// <returns></returns>
|
||||
public IParameterEditor GetByAlias(string alias)
|
||||
public IParameterEditor GetByAlias(string alias, bool includeDeprecated = false)
|
||||
{
|
||||
var found = ParameterEditors.SingleOrDefault(x => x.Alias == alias);
|
||||
var paramEditors = GetParameterEditors(includeDeprecated).ToArray();
|
||||
var found = paramEditors.SingleOrDefault(x => x.Alias == alias);
|
||||
if (found != null) return found;
|
||||
|
||||
|
||||
//couldn't find one, so try the map
|
||||
var mapped = LegacyParameterEditorAliasConverter.GetNewAliasFromLegacyAlias(alias);
|
||||
return mapped == null
|
||||
? null
|
||||
: ParameterEditors.SingleOrDefault(x => x.Alias == mapped);
|
||||
return mapped == null
|
||||
? null
|
||||
: paramEditors.SingleOrDefault(x => x.Alias == mapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -26,12 +27,16 @@ namespace Umbraco.Core.Publishing
|
||||
public int CheckPendingAndProcess()
|
||||
{
|
||||
var counter = 0;
|
||||
foreach (var d in _contentService.GetContentForRelease())
|
||||
var contentForRelease = _contentService.GetContentForRelease().ToArray();
|
||||
if (contentForRelease.Length > 0)
|
||||
LogHelper.Debug<ScheduledPublisher>(string.Format("There's {0} item(s) of content to be published", contentForRelease.Length));
|
||||
foreach (var d in contentForRelease)
|
||||
{
|
||||
try
|
||||
{
|
||||
d.ReleaseDate = null;
|
||||
var result = _contentService.SaveAndPublishWithStatus(d, (int)d.GetWriterProfile().Id);
|
||||
LogHelper.Debug<ContentService>(string.Format("Result of publish attempt: {0}", result.Result.StatusType));
|
||||
if (result.Success == false)
|
||||
{
|
||||
if (result.Exception != null)
|
||||
@@ -54,7 +59,11 @@ namespace Umbraco.Core.Publishing
|
||||
throw;
|
||||
}
|
||||
}
|
||||
foreach (var d in _contentService.GetContentForExpiration())
|
||||
|
||||
var contentForExpiration = _contentService.GetContentForExpiration().ToArray();
|
||||
if (contentForExpiration.Length > 0)
|
||||
LogHelper.Debug<ScheduledPublisher>(string.Format("There's {0} item(s) of content to be unpublished", contentForExpiration.Length));
|
||||
foreach (var d in contentForExpiration)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -465,6 +465,7 @@ namespace Umbraco.Core.Scoping
|
||||
}
|
||||
finally
|
||||
{
|
||||
// removes the ambient context (ambient scope already gone)
|
||||
_scopeProvider.SetAmbient(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Umbraco.Core.Scoping
|
||||
{
|
||||
public class ScopeContext : IInstanceIdentifiable
|
||||
{
|
||||
private Dictionary<string, IEnlistedObject> _enlisted;
|
||||
private bool _exiting;
|
||||
|
||||
public void ScopeExit(bool completed)
|
||||
{
|
||||
if (_enlisted == null)
|
||||
return;
|
||||
|
||||
_exiting = true;
|
||||
|
||||
List<Exception> exceptions = null;
|
||||
foreach (var enlisted in Enlisted.Values)
|
||||
foreach (var enlisted in _enlisted.Values.OrderBy(x => x.Priority))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -23,6 +30,7 @@ namespace Umbraco.Core.Scoping
|
||||
exceptions.Add(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (exceptions != null)
|
||||
throw new AggregateException("Exceptions were thrown by listed actions.", exceptions);
|
||||
}
|
||||
@@ -42,73 +50,71 @@ namespace Umbraco.Core.Scoping
|
||||
private interface IEnlistedObject
|
||||
{
|
||||
void Execute(bool completed);
|
||||
int Priority { get; }
|
||||
}
|
||||
|
||||
private class EnlistedObject<T> : IEnlistedObject
|
||||
{
|
||||
private readonly Action<bool, T> _action;
|
||||
|
||||
public EnlistedObject(T item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
|
||||
public EnlistedObject(T item, Action<bool, T> action)
|
||||
public EnlistedObject(T item, Action<bool, T> action, int priority)
|
||||
{
|
||||
Item = item;
|
||||
Priority = priority;
|
||||
_action = action;
|
||||
}
|
||||
|
||||
public T Item { get; private set; }
|
||||
|
||||
public int Priority { get; private set; }
|
||||
|
||||
public void Execute(bool completed)
|
||||
{
|
||||
_action(completed, Item);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
// todo: replace with optional parameters when we can break things
|
||||
public T Enlist<T>(string key, Func<T> creator)
|
||||
{
|
||||
IEnlistedObject enlisted;
|
||||
if (Enlisted.TryGetValue(key, out enlisted))
|
||||
{
|
||||
var enlistedAs = enlisted as EnlistedObject<T>;
|
||||
if (enlistedAs == null) throw new Exception("An item with a different type has already been enlisted with the same key.");
|
||||
return enlistedAs.Item;
|
||||
}
|
||||
var enlistedOfT = new EnlistedObject<T>(creator());
|
||||
Enlisted[key] = enlistedOfT;
|
||||
return enlistedOfT.Item;
|
||||
return Enlist(key, creator, null, 100);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
// todo: replace with optional parameters when we can break things
|
||||
public T Enlist<T>(string key, Func<T> creator, Action<bool, T> action)
|
||||
{
|
||||
IEnlistedObject enlisted;
|
||||
if (Enlisted.TryGetValue(key, out enlisted))
|
||||
{
|
||||
var enlistedAs = enlisted as EnlistedObject<T>;
|
||||
if (enlistedAs == null) throw new Exception("An item with a different type has already been enlisted with the same key.");
|
||||
return enlistedAs.Item;
|
||||
}
|
||||
var enlistedOfT = new EnlistedObject<T>(creator(), action);
|
||||
Enlisted[key] = enlistedOfT;
|
||||
return enlistedOfT.Item;
|
||||
return Enlist(key, creator, action, 100);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
// todo: replace with optional parameters when we can break things
|
||||
public void Enlist(string key, Action<bool> action)
|
||||
{
|
||||
Enlist<object>(key, null, (completed, item) => action(completed), 100);
|
||||
}
|
||||
|
||||
public void Enlist(string key, Action<bool> action, int priority)
|
||||
{
|
||||
Enlist<object>(key, null, (completed, item) => action(completed), priority);
|
||||
}
|
||||
|
||||
public T Enlist<T>(string key, Func<T> creator, Action<bool, T> action, int priority)
|
||||
{
|
||||
if (_exiting)
|
||||
throw new InvalidOperationException("Cannot enlist now, context is exiting.");
|
||||
|
||||
var enlistedObjects = _enlisted ?? (_enlisted = new Dictionary<string, IEnlistedObject>());
|
||||
|
||||
IEnlistedObject enlisted;
|
||||
if (Enlisted.TryGetValue(key, out enlisted))
|
||||
if (enlistedObjects.TryGetValue(key, out enlisted))
|
||||
{
|
||||
var enlistedAs = enlisted as EnlistedObject<object>;
|
||||
if (enlistedAs == null) throw new Exception("An item with a different type has already been enlisted with the same key.");
|
||||
return;
|
||||
var enlistedAs = enlisted as EnlistedObject<T>;
|
||||
if (enlistedAs == null) throw new InvalidOperationException("An item with the key already exists, but with a different type.");
|
||||
if (enlistedAs.Priority != priority) throw new InvalidOperationException("An item with the key already exits, but with a different priority.");
|
||||
return enlistedAs.Item;
|
||||
}
|
||||
var enlistedOfT = new EnlistedObject<object>(null, (completed, item) => action(completed));
|
||||
var enlistedOfT = new EnlistedObject<T>(creator == null ? default(T) : creator(), action, priority);
|
||||
Enlisted[key] = enlistedOfT;
|
||||
return enlistedOfT.Item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,41 @@ namespace Umbraco.Core.Security
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will return the current back office identity if the IPrincipal is the correct type
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
internal static UmbracoBackOfficeIdentity GetUmbracoIdentity(this IPrincipal user)
|
||||
{
|
||||
//If it's already a UmbracoBackOfficeIdentity
|
||||
var backOfficeIdentity = user.Identity as UmbracoBackOfficeIdentity;
|
||||
if (backOfficeIdentity != null) return backOfficeIdentity;
|
||||
|
||||
//Check if there's more than one identity assigned and see if it's a UmbracoBackOfficeIdentity and use that
|
||||
var claimsPrincipal = user as ClaimsPrincipal;
|
||||
if (claimsPrincipal != null)
|
||||
{
|
||||
backOfficeIdentity = claimsPrincipal.Identities.OfType<UmbracoBackOfficeIdentity>().FirstOrDefault();
|
||||
if (backOfficeIdentity != null) return backOfficeIdentity;
|
||||
}
|
||||
|
||||
//Otherwise convert to a UmbracoBackOfficeIdentity if it's auth'd and has the back office session
|
||||
var claimsIdentity = user.Identity as ClaimsIdentity;
|
||||
if (claimsIdentity != null && claimsIdentity.IsAuthenticated && claimsIdentity.HasClaim(x => x.Type == Constants.Security.SessionIdClaimType))
|
||||
{
|
||||
try
|
||||
{
|
||||
return UmbracoBackOfficeIdentity.FromClaimsIdentity(claimsIdentity);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will return the current back office identity.
|
||||
@@ -100,31 +134,8 @@ namespace Umbraco.Core.Security
|
||||
if (http.User == null) return null; //there's no user at all so no identity
|
||||
|
||||
//If it's already a UmbracoBackOfficeIdentity
|
||||
var backOfficeIdentity = http.User.Identity as UmbracoBackOfficeIdentity;
|
||||
if (backOfficeIdentity != null) return backOfficeIdentity;
|
||||
|
||||
//Check if there's more than one identity assigned and see if it's a UmbracoBackOfficeIdentity and use that
|
||||
var claimsPrincipal = http.User as ClaimsPrincipal;
|
||||
if (claimsPrincipal != null)
|
||||
{
|
||||
backOfficeIdentity = claimsPrincipal.Identities.OfType<UmbracoBackOfficeIdentity>().FirstOrDefault();
|
||||
if (backOfficeIdentity != null) return backOfficeIdentity;
|
||||
}
|
||||
|
||||
//Otherwise convert to a UmbracoBackOfficeIdentity if it's auth'd and has the back office session
|
||||
var claimsIdentity = http.User.Identity as ClaimsIdentity;
|
||||
if (claimsIdentity != null && claimsIdentity.IsAuthenticated && claimsIdentity.HasClaim(x => x.Type == Constants.Security.SessionIdClaimType))
|
||||
{
|
||||
try
|
||||
{
|
||||
return UmbracoBackOfficeIdentity.FromClaimsIdentity(claimsIdentity);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
//This will occur if the required claim types are missing which would mean something strange is going on
|
||||
LogHelper.Error(typeof(AuthenticationExtensions), "The current identity cannot be converted to " + typeof(UmbracoBackOfficeIdentity), ex);
|
||||
}
|
||||
}
|
||||
var backOfficeIdentity = GetUmbracoIdentity(http.User);
|
||||
if (backOfficeIdentity != null) return backOfficeIdentity;
|
||||
|
||||
if (authenticateRequestIfNotFound == false) return null;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Web.Configuration;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Security;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Core.Security
|
||||
{
|
||||
@@ -520,7 +521,11 @@ namespace Umbraco.Core.Security
|
||||
|
||||
public override string ResetPassword(string username, string answer)
|
||||
{
|
||||
if (EnablePasswordReset == false)
|
||||
var userService = ApplicationContext.Current == null ? null : ApplicationContext.Current.Services.UserService;
|
||||
|
||||
var canReset = this.CanResetPassword(userService);
|
||||
|
||||
if (canReset == false)
|
||||
{
|
||||
throw new NotSupportedException("Password reset is not supported");
|
||||
}
|
||||
|
||||
@@ -9,12 +9,45 @@ using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Security;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core.Security
|
||||
{
|
||||
public static class MembershipProviderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension method to check if a password can be reset based on a given provider and the current request (logged in user)
|
||||
/// </summary>
|
||||
/// <param name="provider"></param>
|
||||
/// <param name="userService"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool CanResetPassword(this MembershipProvider provider, IUserService userService)
|
||||
{
|
||||
if (provider == null) throw new ArgumentNullException("provider");
|
||||
|
||||
var canReset = provider.EnablePasswordReset;
|
||||
|
||||
if (userService == null) return canReset;
|
||||
|
||||
//we need to check for the special case in which a user is an admin - in which acse they can reset the password even if EnablePasswordReset == false
|
||||
if (provider.EnablePasswordReset == false)
|
||||
{
|
||||
var identity = Thread.CurrentPrincipal.GetUmbracoIdentity();
|
||||
if (identity != null)
|
||||
{
|
||||
var user = userService.GetByUsername(identity.Username);
|
||||
var userIsAdmin = user.IsAdmin();
|
||||
if (userIsAdmin)
|
||||
{
|
||||
canReset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return canReset;
|
||||
}
|
||||
|
||||
internal static MembershipUserCollection FindUsersByName(this MembershipProvider provider, string usernameToMatch)
|
||||
{
|
||||
int totalRecords = 0;
|
||||
|
||||
@@ -1124,7 +1124,9 @@ namespace Umbraco.Core.Services
|
||||
/// <returns>True if unpublishing succeeded, otherwise False</returns>
|
||||
public bool UnPublish(IContent content, int userId = 0)
|
||||
{
|
||||
return ((IContentServiceOperations)this).UnPublish(content, userId).Success;
|
||||
var attempt = ((IContentServiceOperations)this).UnPublish(content, userId);
|
||||
LogHelper.Debug<ContentService>(string.Format("Result of unpublish attempt: {0}", attempt.Result.StatusType));
|
||||
return attempt.Success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.CodeAnnotations;
|
||||
using Umbraco.Core.Events;
|
||||
@@ -81,28 +80,16 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly:true))
|
||||
{
|
||||
switch (umbracoObjectType)
|
||||
{
|
||||
case UmbracoObjectTypes.Document:
|
||||
case UmbracoObjectTypes.MemberType:
|
||||
case UmbracoObjectTypes.Media:
|
||||
case UmbracoObjectTypes.Template:
|
||||
case UmbracoObjectTypes.MediaType:
|
||||
case UmbracoObjectTypes.DocumentType:
|
||||
case UmbracoObjectTypes.Member:
|
||||
case UmbracoObjectTypes.DataType:
|
||||
case UmbracoObjectTypes.DocumentTypeContainer:
|
||||
return uow.Database.ExecuteScalar<int?>(new Sql().Select("id").From<NodeDto>().Where<NodeDto>(dto => dto.UniqueId == key));
|
||||
case UmbracoObjectTypes.RecycleBin:
|
||||
case UmbracoObjectTypes.Stylesheet:
|
||||
case UmbracoObjectTypes.MemberGroup:
|
||||
case UmbracoObjectTypes.ContentItem:
|
||||
case UmbracoObjectTypes.ContentItemType:
|
||||
case UmbracoObjectTypes.ROOT:
|
||||
case UmbracoObjectTypes.Unknown:
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
var nodeObjectType = GetNodeObjectTypeGuid(umbracoObjectType);
|
||||
|
||||
var sql = new Sql()
|
||||
.Select("id")
|
||||
.From<NodeDto>()
|
||||
.Where<NodeDto>(
|
||||
dto =>
|
||||
dto.UniqueId == key &&
|
||||
dto.NodeObjectType == nodeObjectType);
|
||||
return uow.Database.ExecuteScalar<int?>(sql);
|
||||
}
|
||||
});
|
||||
return result.HasValue ? Attempt.Succeed(result.Value) : Attempt<int>.Fail();
|
||||
@@ -120,32 +107,30 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly:true))
|
||||
{
|
||||
switch (umbracoObjectType)
|
||||
{
|
||||
case UmbracoObjectTypes.Document:
|
||||
case UmbracoObjectTypes.MemberType:
|
||||
case UmbracoObjectTypes.Media:
|
||||
case UmbracoObjectTypes.Template:
|
||||
case UmbracoObjectTypes.MediaType:
|
||||
case UmbracoObjectTypes.DocumentType:
|
||||
case UmbracoObjectTypes.Member:
|
||||
case UmbracoObjectTypes.DataType:
|
||||
return uow.Database.ExecuteScalar<Guid?>(new Sql().Select("uniqueID").From<NodeDto>().Where<NodeDto>(dto => dto.NodeId == id));
|
||||
case UmbracoObjectTypes.RecycleBin:
|
||||
case UmbracoObjectTypes.Stylesheet:
|
||||
case UmbracoObjectTypes.MemberGroup:
|
||||
case UmbracoObjectTypes.ContentItem:
|
||||
case UmbracoObjectTypes.ContentItemType:
|
||||
case UmbracoObjectTypes.ROOT:
|
||||
case UmbracoObjectTypes.Unknown:
|
||||
default:
|
||||
throw new NotSupportedException("Unsupported object type (" + umbracoObjectType + ").");
|
||||
}
|
||||
var nodeObjectType = GetNodeObjectTypeGuid(umbracoObjectType);
|
||||
|
||||
var sql = new Sql()
|
||||
.Select("uniqueID")
|
||||
.From<NodeDto>()
|
||||
.Where<NodeDto>(
|
||||
dto =>
|
||||
dto.NodeId == id &&
|
||||
dto.NodeObjectType == nodeObjectType);
|
||||
return uow.Database.ExecuteScalar<Guid?>(sql);
|
||||
}
|
||||
});
|
||||
return result.HasValue ? Attempt.Succeed(result.Value) : Attempt<Guid>.Fail();
|
||||
}
|
||||
|
||||
private static Guid GetNodeObjectTypeGuid(UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
var guid = umbracoObjectType.GetGuid();
|
||||
if (guid == Guid.Empty)
|
||||
throw new NotSupportedException("Unsupported object type (" + umbracoObjectType + ").");
|
||||
|
||||
return guid;
|
||||
}
|
||||
|
||||
public IUmbracoEntity GetByKey(Guid key, bool loadBaseType = true)
|
||||
{
|
||||
if (loadBaseType)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
@@ -6,6 +7,15 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
public interface IPackagingService : IService
|
||||
{
|
||||
/// <summary>
|
||||
/// This will fetch an Umbraco package file from the package repository and return the relative file path to the downloaded package file
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="umbracoVersion"></param>
|
||||
/// <param name="userId">The current user id performing the operation</param>
|
||||
/// <returns></returns>
|
||||
string FetchPackageFile(Guid packageId, Version umbracoVersion, int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Imports and saves package xml as <see cref="IContent"/>
|
||||
/// </summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Auditing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -75,6 +80,61 @@ namespace Umbraco.Core.Services
|
||||
_importedContentTypes = new Dictionary<string, IContentType>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will fetch an Umbraco package file from the package repository and return the relative file path to the downloaded package file
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="umbracoVersion"></param>
|
||||
/// /// <param name="userId">The current user id performing the operation</param>
|
||||
/// <returns></returns>
|
||||
public string FetchPackageFile(Guid packageId, Version umbracoVersion, int userId)
|
||||
{
|
||||
var packageRepo = UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault();
|
||||
|
||||
using (var httpClient = new HttpClient())
|
||||
using (var uow = _uowProvider.GetUnitOfWork())
|
||||
{
|
||||
//includeHidden = true because we don't care if it's hidden we want to get the file regardless
|
||||
var url = string.Format("{0}/{1}?version={2}&includeHidden=true&asFile=true", packageRepo.RestApiUrl, packageId, umbracoVersion.ToString(3));
|
||||
byte[] bytes;
|
||||
try
|
||||
{
|
||||
bytes = httpClient.GetByteArrayAsync(url).GetAwaiter().GetResult();
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
throw new ConnectionException("An error occuring downloading the package from " + url, ex);
|
||||
}
|
||||
|
||||
//successfull
|
||||
if (bytes.Length > 0)
|
||||
{
|
||||
var packagePath = IOHelper.MapPath(SystemDirectories.Packages);
|
||||
|
||||
// Check for package directory
|
||||
if (Directory.Exists(packagePath) == false)
|
||||
Directory.CreateDirectory(packagePath);
|
||||
|
||||
var packageFilePath = Path.Combine(packagePath, packageId + ".umb");
|
||||
|
||||
using (var fs1 = new FileStream(packageFilePath, FileMode.Create))
|
||||
{
|
||||
fs1.Write(bytes, 0, bytes.Length);
|
||||
return "packages\\" + packageId + ".umb";
|
||||
}
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.PackagerInstall, string.Format("Package {0} fetched from {1}", packageId, packageRepo.Id), userId, -1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void Audit(IScopeUnitOfWork uow, AuditType type, string message, int userId, int objectId)
|
||||
{
|
||||
var auditRepo = _repositoryFactory.CreateAuditRepository(uow);
|
||||
auditRepo.AddOrUpdate(new AuditItem(objectId, message, type, userId));
|
||||
}
|
||||
|
||||
#region Content
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -53,13 +53,14 @@
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImageProcessor, Version=2.5.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageProcessor.2.5.2\lib\net45\ImageProcessor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="ImageProcessor, Version=2.5.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageProcessor.2.5.3\lib\net45\ImageProcessor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Log4Net.Async, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Log4Net.Async.2.0.4\lib\net40\Log4Net.Async.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
|
||||
@@ -89,13 +90,11 @@
|
||||
<HintPath>..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
@@ -293,6 +292,7 @@
|
||||
<Compile Include="Configuration\UmbracoSettings\RazorStaticMappingElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoriesCollection.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoriesElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoryConfigExtensions.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RepositoryElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\RequestHandlerElement.cs" />
|
||||
<Compile Include="Configuration\UmbracoSettings\ScheduledTaskElement.cs" />
|
||||
@@ -339,6 +339,7 @@
|
||||
<Compile Include="Events\IDeletingMediaFilesEventArgs.cs" />
|
||||
<Compile Include="Events\ScopeEventDispatcherBase.cs" />
|
||||
<Compile Include="Events\ScopeLifespanMessagesFactory.cs" />
|
||||
<Compile Include="Exceptions\ConnectionException.cs" />
|
||||
<Compile Include="IHttpContextAccessor.cs" />
|
||||
<Compile Include="Models\PublishedContent\PublishedContentTypeConverter.cs" />
|
||||
<Compile Include="OrderedHashSet.cs" />
|
||||
@@ -496,8 +497,8 @@
|
||||
<Compile Include="Persistence\Mappers\MigrationEntryMapper.cs" />
|
||||
<Compile Include="Persistence\Migrations\LocalMigrationContext.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionFourOneZero\AddPreviewXmlTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveFive\AddLockObjects.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveFive\AddLockTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\AddLockObjects.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\AddLockTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveFive\UpdateAllowedMediaTypesAtRoot.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveZero\EnsureServersLockObject.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveZero\AddRedirectUrlTable.cs" />
|
||||
@@ -515,6 +516,8 @@
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\AddIndexToUser2NodePermission.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\AddRelationTypeUniqueIdColumn.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\AddMacroUniqueIdColumn.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\ReduceLoginNameColumnsSize.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\NormalizeTemplateGuids.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\RemovePropertyDataIdIndex.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenSixZero\RemoveUmbracoDeployTables.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeTwo\EnsureMigrationsTableIdentityIsCorrect.cs" />
|
||||
|
||||
@@ -49,8 +49,6 @@ namespace Umbraco.Core
|
||||
LogHelper.Error<UmbracoApplicationBase>(msg, exception);
|
||||
};
|
||||
|
||||
BindingRedirects.Initialize();
|
||||
|
||||
//boot up the application
|
||||
GetBootManager()
|
||||
.Initialize()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
@@ -30,11 +30,15 @@
|
||||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup><system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="MySql.Data.MySqlClient" />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
</DbProviderFactories>
|
||||
</system.data></configuration>
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
<packages>
|
||||
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
|
||||
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net45" />
|
||||
<package id="ImageProcessor" version="2.5.2" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.5" targetFramework="net45" />
|
||||
<package id="ImageProcessor" version="2.5.3" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
<package id="Log4Net.Async" version="2.0.4" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
@@ -11,14 +12,14 @@
|
||||
<package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net45" />
|
||||
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
|
||||
<package id="MySql.Data" version="6.9.8" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
|
||||
<package id="MySql.Data" version="6.9.9" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
<package id="Semver" version="2.0.4" targetFramework="net45" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
|
||||
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
|
||||
<package id="System.Runtime" version="4.1.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.Extensions" version="4.1.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="net45" />
|
||||
<package id="System.Text.RegularExpressions" version="4.1.0" targetFramework="net45" />
|
||||
<package id="System.Runtime" version="4.3.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net45" />
|
||||
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -45,7 +45,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
@@ -71,6 +71,10 @@
|
||||
<assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
<HintPath>..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.41\lib\net40\Microsoft.Diagnostics.Tracing.TraceEvent.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Moq, Version=4.7.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Moq.4.7.0\lib\net45\Moq.dll</HintPath>
|
||||
<Reference Include="Moq, Version=4.1.1309.919, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Moq.4.1.1309.0919\lib\net40\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<package id="Microsoft.CodeAnalysis.CSharp" version="1.3.2" targetFramework="net45" />
|
||||
<package id="Microsoft.Diagnostics.Tracing.TraceEvent" version="1.0.41" targetFramework="net45" />
|
||||
<package id="Microsoft.SqlServer.Compact" version="4.0.8854.1" targetFramework="net45" />
|
||||
<package id="Moq" version="4.7.0" targetFramework="net45" />
|
||||
<package id="Moq" version="4.1.1309.0919" targetFramework="net45" />
|
||||
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
|
||||
<package id="System.Collections" version="4.0.11" targetFramework="net45" />
|
||||
<package id="System.Collections.Concurrent" version="4.0.12" targetFramework="net45" />
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
@@ -200,6 +200,14 @@
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
</assemblyBinding>
|
||||
|
||||
</runtime>
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
using log4net.Core;
|
||||
using log4net.Layout;
|
||||
using log4net.Repository;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Tests.Logging
|
||||
{
|
||||
[TestFixture]
|
||||
public class AsyncRollingFileAppenderTest
|
||||
{
|
||||
private const string ErrorMessage = "TEST ERROR MESSAGE";
|
||||
private const string FileFolderPath = @"c:\LogTesting\";
|
||||
private readonly Level ErrorLevel = Level.Error;
|
||||
private AsynchronousRollingFileAppender appender;
|
||||
private ILoggerRepository rep;
|
||||
private Guid fileGuid;
|
||||
|
||||
private string GetFilePath()
|
||||
{
|
||||
return string.Format("{0}{1}.log", FileFolderPath, fileGuid);
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
fileGuid = Guid.NewGuid();
|
||||
if (File.Exists(GetFilePath()))
|
||||
{
|
||||
File.Delete(GetFilePath());
|
||||
}
|
||||
|
||||
appender = new AsynchronousRollingFileAppender();
|
||||
appender.Threshold = ErrorLevel;
|
||||
appender.File = GetFilePath();
|
||||
appender.Layout = new PatternLayout("%d|%-5level|%logger| %message %exception%n");
|
||||
appender.StaticLogFileName = true;
|
||||
appender.AppendToFile = true;
|
||||
appender.ActivateOptions();
|
||||
|
||||
rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
|
||||
BasicConfigurator.Configure(rep, appender);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
rep.Shutdown();
|
||||
if (File.Exists(GetFilePath()))
|
||||
{
|
||||
File.Delete(GetFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void FixtureTearDown()
|
||||
{
|
||||
foreach (string file in Directory.GetFiles(FileFolderPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
private void ReleaseFileLocks()
|
||||
{
|
||||
rep.Shutdown();
|
||||
appender.Close();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanWriteToFile()
|
||||
{
|
||||
// Arrange
|
||||
ILog log = LogManager.GetLogger(rep.Name, "CanWriteToDatabase");
|
||||
|
||||
// Act
|
||||
log.Error(ErrorMessage);
|
||||
Thread.Sleep(200); // let background thread finish
|
||||
|
||||
// Assert
|
||||
ReleaseFileLocks();
|
||||
Assert.That(File.Exists(GetFilePath()), Is.True);
|
||||
IEnumerable<string> readLines = File.ReadLines(GetFilePath());
|
||||
Assert.That(readLines.Count(), Is.GreaterThanOrEqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReturnsQuicklyAfterLogging100Messages()
|
||||
{
|
||||
// Arrange
|
||||
ILog log = LogManager.GetLogger(rep.Name, "ReturnsQuicklyAfterLogging100Messages");
|
||||
|
||||
// Act
|
||||
DateTime startTime = DateTime.UtcNow;
|
||||
100.Times(i => log.Error(ErrorMessage));
|
||||
DateTime endTime = DateTime.UtcNow;
|
||||
|
||||
// Give background thread time to finish
|
||||
Thread.Sleep(500);
|
||||
|
||||
// Assert
|
||||
ReleaseFileLocks();
|
||||
Assert.That(endTime - startTime, Is.LessThan(TimeSpan.FromMilliseconds(100)));
|
||||
Assert.That(File.Exists(GetFilePath()), Is.True);
|
||||
IEnumerable<string> readLines = File.ReadLines(GetFilePath());
|
||||
Assert.That(readLines.Count(), Is.GreaterThanOrEqualTo(100));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore]
|
||||
public void CanLogAtleast1000MessagesASecond()
|
||||
{
|
||||
// Arrange
|
||||
ILog log = LogManager.GetLogger(rep.Name, "CanLogAtLeast1000MessagesASecond");
|
||||
|
||||
int logCount = 0;
|
||||
bool logging = true;
|
||||
bool logsCounted = false;
|
||||
|
||||
var logTimer = new Timer(s =>
|
||||
{
|
||||
logging = false;
|
||||
|
||||
if (File.Exists(GetFilePath()))
|
||||
{
|
||||
ReleaseFileLocks();
|
||||
IEnumerable<string> readLines = File.ReadLines(GetFilePath());
|
||||
logCount = readLines.Count();
|
||||
}
|
||||
logsCounted = true;
|
||||
}, null, TimeSpan.FromSeconds(3), TimeSpan.FromMilliseconds(-1));
|
||||
|
||||
// Act
|
||||
DateTime startTime = DateTime.UtcNow;
|
||||
while (logging)
|
||||
{
|
||||
log.Error(ErrorMessage);
|
||||
}
|
||||
TimeSpan testDuration = DateTime.UtcNow - startTime;
|
||||
|
||||
while (!logsCounted)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
|
||||
logTimer.Dispose();
|
||||
|
||||
// Assert
|
||||
var logsPerSecond = logCount / testDuration.TotalSeconds;
|
||||
|
||||
Debug.Print("{0} messages logged in {1}s => {2}/s", logCount, testDuration.TotalSeconds, logsPerSecond);
|
||||
Assert.That(logsPerSecond, Is.GreaterThan(1000), "Must log at least 1000 messages per second");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using log4net.Appender;
|
||||
using log4net.Core;
|
||||
|
||||
namespace Umbraco.Tests.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
|
||||
/// </summary>
|
||||
public class DebugAppender : MemoryAppender
|
||||
{
|
||||
public TimeSpan AppendDelay { get; set; }
|
||||
public int LoggedEventCount { get { return m_eventsList.Count; } }
|
||||
|
||||
protected override void Append(LoggingEvent loggingEvent)
|
||||
{
|
||||
if (AppendDelay > TimeSpan.Zero)
|
||||
{
|
||||
Thread.Sleep(AppendDelay);
|
||||
}
|
||||
base.Append(loggingEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,327 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Principal;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using log4net.Appender;
|
||||
using log4net.Config;
|
||||
using log4net.Core;
|
||||
using log4net.Filter;
|
||||
using log4net.Repository;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Tests.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class ParallelForwarderTest : IDisposable
|
||||
{
|
||||
private ParallelForwardingAppender asyncForwardingAppender;
|
||||
private DebugAppender debugAppender;
|
||||
private ILoggerRepository repository;
|
||||
private ILog log;
|
||||
|
||||
[SetUp]
|
||||
public void TestFixtureSetUp()
|
||||
{
|
||||
debugAppender = new DebugAppender();
|
||||
debugAppender.ActivateOptions();
|
||||
|
||||
asyncForwardingAppender = new ParallelForwardingAppender();
|
||||
asyncForwardingAppender.AddAppender(debugAppender);
|
||||
asyncForwardingAppender.ActivateOptions();
|
||||
|
||||
repository = LogManager.CreateRepository(Guid.NewGuid().ToString());
|
||||
BasicConfigurator.Configure(repository, asyncForwardingAppender);
|
||||
|
||||
log = LogManager.GetLogger(repository.Name, "TestLogger");
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
LogManager.Shutdown();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanHandleNullLoggingEvent()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
asyncForwardingAppender.DoAppend((LoggingEvent)null);
|
||||
log.Info("SusequentMessage");
|
||||
asyncForwardingAppender.Close();
|
||||
|
||||
// Assert - should not have had an exception from previous call
|
||||
Assert.That(debugAppender.LoggedEventCount, Is.EqualTo(1), "Expected subsequent message only");
|
||||
Assert.That(debugAppender.GetEvents()[0].MessageObject, Is.EqualTo("SusequentMessage"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanHandleNullLoggingEvents()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
asyncForwardingAppender.DoAppend((LoggingEvent[])null);
|
||||
log.Info("SusequentMessage");
|
||||
asyncForwardingAppender.Close();
|
||||
|
||||
// Assert - should not have had an exception from previous call
|
||||
Assert.That(debugAppender.LoggedEventCount, Is.EqualTo(1), "Expected subsequent message only");
|
||||
Assert.That(debugAppender.GetEvents()[0].MessageObject, Is.EqualTo("SusequentMessage"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanHandleAppenderThrowing()
|
||||
{
|
||||
// Arrange
|
||||
var badAppender = new Mock<IAppender>();
|
||||
asyncForwardingAppender.AddAppender(badAppender.Object);
|
||||
|
||||
badAppender
|
||||
.Setup(ba => ba.DoAppend(It.IsAny<LoggingEvent>()))
|
||||
.Throws(new Exception("Bad Appender"));
|
||||
//.Verifiable();
|
||||
|
||||
// Act
|
||||
log.Info("InitialMessage");
|
||||
log.Info("SusequentMessage");
|
||||
asyncForwardingAppender.Close();
|
||||
|
||||
// Assert
|
||||
Assert.That(debugAppender.LoggedEventCount, Is.EqualTo(2));
|
||||
Assert.That(debugAppender.GetEvents()[1].MessageObject, Is.EqualTo("SusequentMessage"));
|
||||
badAppender.Verify(appender => appender.DoAppend(It.IsAny<LoggingEvent>()), Times.Exactly(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillLogFastWhenThereIsASlowAppender()
|
||||
{
|
||||
const int testSize = 1000;
|
||||
|
||||
// Arrange
|
||||
debugAppender.AppendDelay = TimeSpan.FromSeconds(30);
|
||||
var watch = new Stopwatch();
|
||||
|
||||
// Act
|
||||
watch.Start();
|
||||
for (int i = 0; i < testSize; i++)
|
||||
{
|
||||
log.Error("Exception");
|
||||
}
|
||||
watch.Stop();
|
||||
|
||||
// Assert
|
||||
Assert.That(debugAppender.LoggedEventCount, Is.EqualTo(0));
|
||||
Assert.That(watch.ElapsedMilliseconds, Is.LessThan(testSize));
|
||||
Debug.Print("Logged {0} errors in {1}ms", testSize, watch.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillNotOverflow()
|
||||
{
|
||||
const int testSize = 1000;
|
||||
|
||||
// Arrange
|
||||
debugAppender.AppendDelay = TimeSpan.FromMilliseconds(1);
|
||||
asyncForwardingAppender.BufferSize = 100;
|
||||
|
||||
// Act
|
||||
for (int i = 0; i < testSize; i++)
|
||||
{
|
||||
log.Error("Exception");
|
||||
}
|
||||
|
||||
while (asyncForwardingAppender.BufferEntryCount > 0) ;
|
||||
asyncForwardingAppender.Close();
|
||||
|
||||
// Assert
|
||||
Assert.That(debugAppender.LoggedEventCount, Is.EqualTo(testSize));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillTryToFlushBufferOnShutdown()
|
||||
{
|
||||
const int testSize = 250;
|
||||
|
||||
// Arrange
|
||||
debugAppender.AppendDelay = TimeSpan.FromMilliseconds(1);
|
||||
|
||||
// Act
|
||||
for (int i = 0; i < testSize; i++)
|
||||
{
|
||||
log.Error("Exception");
|
||||
}
|
||||
|
||||
Thread.Sleep(50);
|
||||
|
||||
var numberLoggedBeforeClose = debugAppender.LoggedEventCount;
|
||||
asyncForwardingAppender.Close();
|
||||
var numberLoggedAfterClose = debugAppender.LoggedEventCount;
|
||||
|
||||
// Assert
|
||||
//We can't use specific numbers here because the timing and counts will be different on different systems.
|
||||
Assert.That(numberLoggedBeforeClose, Is.GreaterThan(0), "Some number of Logging events should be logged prior to appender close.");
|
||||
//On some systems, we may not be able to flush all events prior to close, but it is reasonable to assume in this test case
|
||||
//that some events should be logged after close.
|
||||
Assert.That(numberLoggedAfterClose, Is.GreaterThan(numberLoggedBeforeClose), "Some number of LoggingEvents should be logged after close.");
|
||||
Debug.Print("Flushed {0} events during shutdown", numberLoggedAfterClose - numberLoggedBeforeClose);
|
||||
}
|
||||
|
||||
[Test, Explicit("Long-running")]
|
||||
public void WillShutdownIfBufferCannotBeFlushedFastEnough()
|
||||
{
|
||||
const int testSize = 250;
|
||||
|
||||
// Arrange
|
||||
debugAppender.AppendDelay = TimeSpan.FromSeconds(1);
|
||||
Stopwatch watch = new Stopwatch();
|
||||
|
||||
// Act
|
||||
for (int i = 0; i < testSize; i++)
|
||||
{
|
||||
log.Error("Exception");
|
||||
}
|
||||
|
||||
Thread.Sleep(TimeSpan.FromSeconds(2));
|
||||
var numberLoggedBeforeClose = debugAppender.LoggedEventCount;
|
||||
|
||||
watch.Start();
|
||||
asyncForwardingAppender.Close();
|
||||
watch.Stop();
|
||||
|
||||
var numberLoggedAfterClose = debugAppender.LoggedEventCount;
|
||||
|
||||
// Assert
|
||||
Assert.That(numberLoggedBeforeClose, Is.GreaterThan(0));
|
||||
Assert.That(numberLoggedAfterClose, Is.GreaterThan(numberLoggedBeforeClose));
|
||||
Assert.That(numberLoggedAfterClose, Is.LessThan(testSize));
|
||||
//We can't assume what the shutdown time will be. It will vary from system to system. Don't test shutdown time.
|
||||
var events = debugAppender.GetEvents();
|
||||
var evnt = events[events.Length - 1];
|
||||
Assert.That(evnt.MessageObject, Is.EqualTo("The buffer was not able to be flushed before timeout occurred."));
|
||||
Debug.Print("Flushed {0} events during shutdown which lasted {1}ms", numberLoggedAfterClose - numberLoggedBeforeClose, watch.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThreadContextPropertiesArePreserved()
|
||||
{
|
||||
// Arrange
|
||||
ThreadContext.Properties["TestProperty"] = "My Value";
|
||||
Assert.That(asyncForwardingAppender.Fix & FixFlags.Properties, Is.EqualTo(FixFlags.Properties), "Properties must be fixed if they are to be preserved");
|
||||
|
||||
// Act
|
||||
log.Info("Information");
|
||||
asyncForwardingAppender.Close();
|
||||
|
||||
// Assert
|
||||
var lastLoggedEvent = debugAppender.GetEvents()[0];
|
||||
Assert.That(lastLoggedEvent.Properties["TestProperty"], Is.EqualTo("My Value"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MessagesExcludedByFilterShouldNotBeAppended()
|
||||
{
|
||||
// Arrange
|
||||
var levelFilter =
|
||||
new LevelRangeFilter
|
||||
{
|
||||
LevelMin = Level.Warn,
|
||||
LevelMax = Level.Error,
|
||||
};
|
||||
|
||||
asyncForwardingAppender.AddFilter(levelFilter);
|
||||
|
||||
// Act
|
||||
log.Info("Info");
|
||||
log.Warn("Warn");
|
||||
log.Error("Error");
|
||||
log.Fatal("Fatal");
|
||||
|
||||
asyncForwardingAppender.Close();
|
||||
|
||||
//Assert
|
||||
Assert.That(debugAppender.LoggedEventCount, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void HelperCanGenerateLoggingEventWithAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
var helper = new LoggingEventHelper("TestLoggerName", FixFlags.All);
|
||||
ThreadContext.Properties["MyProperty"] = "MyValue";
|
||||
var exception = new Exception("SomeError");
|
||||
|
||||
var stackFrame = new StackFrame(0);
|
||||
var currentUser = WindowsIdentity.GetCurrent();
|
||||
var loggingTime = DateTime.Now; // Log4Net does not seem to be using UtcNow
|
||||
|
||||
// Act
|
||||
var loggingEvent = helper.CreateLoggingEvent(Level.Emergency, "Who's on live support?", exception);
|
||||
Thread.Sleep(50); // to make sure the time stamp is actually captured
|
||||
|
||||
// Assert
|
||||
Assert.That(loggingEvent.Domain, Is.EqualTo(AppDomain.CurrentDomain.FriendlyName), "Domain");
|
||||
//The identity assigned to new threads is dependent upon AppDomain principal policy.
|
||||
//Background information here:http://www.neovolve.com/post/2010/10/21/Unit-testing-a-workflow-that-relies-on-ThreadCurrentPrincipalIdentityName.aspx
|
||||
//VS2013 does have a principal assigned to new threads in the unit test.
|
||||
//It's probably best not to test that the identity has been set.
|
||||
//Assert.That(loggingEvent.Identity, Is.Empty, "Identity: always empty for some reason");
|
||||
Assert.That(loggingEvent.UserName, Is.EqualTo(currentUser == null ? String.Empty : currentUser.Name), "UserName");
|
||||
Assert.That(loggingEvent.ThreadName, Is.EqualTo(Thread.CurrentThread.Name), "ThreadName");
|
||||
|
||||
Assert.That(loggingEvent.Repository, Is.Null, "Repository: Helper does not have access to this");
|
||||
Assert.That(loggingEvent.LoggerName, Is.EqualTo("TestLoggerName"), "LoggerName");
|
||||
|
||||
Assert.That(loggingEvent.Level, Is.EqualTo(Level.Emergency), "Level");
|
||||
//Raised time to within 10 ms. However, this may not be a valid test. The time is going to vary from system to system. The
|
||||
//tolerance setting here is arbitrary.
|
||||
Assert.That(loggingEvent.TimeStamp, Is.EqualTo(loggingTime).Within(TimeSpan.FromMilliseconds(10)), "TimeStamp");
|
||||
Assert.That(loggingEvent.ExceptionObject, Is.EqualTo(exception), "ExceptionObject");
|
||||
Assert.That(loggingEvent.MessageObject, Is.EqualTo("Who's on live support?"), "MessageObject");
|
||||
|
||||
Assert.That(loggingEvent.LocationInformation.MethodName, Is.EqualTo(stackFrame.GetMethod().Name), "LocationInformation");
|
||||
Assert.That(loggingEvent.Properties["MyProperty"], Is.EqualTo("MyValue"), "Properties");
|
||||
}
|
||||
|
||||
private bool _disposed = false;
|
||||
|
||||
//Implement IDisposable.
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (asyncForwardingAppender != null)
|
||||
{
|
||||
asyncForwardingAppender.Dispose();
|
||||
asyncForwardingAppender = null;
|
||||
}
|
||||
}
|
||||
// Free your own state (unmanaged objects).
|
||||
// Set large fields to null.
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Use C# destructor syntax for finalization code.
|
||||
~ParallelForwarderTest()
|
||||
{
|
||||
// Simply call Dispose(false).
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Borrowed from https://github.com/cjbhaines/Log4Net.Async - will reference Nuget packages directly in v8
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class RingBufferTest
|
||||
{
|
||||
[Test]
|
||||
public void PerfTest()
|
||||
{
|
||||
RingBuffer<string> ringBuffer = new RingBuffer<string>(1000);
|
||||
Stopwatch ringWatch = new Stopwatch();
|
||||
ringWatch.Start();
|
||||
for (int i = 0; i < 1000000; i++)
|
||||
{
|
||||
ringBuffer.Enqueue("StringOfFun");
|
||||
}
|
||||
ringWatch.Stop();
|
||||
|
||||
Assert.That(ringWatch.ElapsedMilliseconds, Is.LessThan(150));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PerfTestThreads()
|
||||
{
|
||||
RingBuffer<string> ringBuffer = new RingBuffer<string>(1000);
|
||||
|
||||
Stopwatch ringWatch = new Stopwatch();
|
||||
List<Task> ringTasks = new List<Task>();
|
||||
CancellationTokenSource cancelationTokenSource = new CancellationTokenSource();
|
||||
CancellationToken cancelationToken = cancelationTokenSource.Token;
|
||||
for (int t = 0; t < 10; t++)
|
||||
{
|
||||
ringTasks.Add(new Task(() =>
|
||||
{
|
||||
for (int i = 0; i < 1000000; i++)
|
||||
{
|
||||
ringBuffer.Enqueue("StringOfFun");
|
||||
}
|
||||
}, cancelationToken));
|
||||
}
|
||||
ringWatch.Start();
|
||||
ringTasks.ForEach(t => t.Start());
|
||||
var allTasks = ringTasks.ToArray();
|
||||
Task.WaitAny(allTasks);
|
||||
ringWatch.Stop();
|
||||
//Cancel tasks to avoid System.AppDominUnloadException which is caused when the domain is unloaded
|
||||
//and threads created in the domain are not stopped.
|
||||
//Do this before assertions because they may throw an exception causing the thread cancellation to not happen.
|
||||
cancelationTokenSource.Cancel();
|
||||
try
|
||||
{
|
||||
Task.WaitAll(allTasks);
|
||||
}
|
||||
catch (AggregateException)
|
||||
{
|
||||
//Don't care about cancellation Exceptions.
|
||||
}
|
||||
//Tolerance at 500 was too low
|
||||
ringTasks.ForEach(t => t.Dispose());
|
||||
Assert.That(ringWatch.ElapsedMilliseconds, Is.LessThan(1000));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PerfTestThreadsWithDequeues()
|
||||
{
|
||||
RingBuffer<string> ringBuffer = new RingBuffer<string>(1000);
|
||||
|
||||
Stopwatch ringWatch = new Stopwatch();
|
||||
List<Task> ringTasks = new List<Task>();
|
||||
CancellationTokenSource cancelationTokenSource = new CancellationTokenSource();
|
||||
CancellationToken cancelationToken = cancelationTokenSource.Token;
|
||||
for (int t = 0; t < 10; t++)
|
||||
{
|
||||
ringTasks.Add(new Task(() =>
|
||||
{
|
||||
for (int i = 0; i < 1000000; i++)
|
||||
{
|
||||
ringBuffer.Enqueue("StringOfFun");
|
||||
}
|
||||
}, cancelationToken));
|
||||
}
|
||||
for (int t = 0; t < 10; t++)
|
||||
{
|
||||
ringTasks.Add(new Task(() =>
|
||||
{
|
||||
for (int i = 0; i < 1000000; i++)
|
||||
{
|
||||
string foo;
|
||||
ringBuffer.TryDequeue(out foo);
|
||||
}
|
||||
}));
|
||||
}
|
||||
ringWatch.Start();
|
||||
ringTasks.ForEach(t => t.Start());
|
||||
var allTasks = ringTasks.ToArray();
|
||||
Task.WaitAny(allTasks);
|
||||
ringWatch.Stop();
|
||||
//Cancel tasks to avoid System.AppDominUnloadException which is caused when the domain is unloaded
|
||||
//and threads created in the domain are not stopped.
|
||||
//Do this before assertions because they may throw an exception causing the thread cancellation to not happen.
|
||||
cancelationTokenSource.Cancel();
|
||||
try
|
||||
{
|
||||
Task.WaitAll(allTasks);
|
||||
}
|
||||
catch (AggregateException)
|
||||
{
|
||||
//Don't care about cancellation Exceptions.
|
||||
}
|
||||
ringTasks.ForEach(t => t.Dispose());
|
||||
Assert.That(ringWatch.ElapsedMilliseconds, Is.LessThan(800));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WhenRingSizeLimitIsHit_ItemsAreDequeued()
|
||||
{
|
||||
// Arrange
|
||||
const int limit = 2;
|
||||
object object1 = "one";
|
||||
object object2 = "two";
|
||||
object object3 = "three";
|
||||
RingBuffer<object> queue = new RingBuffer<object>(limit);
|
||||
|
||||
// Act
|
||||
queue.Enqueue(object1);
|
||||
queue.Enqueue(object2);
|
||||
queue.Enqueue(object3);
|
||||
|
||||
// Assert
|
||||
object value;
|
||||
queue.TryDequeue(out value);
|
||||
Assert.That(value, Is.EqualTo(object2));
|
||||
queue.TryDequeue(out value);
|
||||
Assert.That(value, Is.EqualTo(object3));
|
||||
queue.TryDequeue(out value);
|
||||
Assert.That(value, Is.Null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -376,7 +376,7 @@ namespace Umbraco.Tests.PropertyEditors
|
||||
{
|
||||
var cropperJson = "{\"focalPoint\": {\"left\": 0.5,\"top\": 0.5},\"src\": \"" + mediaPath + "\",\"crops\": [{\"alias\": \"home\",\"width\": 270,\"height\": 161}]}";
|
||||
|
||||
var urlString = mediaPath.GetCropUrl(400, 400, cropperJson, imageCropMode: ImageCropMode.Pad, backgroundColor: "fff");
|
||||
var urlString = mediaPath.GetCropUrl(400, 400, cropperJson, imageCropMode: ImageCropMode.Pad, furtherOptions: "&bgcolor=fff");
|
||||
Assert.AreEqual(mediaPath + "?mode=pad&width=400&height=400&bgcolor=fff", urlString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
SiteDomainHelper.AddSite("site1", "domain1.com", "domain1.net", "domain1.org");
|
||||
SiteDomainHelper.AddSite("site2", "domain2.com", "domain2.net", "domain2.org");
|
||||
|
||||
|
||||
var sites = SiteDomainHelper.Sites;
|
||||
|
||||
Assert.AreEqual(2, sites.Count);
|
||||
|
||||
Assert.Contains("site1", sites.Keys);
|
||||
Assert.Contains("site2", sites.Keys);
|
||||
|
||||
|
||||
var domains = sites["site1"];
|
||||
Assert.AreEqual(3, domains.Count());
|
||||
Assert.Contains("domain1.com", domains);
|
||||
@@ -84,7 +84,7 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
Assert.Contains("site2", sites.Keys);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void AddSiteAgain()
|
||||
{
|
||||
@@ -175,15 +175,15 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
// map methods are not static because we can override them
|
||||
var helper = new SiteDomainHelper();
|
||||
|
||||
|
||||
// current is a site1 uri, domains contain current
|
||||
// so we'll get current
|
||||
//
|
||||
var current = new Uri("http://domain1.com/foo/bar");
|
||||
var output = helper.MapDomain(current, new[]
|
||||
{
|
||||
new DomainAndUri(new UmbracoDomain("domain1.com"), Uri.UriSchemeHttp),
|
||||
new DomainAndUri(new UmbracoDomain("domain2.com"), Uri.UriSchemeHttp),
|
||||
new DomainAndUri(new UmbracoDomain("domain1.com"), Uri.UriSchemeHttp),
|
||||
new DomainAndUri(new UmbracoDomain("domain2.com"), Uri.UriSchemeHttp),
|
||||
}).Uri.ToString();
|
||||
Assert.AreEqual("http://domain1.com/", output);
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace Umbraco.Tests.Routing
|
||||
current = new Uri("http://domain1.com/foo/bar");
|
||||
output = helper.MapDomain(current, new[]
|
||||
{
|
||||
new DomainAndUri(new UmbracoDomain("domain1.net"), Uri.UriSchemeHttp),
|
||||
new DomainAndUri(new UmbracoDomain("domain1.net"), Uri.UriSchemeHttp),
|
||||
new DomainAndUri(new UmbracoDomain("domain2.net"), Uri.UriSchemeHttp)
|
||||
}).Uri.ToString();
|
||||
Assert.AreEqual("http://domain1.net/", output);
|
||||
@@ -205,12 +205,73 @@ namespace Umbraco.Tests.Routing
|
||||
current = new Uri("http://domain1.com/foo/bar");
|
||||
output = helper.MapDomain(current, new[]
|
||||
{
|
||||
new DomainAndUri(new UmbracoDomain("domain2.net"), Uri.UriSchemeHttp),
|
||||
new DomainAndUri(new UmbracoDomain("domain2.net"), Uri.UriSchemeHttp),
|
||||
new DomainAndUri(new UmbracoDomain("domain1.net"), Uri.UriSchemeHttp)
|
||||
}).Uri.ToString();
|
||||
Assert.AreEqual("http://domain1.net/", output);
|
||||
}
|
||||
|
||||
private DomainAndUri[] DomainAndUris(Uri current, IDomain[] domains)
|
||||
{
|
||||
var scheme = current == null ? Uri.UriSchemeHttp : current.Scheme;
|
||||
return domains
|
||||
.Where(d => d.IsWildcard == false)
|
||||
.Select(d => new DomainAndUri(d, scheme))
|
||||
.OrderByDescending(d => d.Uri.ToString())
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MapDomainWithScheme()
|
||||
{
|
||||
SiteDomainHelper.AddSite("site1", "domain1.com", "domain1.net", "domain1.org");
|
||||
SiteDomainHelper.AddSite("site2", "domain2.com", "domain2.net", "domain2.org");
|
||||
SiteDomainHelper.AddSite("site3", "domain3.com", "domain3.net", "domain3.org");
|
||||
SiteDomainHelper.AddSite("site4", "https://domain4.com", "https://domain4.net", "https://domain4.org");
|
||||
|
||||
// map methods are not static because we can override them
|
||||
var helper = new SiteDomainHelper();
|
||||
|
||||
// this works, but it's purely by chance / arbitrary
|
||||
// don't use the www in tests here!
|
||||
var current = new Uri("https://www.domain1.com/foo/bar");
|
||||
var domainAndUris = DomainAndUris(current, new []
|
||||
{
|
||||
new UmbracoDomain("domain2.com"),
|
||||
new UmbracoDomain("domain1.com"),
|
||||
});
|
||||
var output = helper.MapDomain(current, domainAndUris).Uri.ToString();
|
||||
Assert.AreEqual("https://domain1.com/", output);
|
||||
|
||||
// will pick it all right
|
||||
current = new Uri("https://domain1.com/foo/bar");
|
||||
domainAndUris = DomainAndUris(current, new[]
|
||||
{
|
||||
new UmbracoDomain("https://domain1.com"),
|
||||
new UmbracoDomain("https://domain2.com")
|
||||
});
|
||||
output = helper.MapDomain(current, domainAndUris).Uri.ToString();
|
||||
Assert.AreEqual("https://domain1.com/", output);
|
||||
|
||||
current = new Uri("https://domain1.com/foo/bar");
|
||||
domainAndUris = DomainAndUris(current, new[]
|
||||
{
|
||||
new UmbracoDomain("https://domain1.com"),
|
||||
new UmbracoDomain("https://domain4.com")
|
||||
});
|
||||
output = helper.MapDomain(current, domainAndUris).Uri.ToString();
|
||||
Assert.AreEqual("https://domain1.com/", output);
|
||||
|
||||
current = new Uri("https://domain4.com/foo/bar");
|
||||
domainAndUris = DomainAndUris(current, new[]
|
||||
{
|
||||
new UmbracoDomain("https://domain1.com"),
|
||||
new UmbracoDomain("https://domain4.com")
|
||||
});
|
||||
output = helper.MapDomain(current, domainAndUris).Uri.ToString();
|
||||
Assert.AreEqual("https://domain4.com/", output);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MapDomains()
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Tests.Logging;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.Scheduling;
|
||||
|
||||
namespace Umbraco.Tests.Scheduling
|
||||
|
||||
@@ -591,7 +591,7 @@ namespace Umbraco.Tests.Scoping
|
||||
Assert.IsNull(scopeProvider.AmbientContext);
|
||||
|
||||
// back to original thread
|
||||
ScopeProvider.HttpContextItemsGetter = () => httpContextItems;
|
||||
ScopeProvider.HttpContextItemsGetter = () => httpContextItems;
|
||||
}
|
||||
Assert.IsNotNull(scopeProvider.AmbientScope);
|
||||
Assert.AreSame(scope, scopeProvider.AmbientScope);
|
||||
@@ -656,6 +656,44 @@ namespace Umbraco.Tests.Scoping
|
||||
Assert.IsNotNull(ambientContext); // the context is still there
|
||||
}
|
||||
|
||||
[TestCase(true)]
|
||||
[TestCase(false)]
|
||||
public void ScopeContextEnlistAgain(bool complete)
|
||||
{
|
||||
var scopeProvider = DatabaseContext.ScopeProvider;
|
||||
|
||||
bool? completed = null;
|
||||
Exception exception = null;
|
||||
|
||||
Assert.IsNull(scopeProvider.AmbientScope);
|
||||
using (var scope = scopeProvider.CreateScope())
|
||||
{
|
||||
scopeProvider.Context.Enlist("name", c =>
|
||||
{
|
||||
completed = c;
|
||||
|
||||
// at that point the scope is gone, but the context is still there
|
||||
var ambientContext = scopeProvider.AmbientContext;
|
||||
|
||||
try
|
||||
{
|
||||
ambientContext.Enlist("another", c2 => { });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e;
|
||||
}
|
||||
});
|
||||
if (complete)
|
||||
scope.Complete();
|
||||
}
|
||||
Assert.IsNull(scopeProvider.AmbientScope);
|
||||
Assert.IsNull(scopeProvider.AmbientContext);
|
||||
Assert.IsNotNull(completed);
|
||||
Assert.IsNotNull(exception);
|
||||
Assert.IsInstanceOf<InvalidOperationException>(exception);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ScopeContextException()
|
||||
{
|
||||
|
||||
@@ -27,27 +27,27 @@ namespace Umbraco.Tests.Services
|
||||
{
|
||||
//NOTE Maybe not the best way to create/save test data as we are using the services, which are being tested.
|
||||
|
||||
//Create and Save ContentType "umbTextpage" -> 1045
|
||||
//Create and Save ContentType "umbTextpage" -> 1060
|
||||
ContentType contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage", "Textpage");
|
||||
contentType.Key = new Guid("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522");
|
||||
ServiceContext.ContentTypeService.Save(contentType);
|
||||
|
||||
//Create and Save Content "Homepage" based on "umbTextpage" -> 1046
|
||||
//Create and Save Content "Homepage" based on "umbTextpage" -> 1061
|
||||
Content textpage = MockedContent.CreateSimpleContent(contentType);
|
||||
textpage.Key = new Guid("B58B3AD4-62C2-4E27-B1BE-837BD7C533E0");
|
||||
ServiceContext.ContentService.Save(textpage, 0);
|
||||
|
||||
//Create and Save Content "Text Page 1" based on "umbTextpage" -> 1047
|
||||
//Create and Save Content "Text Page 1" based on "umbTextpage" -> 1062
|
||||
Content subpage = MockedContent.CreateSimpleContent(contentType, "Text Page 1", textpage.Id);
|
||||
subpage.ReleaseDate = DateTime.Now.AddMinutes(-5);
|
||||
subpage.ChangePublishedState(PublishedState.Saved);
|
||||
ServiceContext.ContentService.Save(subpage, 0);
|
||||
|
||||
//Create and Save Content "Text Page 1" based on "umbTextpage" -> 1048
|
||||
//Create and Save Content "Text Page 1" based on "umbTextpage" -> 1063
|
||||
Content subpage2 = MockedContent.CreateSimpleContent(contentType, "Text Page 2", textpage.Id);
|
||||
ServiceContext.ContentService.Save(subpage2, 0);
|
||||
|
||||
//Create and Save Content "Text Page Deleted" based on "umbTextpage" -> 1049
|
||||
//Create and Save Content "Text Page Deleted" based on "umbTextpage" -> 1064
|
||||
Content trashed = MockedContent.CreateSimpleContent(contentType, "Text Page Deleted", -20);
|
||||
trashed.Trashed = true;
|
||||
ServiceContext.ContentService.Save(trashed, 0);
|
||||
|
||||
@@ -533,6 +533,44 @@ namespace Umbraco.Tests.Services
|
||||
Assert.AreEqual(mediaObjectType, UmbracoObjectTypes.MediaType);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EntityService_Can_Get_Key_For_Id()
|
||||
{
|
||||
var service = ServiceContext.EntityService;
|
||||
var result = service.GetKeyForId(1060, UmbracoObjectTypes.DocumentType);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.AreEqual(Guid.Parse("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522"), result.Result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EntityService_Cannot_Get_Key_For_Id_With_Incorrect_Object_Type()
|
||||
{
|
||||
var service = ServiceContext.EntityService;
|
||||
var result = service.GetKeyForId(1060, UmbracoObjectTypes.MediaType);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EntityService_Can_Get_Id_For_Key()
|
||||
{
|
||||
var service = ServiceContext.EntityService;
|
||||
var result = service.GetIdForKey(Guid.Parse("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522"), UmbracoObjectTypes.DocumentType);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.AreEqual(1060, result.Result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EntityService_Cannot_Get_Id_For_Key_With_Incorrect_Object_Type()
|
||||
{
|
||||
var service = ServiceContext.EntityService;
|
||||
var result = service.GetIdForKey(Guid.Parse("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522"), UmbracoObjectTypes.MediaType);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
}
|
||||
|
||||
private static bool _isSetup = false;
|
||||
|
||||
private int folderId;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Tests.Logging
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
public class ConsoleLogger : ILogger
|
||||
{
|
||||
@@ -58,14 +58,20 @@
|
||||
<Reference Include="AutoMapper.Net4, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Examine, Version=0.1.82.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.82\lib\net45\Examine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Log4Net.Async, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Log4Net.Async.2.0.4\lib\net40\Log4Net.Async.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll</HintPath>
|
||||
@@ -82,8 +88,8 @@
|
||||
<Reference Include="Moq, Version=4.1.1309.919, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Moq.4.1.1309.0919\lib\net40\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
|
||||
@@ -162,7 +168,7 @@
|
||||
<Compile Include="Issues\U9560.cs" />
|
||||
<Compile Include="Collections\OrderedHashSetTests.cs" />
|
||||
<Compile Include="IO\ShadowFileSystemTests.cs" />
|
||||
<Compile Include="Logging\ConsoleLogger.cs" />
|
||||
<Compile Include="TestHelpers\ConsoleLogger.cs" />
|
||||
<Compile Include="Migrations\CreateTableMigrationTests.cs" />
|
||||
<Compile Include="Migrations\MigrationIssuesTests.cs" />
|
||||
<Compile Include="Persistence\LocksTests.cs" />
|
||||
@@ -204,9 +210,6 @@
|
||||
<Compile Include="Collections\DeepCloneableListTests.cs" />
|
||||
<Compile Include="Web\Controllers\BackOfficeControllerUnitTests.cs" />
|
||||
<Compile Include="DelegateExtensionsTests.cs" />
|
||||
<Compile Include="Logging\AsyncRollingFileAppenderTest.cs" />
|
||||
<Compile Include="Logging\DebugAppender.cs" />
|
||||
<Compile Include="Logging\ParallelForwarderTest.cs" />
|
||||
<Compile Include="Web\Mvc\RenderIndexActionSelectorAttributeTests.cs" />
|
||||
<Compile Include="Persistence\Repositories\AuditRepositoryTest.cs" />
|
||||
<Compile Include="Persistence\Repositories\DomainRepositoryTest.cs" />
|
||||
@@ -484,7 +487,6 @@
|
||||
<Compile Include="PublishedContent\PublishedContentMoreTests.cs" />
|
||||
<Compile Include="Publishing\PublishingStrategyTests.cs" />
|
||||
<Compile Include="Resolvers\ActionsResolverTests.cs" />
|
||||
<Compile Include="Logging\RingBufferTest.cs" />
|
||||
<Compile Include="TestHelpers\BaseUmbracoConfigurationTest.cs" />
|
||||
<Compile Include="TestHelpers\DatabaseTestBehaviorAttribute.cs" />
|
||||
<Compile Include="TestHelpers\Entities\MockedMember.cs" />
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
<packages>
|
||||
<package id="AspNetWebApi.SelfHost" version="4.0.20710.0" targetFramework="net45" />
|
||||
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
|
||||
<package id="Castle.Core" version="4.0.0" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.82" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.5" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
<package id="Log4Net.Async" version="2.0.4" targetFramework="net45" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
|
||||
@@ -17,15 +19,15 @@
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Moq" version="4.1.1309.0919" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net45" />
|
||||
<package id="NUnit" version="2.6.2" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
<package id="Selenium.WebDriver" version="2.32.0" targetFramework="net45" />
|
||||
<package id="Semver" version="2.0.4" targetFramework="net45" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
|
||||
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
|
||||
<package id="System.Runtime" version="4.1.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.Extensions" version="4.1.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="net45" />
|
||||
<package id="System.Text.RegularExpressions" version="4.1.0" targetFramework="net45" />
|
||||
<package id="System.Runtime" version="4.3.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net45" />
|
||||
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -536,7 +536,23 @@ module.exports = function (grunt) {
|
||||
]
|
||||
},
|
||||
'ace-builds': {
|
||||
files: ['src-min-noconflict/**']
|
||||
files: [
|
||||
'src-min-noconflict/ace.js',
|
||||
|
||||
'src-min-noconflict/ext-language_tools.js',
|
||||
'src-min-noconflict/ext-searchbox.js',
|
||||
'src-min-noconflict/ext-settings_menu.js',
|
||||
|
||||
'src-min-noconflict/snippets/text.js',
|
||||
'src-min-noconflict/snippets/javascript.js',
|
||||
|
||||
'src-min-noconflict/theme-chrome.js',
|
||||
|
||||
'src-min-noconflict/mode-razor.js',
|
||||
'src-min-noconflict/mode-javascript.js',
|
||||
|
||||
'src-min-noconflict/worker-javascript.js',
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
body.mce-content-body {
|
||||
background-color: #fff;
|
||||
font-family: Verdana,Arial,Helvetica,sans-serif;
|
||||
font-size: 11px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5em;
|
||||
scrollbar-3dlight-color: #f0f0ee;
|
||||
scrollbar-arrow-color: #676662;
|
||||
scrollbar-base-color: #f0f0ee;
|
||||
|
||||
@@ -92,6 +92,16 @@ function contentTypeResource($q, $http, umbRequestHelper, umbDataFormatter) {
|
||||
'Failed to retrieve property type aliases');
|
||||
},
|
||||
|
||||
getAllStandardFields: function () {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentTypeApiBaseUrl",
|
||||
"GetAllStandardFields")),
|
||||
'Failed to retrieve standard fields');
|
||||
},
|
||||
|
||||
getPropertyTypeScaffold : function (id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
**/
|
||||
function ourPackageRepositoryResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
//var baseurl = "http://localhost:24292/webapi/packages/v1";
|
||||
var baseurl = "https://our.umbraco.org/webapi/packages/v1";
|
||||
var baseurl = Umbraco.Sys.ServerVariables.umbracoUrls.packagesRestApiBaseUrl;
|
||||
|
||||
return {
|
||||
|
||||
getDetails: function (packageId) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(baseurl + "/" + packageId),
|
||||
$http.get(baseurl + "/" + packageId + "?version=" + Umbraco.Sys.ServerVariables.application.version),
|
||||
'Failed to get package details');
|
||||
},
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
margin-bottom: @baseLineHeight;
|
||||
background-color: @warningBackground;
|
||||
border: 1px solid @warningBorder;
|
||||
.border-radius(@baseBorderRadius);
|
||||
.border-radius(@alertBorderRadius);
|
||||
}
|
||||
.alert,
|
||||
.alert h4,
|
||||
|
||||
@@ -65,7 +65,10 @@
|
||||
-webkit-box-shadow:none;
|
||||
}
|
||||
|
||||
|
||||
.btn-group .btn.dropdown-toggle {
|
||||
border-left-width: 1px;
|
||||
border-left-style: solid;
|
||||
}
|
||||
|
||||
// Button Sizes
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -14,6 +14,7 @@ body {
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
width: ~"(calc(~'100%' - ~'80px'))"; // 80px is the fixed left menu for toggling the different browser sizes
|
||||
position: absolute;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
.umb-button-group__toggle {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
.umb-button-group__sub-buttons.-align-right {
|
||||
@@ -35,6 +34,9 @@
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
border-radius: 0 3px 3px 0;
|
||||
border-left-style: solid;
|
||||
border-left-width: 1px;
|
||||
border-left-color: rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.umb-era-button.umb-button-group__toggle .caret {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
.umb-panel-header {
|
||||
padding: 20px;
|
||||
background: @gray-10;
|
||||
border-bottom: 1px solid @gray-8;
|
||||
border-bottom: 1px solid @purple-l3;
|
||||
height: 59px;
|
||||
|
||||
.umb-headline {
|
||||
@@ -25,9 +25,14 @@
|
||||
|
||||
.umb-panel-footer {
|
||||
background: @gray-10;
|
||||
border-top: 1px solid @gray-8;
|
||||
height: 51px;
|
||||
border-top: 1px solid @purple-l3;
|
||||
height: 52px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
// Hacks to fix editors inside the mini editors
|
||||
.umb-editor-sub-header {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,7 +73,7 @@ body {
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background: @gray-1;
|
||||
background: @purple-d2;
|
||||
z-index: 666;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@
|
||||
}
|
||||
|
||||
.login-overlay .form input[type="text"],
|
||||
.login-overlay .form input[type="password"] {
|
||||
.login-overlay .form input[type="password"],
|
||||
.login-overlay .form input[type="email"] {
|
||||
height: 36px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
@red-l3: #FFB2B0;
|
||||
@red-washed: #FFECEB;
|
||||
|
||||
@yellow-d2: #F0AC00;
|
||||
@yellow-d1: #FFC011;
|
||||
@yellow: #FFCE38;
|
||||
@yellow-l1: #FFD861;
|
||||
@@ -312,7 +313,7 @@
|
||||
// alerts
|
||||
// -------------------------
|
||||
@warningText: @white;
|
||||
@warningBackground: @orange;
|
||||
@warningBackground: @yellow-d2;
|
||||
@warningBorder: transparent;
|
||||
|
||||
@errorText: @white;
|
||||
@@ -327,6 +328,8 @@
|
||||
@infoBackground: @turquoise-d1;
|
||||
@infoBorder: transparent;
|
||||
|
||||
@alertBorderRadius: 0;
|
||||
|
||||
// SD: Had to duplicate the above but prefix with 'form' inversed colors
|
||||
// because we cannot share the above alert colors with forms otherwise we end up with white
|
||||
// text and giant red backgrounds.
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<form method="POST" name="requestPasswordResetForm" ng-submit="requestPasswordResetSubmit(email)">
|
||||
<div class="control-group" ng-class="{error: requestPasswordResetForm.email.$invalid}">
|
||||
<label><localize key="general_email">Email</localize></label>
|
||||
<input type="text" ng-model="email" name="email" class="-full-width-input" localize="placeholder" placeholder="@placeholders_email" />
|
||||
<input type="email" ng-model="email" name="email" class="-full-width-input" localize="placeholder" placeholder="@placeholders_email" />
|
||||
</div>
|
||||
|
||||
<div class="control-group" ng-show="requestPasswordResetForm.$invalid">
|
||||
|
||||
@@ -158,4 +158,4 @@
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
multiPicker: false,
|
||||
title: localizationService.localize("template_insertDictionaryItem"),
|
||||
description: localizationService.localize("template_insertDictionaryItemDesc"),
|
||||
emptyStateMessage: localizationService.localize("emptyStates_emptyDictionaryTree"),
|
||||
show: true,
|
||||
select: function(node){
|
||||
|
||||
|
||||
+6
@@ -12,6 +12,7 @@
|
||||
vm.insertAfter;
|
||||
vm.recursive = false;
|
||||
vm.properties = [];
|
||||
vm.standardFields = [];
|
||||
vm.date = false;
|
||||
vm.dateTime = false;
|
||||
vm.dateTimeSeparator = "";
|
||||
@@ -41,6 +42,11 @@
|
||||
contentTypeResource.getAllPropertyTypeAliases().then(function (array) {
|
||||
vm.properties = array;
|
||||
});
|
||||
|
||||
// Load all standard fields
|
||||
contentTypeResource.getAllStandardFields().then(function (array) {
|
||||
vm.standardFields = array;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,14 @@
|
||||
<div class="umb-el-wrap">
|
||||
<label class="control-label" for="chooseField">Choose field</label>
|
||||
<div class="controls">
|
||||
<select name="chooseField" ng-model="vm.field" ng-options="property for property in vm.properties"></select>
|
||||
<select ng-model="vm.field">
|
||||
<optgroup localize="label" label="@templateEditor_customFields">
|
||||
<option ng-repeat="(key, value) in vm.properties" value="{{value}}">{{value}}</option>
|
||||
</optgroup>
|
||||
<optgroup localize="label" label="@templateEditor_standardFields">
|
||||
<option ng-repeat="(key, value) in vm.standardFields" value="{{value}}">{{value}}</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,7 +31,14 @@
|
||||
<div class="umb-el-wrap">
|
||||
<label class="control-label" for="altField">Fallback field</label>
|
||||
<div class="controls">
|
||||
<select name="altField" ng-model="vm.altField" ng-options="property for property in vm.properties"></select>
|
||||
<select ng-model="vm.altField" >
|
||||
<optgroup localize="label" label="@templateEditor_customFields">
|
||||
<option ng-repeat="(key, value) in vm.properties" value="{{value}}">{{value}}</option>
|
||||
</optgroup>
|
||||
<optgroup localize="label" label="@templateEditor_standardFields">
|
||||
<option ng-repeat="(key, value) in vm.standardFields" value="{{value}}">{{value}}</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-1
@@ -61,6 +61,7 @@ angular.module("umbraco")
|
||||
|
||||
$scope.submitFolder = function() {
|
||||
if ($scope.newFolderName) {
|
||||
$scope.creatingFolder = true;
|
||||
mediaResource
|
||||
.addFolder($scope.newFolderName, $scope.currentFolder.id)
|
||||
.then(function(data) {
|
||||
@@ -69,7 +70,7 @@ angular.module("umbraco")
|
||||
cacheKey: "__media", //this is the main media tree cache key
|
||||
childrenOf: data.parentId //clear the children of the parent
|
||||
});
|
||||
|
||||
$scope.creatingFolder = false;
|
||||
$scope.gotoFolder(data);
|
||||
$scope.showFolderInput = false;
|
||||
$scope.newFolderName = "";
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row umb-control-group" ng-if="!searchOptions.filter">
|
||||
<div class="row umb-control-group" ng-show="!searchOptions.filter">
|
||||
<ul class="umb-breadcrumbs">
|
||||
<li ng-hide="startNodeId != -1" class="umb-breadcrumbs__ancestor">
|
||||
<a href ng-click="gotoFolder()" prevent-default>Media</a>
|
||||
@@ -64,7 +64,7 @@
|
||||
focus-when="{{showFolderInput}}" />
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="umb-loader" ng-if="creatingFolder"></div>
|
||||
</div>
|
||||
|
||||
<umb-file-dropzone
|
||||
|
||||
+10
-1
@@ -20,7 +20,13 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
|
||||
selectedSearchResults: []
|
||||
}
|
||||
|
||||
$scope.model.selection = [];
|
||||
$scope.model.selection = [];
|
||||
|
||||
//Used for toggling an empty-state message
|
||||
//Some trees can have no items (dictionary & forms email templates)
|
||||
$scope.hasItems = true;
|
||||
$scope.emptyStateMessage = dialogOptions.emptyStateMessage;
|
||||
|
||||
|
||||
//TODO: I don't think this is used or called anywhere!!
|
||||
$scope.init = function (contentType) {
|
||||
@@ -149,6 +155,9 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
|
||||
|
||||
//gets the tree object when it loads
|
||||
function treeLoadedHandler(ev, args) {
|
||||
//args.tree contains children (args.tree.root.children)
|
||||
$scope.hasItems = args.tree.root.children.length > 0;
|
||||
|
||||
tree = args.tree;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,12 @@
|
||||
results="searchInfo.results"
|
||||
select-result-callback="selectResult">
|
||||
</umb-tree-search-results>
|
||||
|
||||
<umb-empty-state ng-if="!hasItems && emptyStateMessage" position="center">
|
||||
{{ emptyStateMessage }}
|
||||
</umb-empty-state>
|
||||
|
||||
<div ng-if="treeReady" ng-hide="searchInfo.showSearch" ng-animate="'tree-fade-out'">
|
||||
<div ng-if="treeReady" ng-hide="searchInfo.showSearch" ng-animate="'tree-fade-out'">
|
||||
<umb-tree
|
||||
section="{{section}}"
|
||||
treealias="{{treeAlias}}"
|
||||
|
||||
@@ -51,12 +51,13 @@
|
||||
|
||||
</div>
|
||||
|
||||
<umb-editor-menu
|
||||
class="umb-editor-header__actions-menu"
|
||||
ng-if="menu.currentNode"
|
||||
current-node="menu.currentNode"
|
||||
current-section="{{menu.currentSection}}">
|
||||
</umb-editor-menu>
|
||||
<div class="umb-editor-header__actions-menu">
|
||||
<umb-editor-menu
|
||||
ng-if="menu.currentNode"
|
||||
current-node="menu.currentNode"
|
||||
current-section="{{menu.currentSection}}">
|
||||
</umb-editor-menu>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
<ul class="umb-tree">
|
||||
<div>
|
||||
<umb-empty-state ng-if="results.length === 0" position="center">
|
||||
<localize key="general_searchNoResult"></localize>
|
||||
</umb-empty-state>
|
||||
|
||||
<ul class="umb-tree">
|
||||
<li class="root">
|
||||
<ul class="umb-search-group">
|
||||
|
||||
<li ng-repeat="result in results">
|
||||
|
||||
<div style="padding-left: 20px" ng-class="{'umb-tree-node-checked' : result.selected}">
|
||||
<a class="umb-search-group-item-link" ng-class="{first:$first}" ng-click="selectResultCallback($event, result)">
|
||||
<div class="umb-search-group-item-name">
|
||||
<i class="icon umb-tree-icon sprTree {{result.icon}}"></i>
|
||||
{{result.name}}
|
||||
</div>
|
||||
<small class="search-subtitle" ng-if="result.subTitle">{{result.subTitle}}</small>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<ul class="umb-search-group">
|
||||
<li ng-repeat="result in results">
|
||||
<div style="padding-left: 20px" ng-class="{'umb-tree-node-checked' : result.selected}">
|
||||
<a class="umb-search-group-item-link" ng-class="{first:$first}" ng-click="selectResultCallback($event, result)">
|
||||
<div class="umb-search-group-item-name">
|
||||
<i class="icon umb-tree-icon sprTree {{result.icon}}"></i>
|
||||
{{result.name}}
|
||||
</div>
|
||||
<small class="search-subtitle" ng-if="result.subTitle">{{result.subTitle}}</small>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</div>
|
||||
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
|
||||
<button class="btn" ng-click="nav.hideDialog(true)">
|
||||
<button class="btn btn-info" ng-click="nav.hideDialog(true)">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
@@ -5,21 +5,16 @@
|
||||
|
||||
<ul class="umb-actions umb-actions-child">
|
||||
<li>
|
||||
<a href="" ng-click="createDataType()">
|
||||
|
||||
<a href="" ng-click="createDataType()" umb-auto-focus>
|
||||
<i class="large icon-autofill"></i>
|
||||
|
||||
<span class="menu-label">
|
||||
<localize key="create_newDataType">New data type</localize>
|
||||
</span>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="" ng-click="showCreateFolder()">
|
||||
|
||||
<i class="large icon-folder"></i>
|
||||
|
||||
<span class="menu-label">
|
||||
<localize key="create_newFolder">New folder</localize>
|
||||
</span>
|
||||
@@ -44,7 +39,7 @@
|
||||
</div>
|
||||
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-if="!model.creatingFolder">
|
||||
<button class="btn" ng-click="nav.hideDialog(true)">
|
||||
<button class="btn btn-info" ng-click="nav.hideDialog(true)">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</div>
|
||||
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-if="!model.creatingFolder">
|
||||
<button class="btn" ng-click="nav.hideDialog(true)">
|
||||
<button class="btn btn-info" ng-click="nav.hideDialog(true)">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
|
||||
<button class="btn" ng-click="nav.hideDialog(true)">
|
||||
<button class="btn btn-info" ng-click="nav.hideDialog(true)">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -5,15 +5,12 @@
|
||||
|
||||
<ul class="umb-actions umb-actions-child">
|
||||
<li>
|
||||
<a href="" ng-click="createMediaType()">
|
||||
|
||||
<a href="" ng-click="createMediaType()" umb-auto-focus>
|
||||
<i class="large icon-item-arrangement"></i>
|
||||
|
||||
<span class="menu-label">
|
||||
<localize key="general_new">New</localize>
|
||||
<localize key="content_mediatype">Media type</localize>
|
||||
</span>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
@@ -41,7 +38,7 @@
|
||||
</div>
|
||||
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-if="!model.creatingFolder">
|
||||
<button class="btn" ng-click="nav.hideDialog(true)">
|
||||
<button class="btn btn-info" ng-click="nav.hideDialog(true)">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" >
|
||||
<button type="button" class="btn" ng-click="nav.hideDialog()">
|
||||
<button type="button" class="btn btn-info" ng-click="nav.hideDialog()">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-if="!model.creatingFolder">
|
||||
<button class="btn" ng-click="nav.hideDialog(true)">
|
||||
<button class="btn btn-info" ng-click="nav.hideDialog(true)">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
<!-- Dialog footer -->
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
|
||||
<button class="btn" ng-click="nav.hideDialog(true)">
|
||||
<button class="btn btn-info" ng-click="nav.hideDialog(true)">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -204,6 +204,7 @@
|
||||
multiPicker: false,
|
||||
show: true,
|
||||
title: "Insert dictionary item",
|
||||
emptyStateMessage: localizationService.localize("emptyStates_emptyDictionaryTree"),
|
||||
select: function(node){
|
||||
|
||||
var code = templateHelper.getInsertDictionarySnippet(node.name);
|
||||
@@ -322,9 +323,9 @@
|
||||
}
|
||||
|
||||
function insert(str) {
|
||||
vm.editor.focus();
|
||||
vm.editor.moveCursorToPosition(vm.currentPosition);
|
||||
vm.editor.insert(str);
|
||||
vm.editor.focus();
|
||||
|
||||
// set form state to $dirty
|
||||
setFormState("dirty");
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
<!-- Dialog footer -->
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
|
||||
<button class="btn" ng-click="nav.hideDialog(true)">
|
||||
<button class="btn btn-info" ng-click="nav.hideDialog(true)">
|
||||
<localize key="buttons_somethingElse">Do something else</localize>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user