Skip to content

Commit

Permalink
Merge branch 'v9/dev' into v9/contrib
Browse files Browse the repository at this point in the history
  • Loading branch information
nul800sebastiaan committed Oct 8, 2021
2 parents b74bed3 + d6b4fd5 commit 79fdb9a
Show file tree
Hide file tree
Showing 64 changed files with 1,566 additions and 956 deletions.
3 changes: 1 addition & 2 deletions build/NuSpecs/build/Umbraco.Cms.StaticAssets.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
<UmbracoWwwrootName Condition="'$(UmbracoWwwrootName)' == ''">umbraco</UmbracoWwwrootName>
</PropertyGroup>

<Target Name="CopyUmbracoAssets" BeforeTargets="Build">
<Target Name="CopyUmbracoAssets" BeforeTargets="BeforeBuild">
<ItemGroup>

<ContentFiles Include="$(ContentFilesPath)" />
<ContentWwwrootFiles Include="$(ContentWwwrootFilesPath)" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ stages:
- task: NuGetCommand@2
displayName: Restore NuGet Packages
inputs:
restoreSolution: '*\src\umbraco.sln'
restoreSolution: 'umbraco.sln'
feedsToUse: config
- task: PowerShell@1
displayName: Update Version and Artifact Name
Expand Down
4 changes: 2 additions & 2 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
Write-Host "Restore NuGet"
Write-Host "Logging to $($this.BuildTemp)\nuget.restore.log"
$params = "-Source", $nugetsourceUmbraco
&$this.BuildEnv.NuGet restore "$($this.SolutionRoot)\src\umbraco-netcore-only.sln" > "$($this.BuildTemp)\nuget.restore.log" @params
&$this.BuildEnv.NuGet restore "$($this.SolutionRoot)\umbraco-netcore-only.sln" > "$($this.BuildTemp)\nuget.restore.log" @params
if (-not $?) { throw "Failed to restore NuGet packages." }
})

Expand All @@ -401,7 +401,7 @@

Write-Host "Create NuGet packages"

