Merge branch 'v8/contrib' into v8/dev
This commit is contained in:
@@ -6,7 +6,9 @@ using System.Web;
|
||||
using System.Web.Configuration;
|
||||
using System.Web.Hosting;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Core.Configuration
|
||||
{
|
||||
@@ -23,6 +25,7 @@ namespace Umbraco.Core.Configuration
|
||||
// TODO these should not be static
|
||||
private static string _reservedPaths;
|
||||
private static string _reservedUrls;
|
||||
private static int _sqlWriteLockTimeOut;
|
||||
|
||||
//ensure the built on (non-changeable) reserved paths are there at all times
|
||||
internal const string StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,"; //must end with a comma!
|
||||
@@ -391,5 +394,41 @@ namespace Umbraco.Core.Configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// An int value representing the time in milliseconds to lock the database for a write operation
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is 5000 milliseconds
|
||||
/// </remarks>
|
||||
/// <value>The timeout in milliseconds.</value>
|
||||
public int SqlWriteLockTimeOut
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_sqlWriteLockTimeOut != default) return _sqlWriteLockTimeOut;
|
||||
|
||||
var timeOut = 5000; // 5 seconds
|
||||
var appSettingSqlWriteLockTimeOut = ConfigurationManager.AppSettings[Constants.AppSettings.SqlWriteLockTimeOut];
|
||||
if(int.TryParse(appSettingSqlWriteLockTimeOut, out var configuredTimeOut))
|
||||
{
|
||||
// Only apply this setting if it's not excessively high or low
|
||||
const int minimumTimeOut = 100;
|
||||
const int maximumTimeOut = 20000;
|
||||
if (configuredTimeOut >= minimumTimeOut && configuredTimeOut <= maximumTimeOut) // between 0.1 and 20 seconds
|
||||
{
|
||||
timeOut = configuredTimeOut;
|
||||
}
|
||||
else
|
||||
{
|
||||
Current.Logger.Warn<GlobalSettings>($"The `{Constants.AppSettings.SqlWriteLockTimeOut}` setting in web.config is not between the minimum of {minimumTimeOut} ms and maximum of {maximumTimeOut} ms, defaulting back to {timeOut}");
|
||||
}
|
||||
}
|
||||
|
||||
_sqlWriteLockTimeOut = timeOut;
|
||||
return _sqlWriteLockTimeOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Umbraco.Core.Configuration
|
||||
var path = globalSettings.Path;
|
||||
if (path.StartsWith(SystemDirectories.Root)) // beware of TrimStart, see U4-2518
|
||||
path = path.Substring(SystemDirectories.Root.Length);
|
||||
return path.TrimStart('~').TrimStart('/').Replace('/', '-').Trim().ToLower();
|
||||
return path.TrimStart(Constants.CharArrays.Tilde).TrimStart(Constants.CharArrays.ForwardSlash).Replace('/', '-').Trim().ToLower();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -72,5 +72,10 @@
|
||||
/// Gets the location of temporary files.
|
||||
/// </summary>
|
||||
string LocalTempPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the write lock timeout.
|
||||
/// </summary>
|
||||
int SqlWriteLockTimeOut { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
if (contentConfig == null) throw new ArgumentNullException(nameof(contentConfig));
|
||||
if (extension == null) return false;
|
||||
extension = extension.TrimStart('.');
|
||||
extension = extension.TrimStart(Constants.CharArrays.Period);
|
||||
return contentConfig.ImageFileTypes.InvariantContains(extension);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user