Merge remote-tracking branch 'origin/netcore/dev' into netcore/feature/align-infrastructure-namespaces
# Conflicts: # src/Umbraco.Infrastructure/Migrations/Expressions/Rename/Expressions/RenameColumnExpression.cs # src/Umbraco.Infrastructure/Migrations/IMigrationExpression.cs
This commit is contained in:
@@ -12,13 +12,11 @@ namespace Umbraco.Cms.Core.Cache
|
||||
public sealed class MemberCacheRefresher : PayloadCacheRefresherBase<MemberCacheRefresher, MemberCacheRefresher.JsonPayload>
|
||||
{
|
||||
private readonly IIdKeyMap _idKeyMap;
|
||||
private readonly LegacyMemberCacheRefresher _legacyMemberRefresher;
|
||||
|
||||
public MemberCacheRefresher(AppCaches appCaches, IJsonSerializer serializer, IIdKeyMap idKeyMap)
|
||||
: base(appCaches, serializer)
|
||||
{
|
||||
_idKeyMap = idKeyMap;
|
||||
_legacyMemberRefresher = new LegacyMemberCacheRefresher(this, appCaches);
|
||||
}
|
||||
|
||||
public class JsonPayload
|
||||
@@ -66,12 +64,6 @@ namespace Umbraco.Cms.Core.Cache
|
||||
base.Remove(id);
|
||||
}
|
||||
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
|
||||
public void Refresh(IMember instance) => _legacyMemberRefresher.Refresh(instance);
|
||||
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
|
||||
public void Remove(IMember instance) => _legacyMemberRefresher.Remove(instance);
|
||||
|
||||
private void ClearCache(params JsonPayload[] payloads)
|
||||
{
|
||||
AppCaches.ClearPartialViewCache();
|
||||
@@ -99,38 +91,5 @@ namespace Umbraco.Cms.Core.Cache
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Backwards Compat
|
||||
|
||||
// TODO: this is here purely for backwards compat but should be removed in netcore
|
||||
private class LegacyMemberCacheRefresher : TypedCacheRefresherBase<MemberCacheRefresher, IMember>
|
||||
{
|
||||
private readonly MemberCacheRefresher _parent;
|
||||
|
||||
public LegacyMemberCacheRefresher(MemberCacheRefresher parent, AppCaches appCaches) : base(appCaches)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public override Guid RefresherUniqueId => _parent.RefresherUniqueId;
|
||||
|
||||
public override string Name => _parent.Name;
|
||||
|
||||
protected override MemberCacheRefresher This => _parent;
|
||||
|
||||
public override void Refresh(IMember instance)
|
||||
{
|
||||
_parent.ClearCache(new JsonPayload(instance.Id, instance.Username));
|
||||
base.Refresh(instance.Id);
|
||||
}
|
||||
|
||||
public override void Remove(IMember instance)
|
||||
{
|
||||
_parent.ClearCache(new JsonPayload(instance.Id, instance.Username));
|
||||
base.Remove(instance);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using Umbraco.Cms.Core.Sync;
|
||||
|
||||
namespace Umbraco.Cms.Core.Cache
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class for "typed" cache refreshers.
|
||||
/// </summary>
|
||||
/// <typeparam name="TInstanceType">The actual cache refresher type.</typeparam>
|
||||
/// <typeparam name="TEntityType">The entity type.</typeparam>
|
||||
/// <remarks>The actual cache refresher type is used for strongly typed events.</remarks>
|
||||
public abstract class TypedCacheRefresherBase<TInstanceType, TEntityType> : CacheRefresherBase<TInstanceType>, ICacheRefresher<TEntityType>
|
||||
where TInstanceType : class, ICacheRefresher
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TypedCacheRefresherBase{TInstanceType, TEntityType}"/>.
|
||||
/// </summary>
|
||||
/// <param name="appCaches">A cache helper.</param>
|
||||
protected TypedCacheRefresherBase(AppCaches appCaches)
|
||||
: base(appCaches)
|
||||
{ }
|
||||
|
||||
#region Refresher
|
||||
|
||||
public virtual void Refresh(TEntityType instance)
|
||||
{
|
||||
OnCacheUpdated(This, new CacheRefresherEventArgs(instance, MessageType.RefreshByInstance));
|
||||
}
|
||||
|
||||
public virtual void Remove(TEntityType instance)
|
||||
{
|
||||
OnCacheUpdated(This, new CacheRefresherEventArgs(instance, MessageType.RemoveByInstance));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace Umbraco.Cms.Core.Configuration
|
||||
/// <summary>
|
||||
/// Gets the non-semantic version of the Umbraco code.
|
||||
/// </summary>
|
||||
Version Current { get; }
|
||||
Version Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the semantic version comments of the Umbraco code.
|
||||
|
||||
@@ -24,15 +24,6 @@ namespace Umbraco.Cms.Core.Configuration.Models
|
||||
/// </summary>
|
||||
public string ReservedPaths { get; set; } = StaticReservedPaths;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value for the configuration status.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings
|
||||
/// TODO: previously this would throw on set, but presumably we can't do that if we do still want this in config.
|
||||
/// </remarks>
|
||||
public string ConfigurationStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value for the timeout in minutes.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Umbraco.Cms.Core.Semver;
|
||||
using Umbraco.Extensions;
|
||||
@@ -25,14 +25,13 @@ namespace Umbraco.Cms.Core.Configuration
|
||||
SemanticVersion = SemVersion.Parse(umbracoCoreAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion);
|
||||
|
||||
// gets the non-semantic version
|
||||
Current = SemanticVersion.GetVersion(3);
|
||||
Version = SemanticVersion.GetVersion(3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the non-semantic version of the Umbraco code.
|
||||
/// </summary>
|
||||
// TODO: rename to Version
|
||||
public Version Current { get; }
|
||||
public Version Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the semantic version comments of the Umbraco code.
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Cms.Core
|
||||
{
|
||||
public static partial class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Specific web.config AppSetting keys for Umbraco.Core application
|
||||
/// </summary>
|
||||
public static class AppSettings
|
||||
{
|
||||
// TODO: Are these all obsolete in netcore now?
|
||||
|
||||
public const string MainDomLock = "Umbraco.Core.MainDom.Lock";
|
||||
|
||||
// TODO: Kill me - still used in Umbraco.Core.IO.SystemFiles:27
|
||||
[Obsolete("We need to kill this appsetting as we do not use XML content cache umbraco.config anymore due to NuCache")]
|
||||
public const string ContentXML = "Umbraco.Core.ContentXML"; //umbracoContentXML
|
||||
|
||||
/// <summary>
|
||||
/// TODO: FILL ME IN
|
||||
/// </summary>
|
||||
public const string RegisterType = "Umbraco.Core.RegisterType";
|
||||
|
||||
/// <summary>
|
||||
/// This is used for a unit test in PublishedMediaCache
|
||||
/// </summary>
|
||||
public const string PublishedMediaCacheSeconds = "Umbraco.Core.PublishedMediaCacheSeconds";
|
||||
|
||||
/// <summary>
|
||||
/// TODO: FILL ME IN
|
||||
/// </summary>
|
||||
public const string AssembliesAcceptingLoadExceptions = "Umbraco.Core.AssembliesAcceptingLoadExceptions";
|
||||
|
||||
/// <summary>
|
||||
/// This will return the version number of the currently installed umbraco instance
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Umbraco will automatically set & modify this value when installing & upgrading
|
||||
/// </remarks>
|
||||
public const string ConfigurationStatus = "Umbraco.Core.ConfigurationStatus";
|
||||
|
||||
/// <summary>
|
||||
/// The path to umbraco's root directory (/umbraco by default).
|
||||
/// </summary>
|
||||
public const string UmbracoPath = "Umbraco.Core.Path";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to umbraco's icons directory (/umbraco/assets/icons by default).
|
||||
/// </summary>
|
||||
public const string IconsPath = "Umbraco.Icons.Path";
|
||||
|
||||
/// <summary>
|
||||
/// The reserved urls from web.config.
|
||||
/// </summary>
|
||||
public const string ReservedUrls = "Umbraco.Core.ReservedUrls";
|
||||
|
||||
/// <summary>
|
||||
/// The path of the stylesheet folder.
|
||||
/// </summary>
|
||||
public const string UmbracoCssPath = "Umbraco.Web.CssPath";
|
||||
|
||||
/// <summary>
|
||||
/// The path of script folder.
|
||||
/// </summary>
|
||||
public const string UmbracoScriptsPath = "Umbraco.Core.ScriptsPath";
|
||||
|
||||
/// <summary>
|
||||
/// The path of media folder.
|
||||
/// </summary>
|
||||
public const string UmbracoMediaPath = "Umbraco.Core.MediaPath";
|
||||
|
||||
/// <summary>
|
||||
/// The reserved paths from web.config
|
||||
/// </summary>
|
||||
public const string ReservedPaths = "Umbraco.Core.ReservedPaths";
|
||||
|
||||
/// <summary>
|
||||
/// Set the timeout for the Umbraco backoffice in minutes
|
||||
/// </summary>
|
||||
public const string TimeOutInMinutes = "Umbraco.Core.TimeOutInMinutes";
|
||||
|
||||
/// <summary>
|
||||
/// The number of days to check for a new version of Umbraco
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Default is set to 7. Setting this to 0 will never check
|
||||
/// This is used to help track statistics
|
||||
/// </remarks>
|
||||
public const string VersionCheckPeriod = "Umbraco.Core.VersionCheckPeriod";
|
||||
|
||||
/// <summary>
|
||||
/// This is the location type to store temporary files such as cache files or other localized files for a given machine
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Currently used for the xml cache file and the plugin cache files
|
||||
/// </remarks>
|
||||
public const string LocalTempStorage = "Umbraco.Core.LocalTempStorage";
|
||||
|
||||
/// <summary>
|
||||
/// The default UI language of the backoffice such as 'en-US'
|
||||
/// </summary>
|
||||
public const string DefaultUILanguage = "Umbraco.Core.DefaultUILanguage";
|
||||
|
||||
/// <summary>
|
||||
/// A true/false value indicating whether umbraco should hide top level nodes from generated URLs.
|
||||
/// </summary>
|
||||
public const string HideTopLevelNodeFromPath = "Umbraco.Core.HideTopLevelNodeFromPath";
|
||||
|
||||
/// <summary>
|
||||
/// A true or false indicating whether umbraco should force a secure (https) connection to the backoffice.
|
||||
/// </summary>
|
||||
public const string UseHttps = "Umbraco.Core.UseHttps";
|
||||
|
||||
/// <summary>
|
||||
/// TODO: FILL ME IN
|
||||
/// </summary>
|
||||
public const string DisableElectionForSingleServer = "Umbraco.Core.DisableElectionForSingleServer";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the razor file used when no published content is available.
|
||||
/// </summary>
|
||||
public const string NoNodesViewPath = "Umbraco.Core.NoNodesViewPath";
|
||||
|
||||
/// <summary>
|
||||
/// Debug specific web.config AppSetting keys for Umbraco
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Do not use these keys in a production environment
|
||||
/// </remarks>
|
||||
public static class Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// When set to true, Scope logs the stack trace for any scope that gets disposed without being completed.
|
||||
/// this helps troubleshooting rogue scopes that we forget to complete
|
||||
/// </summary>
|
||||
public const string LogUncompletedScopes = "Umbraco.Core.Debug.LogUncompletedScopes";
|
||||
|
||||
/// <summary>
|
||||
/// When set to true, the Logger creates a mini dump of w3wp in ~/App_Data/MiniDump whenever it logs
|
||||
/// an error due to a ThreadAbortException that is due to a timeout.
|
||||
/// </summary>
|
||||
public const string DumpOnTimeoutThreadAbort = "Umbraco.Core.Debug.DumpOnTimeoutThreadAbort";
|
||||
|
||||
/// <summary>
|
||||
/// TODO: FILL ME IN
|
||||
/// </summary>
|
||||
public const string DatabaseFactoryServerVersion = "Umbraco.Core.Debug.DatabaseFactoryServerVersion";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Umbraco.
|
||||
// Copyright (c) Umbraco.
|
||||
// See LICENSE for more details.
|
||||
|
||||
using System;
|
||||
@@ -1259,51 +1259,6 @@ namespace Umbraco.Extensions
|
||||
&& Path.GetPathRoot(path).Equals(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal) == false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Based on the input string, this will detect if the string is a JS path or a JS snippet.
|
||||
/// If a path cannot be determined, then it is assumed to be a snippet the original text is returned
|
||||
/// with an invalid attempt, otherwise a valid attempt is returned with the resolved path
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// This is only used for legacy purposes for the Action.JsSource stuff and shouldn't be needed in v8
|
||||
/// </remarks>
|
||||
internal static Attempt<string> DetectIsJavaScriptPath(this string input, IIOHelper ioHelper)
|
||||
{
|
||||
//validate that this is a url, if it is not, we'll assume that it is a text block and render it as a text
|
||||
//block instead.
|
||||
var isValid = true;
|
||||
|
||||
if (Uri.IsWellFormedUriString(input, UriKind.RelativeOrAbsolute))
|
||||
{
|
||||
//ok it validates, but so does alert('hello'); ! so we need to do more checks
|
||||
|
||||
//here are the valid chars in a url without escaping
|
||||
if (Regex.IsMatch(input, @"[^a-zA-Z0-9-._~:/?#\[\]@!$&'\(\)*\+,%;=]"))
|
||||
isValid = false;
|
||||
|
||||
//we'll have to be smarter and just check for certain js patterns now too!
|
||||
var jsPatterns = new[] { @"\+\s*\=", @"\);", @"function\s*\(", @"!=", @"==" };
|
||||
if (jsPatterns.Any(p => Regex.IsMatch(input, p)))
|
||||
isValid = false;
|
||||
|
||||
if (isValid)
|
||||
{
|
||||
var resolvedUrlResult = ioHelper.TryResolveUrl(input);
|
||||
//if the resolution was success, return it, otherwise just return the path, we've detected
|
||||
// it's a path but maybe it's relative and resolution has failed, etc... in which case we're just
|
||||
// returning what was given to us.
|
||||
return resolvedUrlResult.Success
|
||||
? resolvedUrlResult
|
||||
: Attempt.Succeed(input);
|
||||
}
|
||||
}
|
||||
|
||||
return Attempt.Fail(input);
|
||||
}
|
||||
|
||||
|
||||
// FORMAT STRINGS
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,11 +8,9 @@ namespace Umbraco.Cms.Core.IO
|
||||
{
|
||||
string FindFile(string virtualPath);
|
||||
|
||||
// TODO: This is the same as IHostingEnvironment.ToAbsolute
|
||||
[Obsolete("Use IHostingEnvironment.ToAbsolute instead")]
|
||||
string ResolveUrl(string virtualPath);
|
||||
|
||||
Attempt<string> TryResolveUrl(string virtualPath);
|
||||
|
||||
/// <summary>
|
||||
/// Maps a virtual path to a physical path in the content root folder (i.e. www)
|
||||
/// </summary>
|
||||
@@ -21,14 +19,6 @@ namespace Umbraco.Cms.Core.IO
|
||||
[Obsolete("Use IHostingEnvironment.MapPathContentRoot or IHostingEnvironment.MapPathWebRoot instead")]
|
||||
string MapPath(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the path has a root, and is considered fully qualified for the OS it is on
|
||||
/// See https://github.com/dotnet/runtime/blob/30769e8f31b20be10ca26e27ec279cd4e79412b9/src/libraries/System.Private.CoreLib/src/System/IO/Path.cs#L281 for the .NET Standard 2.1 version of this
|
||||
/// </summary>
|
||||
/// <param name="path">The path to check</param>
|
||||
/// <returns>True if the path is fully qualified, false otherwise</returns>
|
||||
bool IsPathFullyQualified(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that the current filepath matches a directory where the user is allowed to edit a file.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Cms.Core.IO
|
||||
return retval;
|
||||
}
|
||||
|
||||
// TODO: This is the same as IHostingEnvironment.ToAbsolute
|
||||
// TODO: This is the same as IHostingEnvironment.ToAbsolute - marked as obsolete in IIOHelper for now
|
||||
public string ResolveUrl(string virtualPath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(virtualPath)) return virtualPath;
|
||||
@@ -44,23 +44,6 @@ namespace Umbraco.Cms.Core.IO
|
||||
|
||||
}
|
||||
|
||||
public Attempt<string> TryResolveUrl(string virtualPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (virtualPath.StartsWith("~"))
|
||||
return Attempt.Succeed(virtualPath.Replace("~", _hostingEnvironment.ApplicationVirtualPath).Replace("//", "/"));
|
||||
if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute))
|
||||
return Attempt.Succeed(virtualPath);
|
||||
|
||||
return Attempt.Succeed(_hostingEnvironment.ToAbsolute(virtualPath));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Attempt.Fail(virtualPath, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public string MapPath(string path)
|
||||
{
|
||||
if (path == null) throw new ArgumentNullException(nameof(path));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Net;
|
||||
using System.Net;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Cms.Core.Configuration;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Umbraco.Cms.Core.Models
|
||||
{
|
||||
Type = upgradeType;
|
||||
Comment = upgradeComment;
|
||||
Url = upgradeUrl + "?version=" + WebUtility.UrlEncode(umbracoVersion.Current.ToString(3));
|
||||
Url = upgradeUrl + "?version=" + WebUtility.UrlEncode(umbracoVersion.Version.ToString(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
@@ -81,7 +81,7 @@ namespace Umbraco.Cms.Core.Packaging
|
||||
new XAttribute("name", def.Name ?? string.Empty),
|
||||
new XAttribute("packagePath", def.PackagePath ?? string.Empty),
|
||||
new XAttribute("iconUrl", def.IconUrl ?? string.Empty),
|
||||
new XAttribute("umbVersion", def.UmbracoVersion ?? _umbracoVersion.Current),
|
||||
new XAttribute("umbVersion", def.UmbracoVersion ?? _umbracoVersion.Version),
|
||||
new XAttribute("packageGuid", def.PackageId),
|
||||
new XAttribute("view", def.PackageView ?? string.Empty),
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
@@ -98,8 +98,8 @@ namespace Umbraco.Cms.Infrastructure.Install
|
||||
}
|
||||
|
||||
var installLog = new InstallLog(installId: installId, isUpgrade: IsBrandNewInstall == false,
|
||||
installCompleted: isCompleted, timestamp: DateTime.Now, versionMajor: _umbracoVersion.Current.Major,
|
||||
versionMinor: _umbracoVersion.Current.Minor, versionPatch: _umbracoVersion.Current.Build,
|
||||
installCompleted: isCompleted, timestamp: DateTime.Now, versionMajor: _umbracoVersion.Version.Major,
|
||||
versionMinor: _umbracoVersion.Version.Minor, versionPatch: _umbracoVersion.Version.Build,
|
||||
versionComment: _umbracoVersion.Comment, error: errorMsg, userAgent: userAgent,
|
||||
dbProvider: dbProvider);
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace Umbraco.Cms.Infrastructure.Install
|
||||
var packages = new List<Package>();
|
||||
try
|
||||
{
|
||||
var requestUri = $"https://our.umbraco.com/webapi/StarterKit/Get/?umbracoVersion={_umbracoVersion.Current}";
|
||||
var requestUri = $"https://our.umbraco.com/webapi/StarterKit/Get/?umbracoVersion={_umbracoVersion.Version}";
|
||||
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Get, requestUri))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@@ -67,7 +67,7 @@ namespace Umbraco.Cms.Infrastructure.Install.InstallSteps
|
||||
private async Task<(string packageFile, int packageId)> DownloadPackageFilesAsync(Guid kitGuid)
|
||||
{
|
||||
//Go get the package file from the package repo
|
||||
var packageFile = await _packageService.FetchPackageFileAsync(kitGuid, _umbracoVersion.Current, _backofficeSecurityAccessor.BackOfficeSecurity.GetUserId().ResultOr(0));
|
||||
var packageFile = await _packageService.FetchPackageFileAsync(kitGuid, _umbracoVersion.Version, _backofficeSecurityAccessor.BackOfficeSecurity.GetUserId().ResultOr(0));
|
||||
if (packageFile == null) throw new InvalidOperationException("Could not fetch package file " + kitGuid);
|
||||
|
||||
//add an entry to the installedPackages.config
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
public virtual string OldName { get; set; }
|
||||
public virtual string NewName { get; set; }
|
||||
|
||||
public override string Process(IMigrationContext context)
|
||||
=> GetSql();
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override string GetSql()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
/// </summary>
|
||||
public interface IMigrationExpression
|
||||
{
|
||||
string Process(IMigrationContext context); // TODO: remove that one?
|
||||
void Execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@@ -35,11 +35,6 @@ namespace Umbraco.Cms.Infrastructure.Migrations
|
||||
|
||||
public List<IMigrationExpression> Expressions => _expressions ?? (_expressions = new List<IMigrationExpression>());
|
||||
|
||||
public virtual string Process(IMigrationContext context)
|
||||
{
|
||||
return ToString();
|
||||
}
|
||||
|
||||
protected virtual string GetSql()
|
||||
{
|
||||
return ToString();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
@@ -53,7 +53,7 @@ namespace Umbraco.Cms.Core
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public Version Version => _umbracoVersion.Current;
|
||||
public Version Version => _umbracoVersion.Version;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string VersionComment => _umbracoVersion.Comment;
|
||||
|
||||
@@ -37,19 +37,6 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.ShortStringHelper
|
||||
Assert.AreEqual(result, first.ToGuid() == second.ToGuid());
|
||||
}
|
||||
|
||||
[TestCase("alert('hello');", false)]
|
||||
[TestCase("~/Test.js", true)]
|
||||
[TestCase("../Test.js", true)]
|
||||
[TestCase("/Test.js", true)]
|
||||
[TestCase("Test.js", true)]
|
||||
[TestCase("Test.js==", false)]
|
||||
[TestCase("/Test.js function(){return true;}", false)]
|
||||
public void Detect_Is_JavaScript_Path(string input, bool result)
|
||||
{
|
||||
Attempt<string> output = input.DetectIsJavaScriptPath(Mock.Of<IIOHelper>());
|
||||
Assert.AreEqual(result, output.Success);
|
||||
}
|
||||
|
||||
[TestCase("hello.txt", "hello")]
|
||||
[TestCase("this.is.a.Txt", "this.is.a")]
|
||||
[TestCase("this.is.not.a. Txt", "this.is.not.a. Txt")]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
@@ -635,19 +635,8 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
|
||||
|
||||
private static void InitializeCacheConfig()
|
||||
{
|
||||
var value = ConfigurationManager.AppSettings[Constants.AppSettings.PublishedMediaCacheSeconds];
|
||||
int seconds;
|
||||
if (int.TryParse(value, out seconds) == false)
|
||||
seconds = PublishedMediaCacheTimespanSeconds;
|
||||
if (seconds > 0)
|
||||
{
|
||||
_publishedMediaCacheEnabled = true;
|
||||
_publishedMediaCacheTimespan = TimeSpan.FromSeconds(seconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
_publishedMediaCacheEnabled = false;
|
||||
}
|
||||
_publishedMediaCacheEnabled = true;
|
||||
_publishedMediaCacheTimespan = TimeSpan.FromSeconds(PublishedMediaCacheTimespanSeconds);
|
||||
}
|
||||
|
||||
internal IPublishedContent CreateFromCacheValues(CacheValues cacheValues)
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
|
||||
services.AddUnique<ISqlContext>(_ => SqlContext);
|
||||
|
||||
var factory = Current.Factory = composition.CreateServiceProvider();
|
||||
var factory = Current.Factory = TestHelper.CreateServiceProvider(composition);
|
||||
|
||||
var pocoMappers = new NPoco.MapperCollection { new PocoMapper() };
|
||||
var pocoDataFactory = new FluentPocoDataFactory((type, iPocoDataFactory) => new PocoDataBuilder(type, pocoMappers).Init());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -18,6 +18,7 @@ using Umbraco.Cms.Core.Cache;
|
||||
using Umbraco.Cms.Core.Composing;
|
||||
using Umbraco.Cms.Core.Configuration;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Diagnostics;
|
||||
using Umbraco.Cms.Core.Hosting;
|
||||
using Umbraco.Cms.Core.IO;
|
||||
@@ -346,5 +347,11 @@ namespace Umbraco.Tests.TestHelpers
|
||||
}
|
||||
|
||||
public static IPublishedUrlProvider GetPublishedUrlProvider() => _testHelperInternal.GetPublishedUrlProvider();
|
||||
|
||||
public static IServiceProvider CreateServiceProvider(IUmbracoBuilder builder)
|
||||
{
|
||||
builder.Build();
|
||||
return builder.Services.BuildServiceProvider();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace Umbraco.Tests.Testing
|
||||
|
||||
TestObjects = new TestObjects();
|
||||
Compose();
|
||||
Current.Factory = Factory = Builder.CreateServiceProvider();
|
||||
Current.Factory = Factory = TestHelper.CreateServiceProvider(Builder);
|
||||
Initialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (ins.UmbracoVersionRequirementsType == RequirementsType.Strict)
|
||||
{
|
||||
var packageMinVersion = ins.UmbracoVersion;
|
||||
if (_umbracoVersion.Current < packageMinVersion)
|
||||
if (_umbracoVersion.Version < packageMinVersion)
|
||||
{
|
||||
model.IsCompatible = false;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
var packageFile = await _packagingService.FetchPackageFileAsync(
|
||||
Guid.Parse(packageGuid),
|
||||
_umbracoVersion.Current,
|
||||
_umbracoVersion.Version,
|
||||
_backofficeSecurityAccessor.BackOfficeSecurity.GetUserId().ResultOr(0));
|
||||
|
||||
fileName = packageFile.Name;
|
||||
@@ -267,7 +267,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
if (packageInfo.UmbracoVersionRequirementsType == RequirementsType.Strict)
|
||||
{
|
||||
var packageMinVersion = packageInfo.UmbracoVersion;
|
||||
if (_umbracoVersion.Current < packageMinVersion)
|
||||
if (_umbracoVersion.Version < packageMinVersion)
|
||||
return ValidationErrorResult.CreateNotificationValidationErrorResult(
|
||||
_localizedTextService.Localize("packager/targetVersionMismatch", new[] {packageMinVersion.ToString()}));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -49,8 +49,8 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
var version = new SemVersion(_umbracoVersion.Current.Major, _umbracoVersion.Current.Minor,
|
||||
_umbracoVersion.Current.Build, _umbracoVersion.Comment);
|
||||
var version = new SemVersion(_umbracoVersion.Version.Major, _umbracoVersion.Version.Minor,
|
||||
_umbracoVersion.Version.Build, _umbracoVersion.Comment);
|
||||
var result = await _upgradeService.CheckUpgrade(version);
|
||||
|
||||
return new UpgradeCheckResponse(result.UpgradeType, result.Comment, result.UpgradeUrl, _umbracoVersion);
|
||||
|
||||
@@ -325,7 +325,7 @@ namespace Umbraco.Web.Security.Providers
|
||||
if (userIsOnline)
|
||||
{
|
||||
// when upgrading from 7.2 to 7.3 trying to save will throw
|
||||
if (_umbracoVersion.Current >= new Version(7, 3, 0, 0))
|
||||
if (_umbracoVersion.Version >= new Version(7, 3, 0, 0))
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
// update the database data directly instead of a full member save which requires DB locks
|
||||
@@ -573,7 +573,7 @@ namespace Umbraco.Web.Security.Providers
|
||||
if (requiresFullSave)
|
||||
{
|
||||
// when upgrading from 7.2 to 7.3 trying to save will throw
|
||||
if (_umbracoVersion.Current >= new Version(7, 3, 0, 0))
|
||||
if (_umbracoVersion.Version >= new Version(7, 3, 0, 0))
|
||||
MemberService.Save(member, false);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Routing;
|
||||
@@ -11,13 +11,6 @@ namespace Umbraco.Web
|
||||
/// </summary>
|
||||
public static class UmbracoBuilderExtensions
|
||||
{
|
||||
[Obsolete("This extension method exists only to ease migration, please refactor")]
|
||||
public static IServiceProvider CreateServiceProvider(this IUmbracoBuilder builder)
|
||||
{
|
||||
builder.Build();
|
||||
return builder.Services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
#region Uniques
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user