&dotnet pack "$($this.SolutionRoot)\src\umbraco-netcore-only.sln" `
&dotnet pack "$($this.SolutionRoot)\umbraco-netcore-only.sln" `
--output "$($this.BuildOutput)" `
--verbosity detailed `
-c Release `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"version": {
"type": "parameter",
"datatype": "string",
"defaultValue": "9.0.0",
"defaultValue": "9.1.0",
"description": "The version of Umbraco to load using NuGet",
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"version": {
"type": "parameter",
"datatype": "string",
"defaultValue": "9.0.0",
"defaultValue": "9.1.0",
"description": "The version of Umbraco to load using NuGet",
"replaces": "UMBRACO_VERSION_FROM_TEMPLATE"
},
Expand Down
10 changes: 10 additions & 0 deletions build/templates/UmbracoProject/UmbracoProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
<DefaultItemExcludes>$(DefaultItemExcludes);wwwroot/media/**;</DefaultItemExcludes>
</PropertyGroup>

<!-- Force windows to use ICU. Otherwise Windows 10 2019H1+ will do it, but older windows 10 and most if not all winodws servers will run NLS -->
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.6" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="UMBRACO_VERSION_FROM_TEMPLATE" />
<PackageReference Include="Umbraco.Cms.SqlCe" Version="UMBRACO_VERSION_FROM_TEMPLATE" Condition="'$(UseSqlCe)' == 'true'" />
Expand All @@ -30,6 +36,10 @@
<Compile Include="umbraco/models/**" Exclude="**/*.flag" />
</ItemGroup>

<PropertyGroup>
<CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
</PropertyGroup>

<!-- Set this to true if ModelsBuilder mode is not InMemoryAuto-->
<PropertyGroup>
<RazorCompileOnBuild>false</RazorCompileOnBuild>
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<Version>9.0.0</Version>
<AssemblyVersion>9.0.0</AssemblyVersion>
<InformationalVersion>9.0.0</InformationalVersion>
<FileVersion>9.0.0</FileVersion>
<Version>9.1.0</Version>
<AssemblyVersion>9.1.0</AssemblyVersion>
<InformationalVersion>9.1.0</InformationalVersion>
<FileVersion>9.1.0</FileVersion>
<LangVersion Condition="'$(LangVersion)' == ''">9.0</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<Company>Umbraco CMS</Company>
Expand Down
1 change: 1 addition & 0 deletions src/JsonSchema/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class CmsDefinition
public RichTextEditorSettings RichTextEditor { get; set; }
public RuntimeMinificationSettings RuntimeMinification { get; set; }
public BasicAuthSettings BasicAuth { get; set; }
public PackageMigrationSettings PackageMigration { get; set; }
}

/// <summary>
Expand Down
40 changes: 40 additions & 0 deletions src/Umbraco.Core/Configuration/Models/PackageMigrationSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.

using System.ComponentModel;

namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
/// Typed configuration options for package migration settings.
/// </summary>
[UmbracoOptions(Constants.Configuration.ConfigPackageMigration)]
public class PackageMigrationSettings
{
private const bool StaticRunSchemaAndContentMigrations = true;
private const bool StaticAllowComponentOverrideOfRunSchemaAndContentMigrations = true;

/// <summary>
/// Gets or sets a value indicating whether package migration steps that install schema and content should run.
/// </summary>
/// <remarks>
/// By default this is true and schema and content defined in a package migration are installed.
/// Using configuration, administrators can optionally switch this off in certain environments.
/// Deployment tools such as Umbraco Deploy can also configure this option to run or not run these migration
/// steps as is appropriate for normal use of the tool.
/// </remarks>
[DefaultValue(StaticRunSchemaAndContentMigrations)]
public bool RunSchemaAndContentMigrations { get; set; } = StaticRunSchemaAndContentMigrations;

/// <summary>
/// Gets or sets a value indicating whether components can override the configured value for <see cref="RunSchemaAndContentMigrations"/>.
/// </summary>
/// <remarks>
/// By default this is true and components can override the configured setting for <see cref="RunSchemaAndContentMigrations"/>.
/// If an administrator wants explicit control over which environments migration steps installing schema and content can run,
/// they can set this to false. Components should respect this and not override the configuration.
/// </remarks>
[DefaultValue(StaticAllowComponentOverrideOfRunSchemaAndContentMigrations)]
public bool AllowComponentOverrideOfRunSchemaAndContentMigrations { get; set; } = StaticAllowComponentOverrideOfRunSchemaAndContentMigrations;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class RuntimeMinificationSettings
{
internal const bool StaticUseInMemoryCache = false;
internal const string StaticCacheBuster = "Version";
internal const string StaticVersion = null;

/// <summary>
/// Use in memory cache
Expand All @@ -19,5 +20,11 @@ public class RuntimeMinificationSettings
/// </summary>
[DefaultValue(StaticCacheBuster)]
public RuntimeMinificationCacheBuster CacheBuster { get; set; } = Enum<RuntimeMinificationCacheBuster>.Parse(StaticCacheBuster);

/// <summary>
/// The unique version string used if CacheBuster is 'Version'.
/// </summary>
[DefaultValue(StaticVersion)]
public string Version { get; set; } = StaticVersion;
}
}
10 changes: 6 additions & 4 deletions src/Umbraco.Core/Configuration/Models/UnattendedSettings.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
using System.ComponentModel;
// Copyright (c) Umbraco.
// See LICENSE for more details.

using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Umbraco.Cms.Core.Configuration.Models
{

/// <summary>
/// Typed configuration options for unattended settings.
/// </summary>
[UmbracoOptions(Constants.Configuration.ConfigUnattended)]
public class UnattendedSettings
{
internal const bool StaticInstallUnattended = false;
internal const bool StaticUpgradeUnattended = false;
private const bool StaticInstallUnattended = false;
private const bool StaticUpgradeUnattended = false;

/// <summary>
/// Gets or sets a value indicating whether unattended installs are enabled.
Expand Down
1 change: 1 addition & 0 deletions src/Umbraco.Core/Constants-Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static class Configuration
public const string ConfigWebRouting = ConfigPrefix + "WebRouting";
public const string ConfigUserPassword = ConfigPrefix + "Security:UserPassword";
public const string ConfigRichTextEditor = ConfigPrefix + "RichTextEditor";
public const string ConfigPackageMigration = ConfigPrefix + "PackageMigration";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
namespace Umbraco.Cms.Web.Common.DependencyInjection
{
/// <summary>
/// INTERNAL Service locator. Should only be used if no other ways exist.
/// Service locator for internal (umbraco cms) only purposes. Should only be used if no other ways exist.
/// </summary>
/// <remarks>
/// It is created with only two goals in mind
/// 1) Continue to have the same extension methods on IPublishedContent and IPublishedElement as in V8. To make migration easier.
/// 2) To have a tool to avoid breaking changes in minor versions. All methods using this should in theory be obsolete.
/// 2) To have a tool to avoid breaking changes in minor and patch versions. All methods using this should in theory be obsolete.
///
/// Keep in mind, every time this is used, the code becomes basically untestable.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class StaticServiceProvider
public static class StaticServiceProvider
{
/// <summary>
/// The service locator.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal static IServiceProvider Instance { get; set; }
public static IServiceProvider Instance { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public static IUmbracoBuilder AddConfiguration(this IUmbracoBuilder builder)
.AddUmbracoOptions<UnattendedSettings>()
.AddUmbracoOptions<RichTextEditorSettings>()
.AddUmbracoOptions<BasicAuthSettings>()
.AddUmbracoOptions<RuntimeMinificationSettings>();
.AddUmbracoOptions<RuntimeMinificationSettings>()
.AddUmbracoOptions<PackageMigrationSettings>();

return builder;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
using Umbraco.Cms.Core.Sync;
using Umbraco.Cms.Core.Templates;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Web.Common.DependencyInjection;
using Umbraco.Extensions;

namespace Umbraco.Cms.Core.DependencyInjection
Expand Down Expand Up @@ -179,6 +180,7 @@ private void AddCoreServices()
Services.AddUnique<UriUtility>();

Services.AddUnique<IDashboardService, DashboardService>();
Services.AddUnique<IUserDataService, UserDataService>();

// will be injected in controllers when needed to invoke rest endpoints on Our
Services.AddUnique<IInstallationService, InstallationService>();
Expand Down
19 changes: 19 additions & 0 deletions src/Umbraco.Core/Models/UserData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Runtime.Serialization;

namespace Umbraco.Cms.Core.Models
{
[DataContract]
public class UserData
{
[DataMember(Name = "name")]
public string Name { get; }
[DataMember(Name = "data")]
public string Data { get; }

public UserData(string name, string data)
{
Name = name;
Data = data;
}
}
}
2 changes: 2 additions & 0 deletions src/Umbraco.Core/Packaging/InstallationSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public InstallationSummary(string packageName)
public IEnumerable<IPartialView> PartialViewsInstalled { get; set; } = Enumerable.Empty<IPartialView>();
public IEnumerable<IContent> ContentInstalled { get; set; } = Enumerable.Empty<IContent>();
public IEnumerable<IMedia> MediaInstalled { get; set; } = Enumerable.Empty<IMedia>();
public IEnumerable<EntityContainer> EntityContainersInstalled { get; set; } = Enumerable.Empty<EntityContainer>();

public override string ToString()
{
Expand Down Expand Up @@ -77,6 +78,7 @@ void WriteCount<T>(string message, IEnumerable<T> source, bool appendLine = true
WriteCount("Stylesheets installed: ", StylesheetsInstalled);
WriteCount("Scripts installed: ", ScriptsInstalled);
WriteCount("Partial views installed: ", PartialViewsInstalled);
WriteCount("Entity containers installed: ", EntityContainersInstalled);
WriteCount("Content items installed: ", ContentInstalled);
WriteCount("Media items installed: ", MediaInstalled, false);

Expand Down
7 changes: 6 additions & 1 deletion src/Umbraco.Core/Routing/PublishedRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public async Task<IPublishedRequest> UpdateRequestAsync(IPublishedRequest reques

// re-route
await RouteRequestInternalAsync(builder);

// return if we are redirect
if (builder.IsRedirect())
{
Expand All @@ -252,6 +252,11 @@ public async Task<IPublishedRequest> UpdateRequestAsync(IPublishedRequest reques
builder.SetPublishedContent(content);
}

if (!builder.HasDomain())
{
FindDomain(builder);
}

return BuildRequest(builder);
}

Expand Down
10 changes: 10 additions & 0 deletions src/Umbraco.Core/Services/IUserDataService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections.Generic;
using Umbraco.Cms.Core.Models;

namespace Umbraco.Cms.Core.Services
{
public interface IUserDataService
{
IEnumerable<UserData> GetUserData();
}
}
48 changes: 48 additions & 0 deletions src/Umbraco.Core/Services/UserDataService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Core.Models;
using Umbraco.Extensions;

namespace Umbraco.Cms.Core.Services
{
public class UserDataService : IUserDataService
{
private readonly IUmbracoVersion _version;
private readonly ILocalizationService _localizationService;

public UserDataService(IUmbracoVersion version, ILocalizationService localizationService)
{
_version = version;
_localizationService = localizationService;
}

public IEnumerable<UserData> GetUserData() =>
new List<UserData>
{
new("Server OS", RuntimeInformation.OSDescription),
new("Server Framework", RuntimeInformation.FrameworkDescription),
new("Default Language", _localizationService.GetDefaultLanguageIsoCode()),
new("Umbraco Version", _version.SemanticVersion.ToSemanticStringWithoutBuild()),
new("Current Culture", Thread.CurrentThread.CurrentCulture.ToString()),
new("Current UI Culture", Thread.CurrentThread.CurrentUICulture.ToString()),
new("Current Webserver", GetCurrentWebServer())
};

private string GetCurrentWebServer() => IsRunningInProcessIIS() ? "IIS" : "Kestrel";

public bool IsRunningInProcessIIS()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return false;
}

string processName = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().ProcessName);
return (processName.Contains("w3wp") || processName.Contains("iisexpress"));
}
}
}
4 changes: 2 additions & 2 deletions src/Umbraco.Core/Udi.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
using System.Linq;

Expand Down Expand Up @@ -44,7 +44,7 @@ protected Udi(Uri uriValue)

public int CompareTo(Udi other)
{
return string.Compare(UriValue.ToString(), other.UriValue.ToString(), StringComparison.InvariantCultureIgnoreCase);
return string.Compare(UriValue.ToString(), other.UriValue.ToString(), StringComparison.OrdinalIgnoreCase);
}

public override string ToString()
Expand Down
Loading

0 comments on commit 79fdb9a

Please sign in to comment.