-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3368 from 2sic/develop
v17.07
- Loading branch information
Showing
133 changed files
with
1,266 additions
and
835 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...Dnn.Core/Compatibility/ToSic.SexyContent.Environment.Dnn7.DataSources.DnnSqlDataSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
using ToSic.Eav.Data.Build; | ||
using ToSic.Eav.DataSources; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace ToSic.SexyContent.Environment.Dnn7.DataSources; | ||
|
||
[PrivateApi] | ||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] | ||
[Obsolete("This class was moved / to ToSic.Sxc.Dnn.DataSources.DnnSql, use that instead.")] | ||
public class DnnSqlDataSource : Sxc.Dnn.DataSources.DnnSql | ||
public class DnnSqlDataSource(Sql.MyServices services, IDataFactory dataFactory) | ||
: Sxc.Dnn.DataSources.DnnSql(services, dataFactory) | ||
{ | ||
// Todo: leave this helper class/message in till 2sxc 09.00, then either extract into an own DLL | ||
// - we might also write some SQL to update existing pipelines, but it's not likely to have been used much... | ||
// - and otherwise im might be in razor-code, which we couldn't auto-update | ||
|
||
public DnnSqlDataSource(MyServices services, IDataFactory dataFactory) : base(services, dataFactory) | ||
{ | ||
} | ||
} |
8 changes: 5 additions & 3 deletions
8
.../Compatibility/ToSic.SexyContent.Environment.Dnn7.DataSources.DnnUserProfileDataSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
using ToSic.Eav.Data.Build; | ||
using ToSic.Sxc.Dnn.DataSources; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace ToSic.SexyContent.Environment.Dnn7.DataSources; | ||
|
||
[PrivateApi] | ||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] | ||
[Obsolete("This class was moved / to ToSic.Sxc.Dnn.DataSources.DnnUserProfile, use that instead.")] | ||
public class DnnUserProfileDataSource : ToSic.Sxc.Dnn.DataSources.DnnUserProfile | ||
public class DnnUserProfileDataSource(DnnUserProfile.MyServices services, IDataFactory dataFactory) | ||
: ToSic.Sxc.Dnn.DataSources.DnnUserProfile(services, dataFactory) | ||
{ | ||
// Todo: leave this helper class/message in till 2sxc 09.00, then either extract into an own DLL | ||
// - we might also write some SQL to update existing pipelines, but it's not likely to have been used much... | ||
// - and otherwise im might be in razor-code, which we couldn't auto-update | ||
|
||
public DnnUserProfileDataSource(MyServices services, IDataFactory dataFactory) : base(services, dataFactory) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,43 @@ | ||
using System.IO; | ||
using System.Web; | ||
|
||
namespace ToSic.Sxc.Dnn.Compile | ||
namespace ToSic.Sxc.Dnn.Compile; | ||
|
||
/// <summary> | ||
/// DNN on start need to clean the "2sxc.bin", because it is used to temporary save shared temp AppCode assemblies. | ||
/// </summary> | ||
internal static class AppCode | ||
{ | ||
/// <summary> | ||
/// DNN on start need to clean the "2sxc.bin", because it is used to temporary save shared temp AppCode assemblies. | ||
/// </summary> | ||
[PrivateApi] | ||
public static class AppCode | ||
private static bool Cleaned { get; set; } | ||
private static readonly object CleaningLock = new(); | ||
private static string TempAssemblyFolderPath { get; } = Path.Combine(HttpContext.Current.Server.MapPath("~/App_Data"), "2sxc.bin"); | ||
|
||
public static void CleanTempAssemblyFolder() | ||
{ | ||
private static bool Cleaned { get; set; } | ||
private static readonly object CleaningLock = new(); | ||
private static string TempAssemblyFolderPath { get; } = Path.Combine(HttpContext.Current.Server.MapPath("~/App_Data"), "2sxc.bin"); | ||
// Ensure that cleaning is executed only once | ||
if (Cleaned) return; | ||
|
||
public static void CleanTempAssemblyFolder() | ||
lock (CleaningLock) | ||
{ | ||
// Ensure that cleaning is executed only once | ||
if (Cleaned) return; | ||
|
||
lock (CleaningLock) | ||
if (Directory.Exists(TempAssemblyFolderPath)) | ||
{ | ||
if (Cleaned) return; | ||
|
||
if (Directory.Exists(TempAssemblyFolderPath)) | ||
var filesToClean = Directory.GetFiles(TempAssemblyFolderPath, "*.*", SearchOption.TopDirectoryOnly); | ||
foreach (var file in filesToClean) | ||
{ | ||
var filesToClean = Directory.GetFiles(TempAssemblyFolderPath, "*.*", SearchOption.TopDirectoryOnly); | ||
foreach (var file in filesToClean) | ||
try | ||
{ | ||
try | ||
{ | ||
File.Delete(file); | ||
} | ||
catch | ||
{ | ||
// ignored | ||
} | ||
File.Delete(file); | ||
} | ||
catch | ||
{ | ||
// ignored | ||
} | ||
|
||
} | ||
Cleaned = true; | ||
|
||
} | ||
Cleaned = true; | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Src/Dnn/ToSic.Sxc.Dnn.Core/Dnn/Compile/AssemblyExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Reflection; | ||
using System.Web.Configuration; | ||
|
||
namespace ToSic.Sxc.Dnn.Compile | ||
{ | ||
public static class AssemblyExtensions | ||
{ | ||
// for assembly references | ||
public static Assembly WithPolicy(this Assembly assembly) | ||
=> | ||
// apply binding redirections from web.config | ||
Assembly.ReflectionOnlyLoad(System.AppDomain.CurrentDomain.ApplyPolicy(assembly.FullName)); | ||
|
||
public static Assembly WithPolicy(this AssemblyInfo ai) | ||
=> | ||
// apply binding redirections from web.config | ||
Assembly.ReflectionOnlyLoad(System.AppDomain.CurrentDomain.ApplyPolicy(ai.Assembly)); | ||
} | ||
} |
27 changes: 13 additions & 14 deletions
27
Src/Dnn/ToSic.Sxc.Dnn.Core/Dnn/Compile/DnnRoslynConstants.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
namespace ToSic.Sxc.Dnn.Compile | ||
namespace ToSic.Sxc.Dnn.Compile; | ||
|
||
internal class DnnRoslynConstants | ||
{ | ||
internal class DnnRoslynConstants | ||
{ | ||
/// <summary> | ||
/// The web.config disable warnings which are in the default DNN web.config | ||
/// </summary> | ||
public const string DefaultDisableWarnings = "/nowarn:1659;1699;1701;612;618"; | ||
/// <summary> | ||
/// The web.config disable warnings which are in the default DNN web.config | ||
/// </summary> | ||
public const string DefaultDisableWarnings = "/nowarn:1659;1699;1701;612;618"; | ||
|
||
/// <summary> | ||
/// The default language version to use when compiling | ||
/// </summary> | ||
public const string DefaultLangVersion = "8"; // "7.3"; | ||
/// <summary> | ||
/// The default language version to use when compiling | ||
/// </summary> | ||
public const string DefaultLangVersion = "8"; // "7.3"; | ||
|
||
public const string CompilerOptionLanguageVersion = $"/langversion:{DefaultLangVersion}"; | ||
} | ||
} | ||
public const string CompilerOptionLanguageVersion = $"/langversion:{DefaultLangVersion}"; | ||
} |
27 changes: 13 additions & 14 deletions
27
Src/Dnn/ToSic.Sxc.Dnn.Core/Dnn/Compile/HostingEnvironmentWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
namespace ToSic.Sxc.Dnn.Compile | ||
namespace ToSic.Sxc.Dnn.Compile; | ||
|
||
/// <summary> | ||
/// wrapper around HostingEnvironment | ||
/// </summary> | ||
/// <remarks>to mock the wrapper in unit tests</remarks> | ||
[PrivateApi] | ||
public class HostingEnvironmentWrapper : IHostingEnvironmentWrapper | ||
{ | ||
/// <summary> | ||
/// wrapper around HostingEnvironment | ||
/// </summary> | ||
/// <remarks>to mock the wrapper in unit tests</remarks> | ||
[PrivateApi] | ||
public class HostingEnvironmentWrapper : IHostingEnvironmentWrapper | ||
{ | ||
/// <summary>Maps a virtual path to a physical path on the server.</summary> | ||
/// <param name="virtualPath">The virtual path (absolute or relative).</param> | ||
/// <returns>The physical path on the server specified by <paramref name="virtualPath" />.</returns> | ||
public string MapPath(string virtualPath) => System.Web.Hosting.HostingEnvironment.MapPath(virtualPath); | ||
} | ||
} | ||
/// <summary>Maps a virtual path to a physical path on the server.</summary> | ||
/// <param name="virtualPath">The virtual path (absolute or relative).</param> | ||
/// <returns>The physical path on the server specified by <paramref name="virtualPath" />.</returns> | ||
public string MapPath(string virtualPath) => System.Web.Hosting.HostingEnvironment.MapPath(virtualPath); | ||
} |
11 changes: 5 additions & 6 deletions
11
Src/Dnn/ToSic.Sxc.Dnn.Core/Dnn/Compile/IHostingEnvironmentWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
namespace ToSic.Sxc.Dnn.Compile | ||
namespace ToSic.Sxc.Dnn.Compile; | ||
|
||
[PrivateApi] | ||
public interface IHostingEnvironmentWrapper | ||
{ | ||
[PrivateApi] | ||
public interface IHostingEnvironmentWrapper | ||
{ | ||
string MapPath(string virtualPath); | ||
} | ||
string MapPath(string virtualPath); | ||
} |
11 changes: 5 additions & 6 deletions
11
Src/Dnn/ToSic.Sxc.Dnn.Core/Dnn/Compile/IReferencedAssembliesProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
using ToSic.Sxc.Code.Internal.HotBuild; | ||
|
||
namespace ToSic.Sxc.Dnn.Compile | ||
namespace ToSic.Sxc.Dnn.Compile; | ||
|
||
[PrivateApi] | ||
public interface IReferencedAssembliesProvider | ||
{ | ||
[PrivateApi] | ||
public interface IReferencedAssembliesProvider | ||
{ | ||
List<string> Locations(string virtualPath, HotBuildSpec spec); | ||
} | ||
List<string> Locations(string virtualPath, HotBuildSpec spec); | ||
} |
18 changes: 18 additions & 0 deletions
18
Src/Dnn/ToSic.Sxc.Dnn.Core/Dnn/Compile/Internal/AppJsonExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using ToSic.Eav.Apps.Internal; | ||
|
||
namespace ToSic.Sxc.Dnn.Compile.Internal; | ||
|
||
[PrivateApi] | ||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] | ||
public static class AppJsonExtensions | ||
{ | ||
|
||
/// <summary> | ||
/// Check that the app is configured in app.json to always use Roslyn compiler | ||
/// </summary> | ||
/// <param name="appJsonService"></param> | ||
/// <param name="appId"></param> | ||
/// <returns></returns> | ||
public static bool DnnCompilerAlwaysUseRoslyn(this IAppJsonService appJsonService, int appId) | ||
=> appJsonService.GetAppJson(appId)?.DotNet?.Compiler?.Equals("roslyn", StringComparison.OrdinalIgnoreCase) == true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.