Merge branch 'netcore/feature/non-static-iohelper' into netcore/feature/AB3594_move_exsiting_configuration_to_own_project

# Conflicts:
#	src/Umbraco.Core/Manifest/ManifestParser.cs
#	src/Umbraco.Tests/Composing/CompositionTests.cs
This commit is contained in:
Bjarke Berg
2019-11-08 07:55:23 +01:00
142 changed files with 3140 additions and 2729 deletions
+3 -1
View File
@@ -39,6 +39,8 @@ To build Umbraco, fire up PowerShell and move to Umbraco's repository root (the
build/build.ps1
If you only see a build.bat-file, you're probably on the wrong branch. If you switch to the correct branch (dev-v8) the file will appear and you can build it.
You might run into [Powershell quirks](#powershell-quirks).
### Build Infrastructure
@@ -209,4 +211,4 @@ The best solution is to unblock the Zip file before un-zipping: right-click the
### Git Quirks
Git might have issues dealing with long file paths during build. You may want/need to enable `core.longpaths` support (see [this page](https://github.com/msysgit/msysgit/wiki/Git-cannot-create-a-file-or-directory-with-a-long-path) for details).
Git might have issues dealing with long file paths during build. You may want/need to enable `core.longpaths` support (see [this page](https://github.com/msysgit/msysgit/wiki/Git-cannot-create-a-file-or-directory-with-a-long-path) for details).
+2 -1
View File
@@ -59,7 +59,8 @@ Great question! The short version goes like this:
* **Clone** - when GitHub has created your fork, you can clone it in your favorite Git tool
![Clone the fork](img/clonefork.png)
* **Switch to the correct branch** - switch to the v8-dev branch
* **Build** - build your fork of Umbraco locally as described in [building Umbraco from source code](BUILD.md)
* **Change** - make your changes, experiment, have fun, explore and learn, and don't be afraid. We welcome all contributions and will [happily give feedback](#questions)
* **Commit** - done? Yay! 🎉 **Important:** create a new branch now and name it after the issue you're fixing, we usually follow the format: `temp-12345`. This means it's a temporary branch for the particular issue you're working on, in this case `12345`. When you have a branch, commit your changes. Don't commit to `v8/dev`, create a new branch first.
+5 -5
View File
@@ -7,15 +7,15 @@ A brief description of the issue goes here.
<!--
If you haven't yet done so, please read the "contributing guidelines"
thoroughly. Then, proceed by filling out the rest of the details in the issue
template below. The more details you can give us, the easier it will be for us
Please fill out the rest of the details in the issue template below.
The more details you can give us, the easier it will be for us
to determine the cause of a problem.
See: https://github.com/umbraco/Umbraco-CMS/blob/v8/dev/.github/CONTRIBUTING.md
-->
## Umbraco version
I am seeing this issue on Umbraco version: <!-- please note the version here -->
Reproduction
+2 -7
View File
@@ -11,17 +11,12 @@ Y88 88Y 888 888 888 888 d88P 888 888 888 Y88b. Y88..88P
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.
We've overwritten all the files in the Umbraco folder, these have been backed up in
App_Data\NuGetBackup. We didn't overwrite the UI.xml file nor did we remove any files or folders that you or
a package might have added. Only the existing files were overwritten. If you customized anything then make
sure to do a compare and merge with the NuGetBackup folder.
We've done our best to transform your configuration files but in case something is not quite right: we recommmend you look in source control for the previous version so you can find the original files before they were transformed.
This NuGet package includes build targets that extend the creation of a deploy package, which is generated by
Publishing from Visual Studio. The targets will only work once Publishing is configured, so if you don't use
Publish this won't affect you.
The following items will now be automatically included when creating a deploy package or publishing to the file
system: umbraco, config\splashes and global.asax.
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
@@ -9,7 +8,7 @@ namespace Umbraco.Core.Models
/// </summary>
/// <typeparam name="T"></typeparam>
[DataContract(Name = "pagedCollection", Namespace = "")]
public class PagedResult<T>
public abstract class PagedResult
{
public PagedResult(long totalItems, long pageNumber, long pageSize)
{
@@ -39,9 +38,6 @@ namespace Umbraco.Core.Models
[DataMember(Name = "totalItems")]
public long TotalItems { get; private set; }
[DataMember(Name = "items")]
public IEnumerable<T> Items { get; set; }
/// <summary>
/// Calculates the skip size based on the paged parameters specified
/// </summary>
@@ -22,13 +22,13 @@ namespace Umbraco.Core.Compose
}
public void Initialize()
{
{
if (_runtimeState.Debug == false) return;
//if (ApplicationContext.Current.IsConfigured == false || GlobalSettings.DebugMode == false)
// return;
var appPlugins = IOHelper.MapPath("~/App_Plugins/");
var appPlugins = Current.IOHelper.MapPath("~/App_Plugins/");
if (Directory.Exists(appPlugins) == false) return;
_mw = new ManifestWatcher(_logger);
@@ -71,7 +71,7 @@ namespace Umbraco.Core.Composing.CompositionExtensions
new PackageInstallation(
factory.GetInstance<PackageDataInstallation>(), factory.GetInstance<PackageFileInstallation>(),
factory.GetInstance<CompiledPackageXmlParser>(), factory.GetInstance<IPackageActionRunner>(),
new DirectoryInfo(IOHelper.GetRootDirectorySafe())));
new DirectoryInfo(Current.IOHelper.GetRootDirectorySafe())));
return composition;
}
@@ -89,9 +89,9 @@ namespace Umbraco.Core.Composing.CompositionExtensions
private static LocalizedTextServiceFileSources SourcesFactory(IFactory container)
{
var mainLangFolder = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/"));
var appPlugins = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.AppPlugins));
var configLangFolder = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Config + "/lang/"));
var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/"));
var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.AppPlugins));
var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Config + "/lang/"));
var pluginLangFolders = appPlugins.Exists == false
? Enumerable.Empty<LocalizedTextServiceSupplementaryFileSource>()
+3
View File
@@ -205,6 +205,9 @@ namespace Umbraco.Core.Composing
public static IVariationContextAccessor VariationContextAccessor
=> Factory.GetInstance<IVariationContextAccessor>();
public static IIOHelper IOHelper
=> new IOHelper();
#endregion
}
}
+3 -3
View File
@@ -78,7 +78,7 @@ namespace Umbraco.Core.Composing
HashSet<Assembly> assemblies = null;
try
{
var isHosted = IOHelper.IsHosted;
var isHosted = Current.IOHelper.IsHosted;
try
{
@@ -97,7 +97,7 @@ namespace Umbraco.Core.Composing
{
//NOTE: we cannot use AppDomain.CurrentDomain.GetAssemblies() because this only returns assemblies that have
// already been loaded in to the app domain, instead we will look directly into the bin folder and load each one.
var binFolder = IOHelper.GetRootDirectoryBinFolder();
var binFolder = Current.IOHelper.GetRootDirectoryBinFolder();
var binAssemblyFiles = Directory.GetFiles(binFolder, "*.dll", SearchOption.TopDirectoryOnly).ToList();
//var binFolder = Assembly.GetExecutingAssembly().GetAssemblyFile().Directory;
//var binAssemblyFiles = Directory.GetFiles(binFolder.FullName, "*.dll", SearchOption.TopDirectoryOnly).ToList();
@@ -135,7 +135,7 @@ namespace Umbraco.Core.Composing
//here we are trying to get the App_Code assembly
var fileExtensions = new[] { ".cs", ".vb" }; //only vb and cs files are supported
var appCodeFolder = new DirectoryInfo(IOHelper.MapPath(IOHelper.ResolveUrl("~/App_code")));
var appCodeFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.IOHelper.ResolveUrl("~/App_code")));
//check if the folder exists and if there are any files in it with the supported file extensions
if (appCodeFolder.Exists && fileExtensions.Any(x => appCodeFolder.GetFiles("*" + x).Any()))
{
+3 -3
View File
@@ -181,11 +181,11 @@ namespace Umbraco.Core.Composing
_currentAssembliesHash = GetFileHash(new List<Tuple<FileSystemInfo, bool>>
{
// the bin folder and everything in it
new Tuple<FileSystemInfo, bool>(new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Bin)), false),
new Tuple<FileSystemInfo, bool>(new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Bin)), false),
// the app code folder and everything in it
new Tuple<FileSystemInfo, bool>(new DirectoryInfo(IOHelper.MapPath("~/App_Code")), false),
new Tuple<FileSystemInfo, bool>(new DirectoryInfo(Current.IOHelper.MapPath("~/App_Code")), false),
// global.asax (the app domain also monitors this, if it changes will do a full restart)
new Tuple<FileSystemInfo, bool>(new FileInfo(IOHelper.MapPath("~/global.asax")), false)
new Tuple<FileSystemInfo, bool>(new FileInfo(Current.IOHelper.MapPath("~/global.asax")), false)
}, _logger);
return _currentAssembliesHash;
@@ -18,7 +18,7 @@ namespace Umbraco.Core
public static void AddCoreConfigs(this Configs configs)
{
var configDir = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Config));
var configDir = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Config));
// GridConfig depends on runtime caches, manifest parsers... and cannot be available during composition
configs.Add<IGridConfig>(factory => new GridConfig(
@@ -6,6 +6,7 @@ using System.Web;
using System.Web.Configuration;
using System.Web.Hosting;
using System.Xml.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
namespace Umbraco.Core.Configuration
@@ -140,7 +141,7 @@ namespace Umbraco.Core.Configuration
get
{
return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.Path)
? IOHelper.ResolveUrl(ConfigurationManager.AppSettings[Constants.AppSettings.Path])
? Current.IOHelper.ResolveUrl(ConfigurationManager.AppSettings[Constants.AppSettings.Path])
: string.Empty;
}
}
@@ -170,7 +171,7 @@ namespace Umbraco.Core.Configuration
/// <param name="value">Value of the setting to be saved.</param>
internal static void SaveSetting(string key, string value)
{
var fileName = IOHelper.MapPath(string.Format("{0}/web.config", SystemDirectories.Root));
var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", SystemDirectories.Root));
var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single();
@@ -192,7 +193,7 @@ namespace Umbraco.Core.Configuration
/// <param name="key">Key of the setting to be removed.</param>
internal static void RemoveSetting(string key)
{
var fileName = IOHelper.MapPath(string.Format("{0}/web.config", SystemDirectories.Root));
var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", SystemDirectories.Root));
var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single();
@@ -319,7 +320,7 @@ namespace Umbraco.Core.Configuration
//case LocalTempStorage.Default:
//case LocalTempStorage.Unknown:
default:
return _localTempPath = IOHelper.MapPath("~/App_Data/TEMP");
return _localTempPath = Current.IOHelper.MapPath("~/App_Data/TEMP");
}
}
}
+1 -1
View File
@@ -148,7 +148,7 @@ namespace Umbraco.Core
if (filename == null || filestream == null) return;
// get a safe & clean filename
filename = IOHelper.SafeFileName(filename);
filename = Current.IOHelper.SafeFileName(filename);
if (string.IsNullOrWhiteSpace(filename)) return;
filename = filename.ToLower();
+3 -2
View File
@@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
namespace Umbraco.Core.Diagnostics
@@ -109,7 +110,7 @@ namespace Umbraco.Core.Diagnostics
// filter everywhere in our code = not!
var stacktrace = withException ? Environment.StackTrace : string.Empty;
var filepath = IOHelper.MapPath("~/App_Data/MiniDump");
var filepath = Current.IOHelper.MapPath("~/App_Data/MiniDump");
if (Directory.Exists(filepath) == false)
Directory.CreateDirectory(filepath);
@@ -125,7 +126,7 @@ namespace Umbraco.Core.Diagnostics
{
lock (LockO)
{
var filepath = IOHelper.MapPath("~/App_Data/MiniDump");
var filepath = Current.IOHelper.MapPath("~/App_Data/MiniDump");
if (Directory.Exists(filepath) == false) return true;
var count = Directory.GetFiles(filepath, "*.dmp").Length;
return count < 8;
+84
View File
@@ -0,0 +1,84 @@
using System.Collections.Generic;
namespace Umbraco.Core.IO
{
public interface IIOHelper
{
bool ForceNotHosted { get; set; }
/// <summary>
/// Gets a value indicating whether Umbraco is hosted.
/// </summary>
bool IsHosted { get; }
char DirSepChar { get; }
string FindFile(string virtualPath);
string ResolveVirtualUrl(string path);
string ResolveUrl(string virtualPath);
Attempt<string> TryResolveUrl(string virtualPath);
string MapPath(string path, bool useHttpContext);
string MapPath(string path);
string ReturnPath(string settingsKey, string standardPath, bool useTilde);
string ReturnPath(string settingsKey, string standardPath);
/// <summary>
/// Verifies that the current filepath matches a directory where the user is allowed to edit a file.
/// </summary>
/// <param name="filePath">The filepath to validate.</param>
/// <param name="validDir">The valid directory.</param>
/// <returns>A value indicating whether the filepath is valid.</returns>
bool VerifyEditPath(string filePath, string validDir);
/// <summary>
/// Verifies that the current filepath matches one of several directories where the user is allowed to edit a file.
/// </summary>
/// <param name="filePath">The filepath to validate.</param>
/// <param name="validDirs">The valid directories.</param>
/// <returns>A value indicating whether the filepath is valid.</returns>
bool VerifyEditPath(string filePath, IEnumerable<string> validDirs);
/// <summary>
/// Verifies that the current filepath has one of several authorized extensions.
/// </summary>
/// <param name="filePath">The filepath to validate.</param>
/// <param name="validFileExtensions">The valid extensions.</param>
/// <returns>A value indicating whether the filepath is valid.</returns>
bool VerifyFileExtension(string filePath, IEnumerable<string> validFileExtensions);
bool PathStartsWith(string path, string root, char separator);
/// <summary>
/// Returns the path to the root of the application, by getting the path to where the assembly where this
/// method is included is present, then traversing until it's past the /bin directory. Ie. this makes it work
/// even if the assembly is in a /bin/debug or /bin/release folder
/// </summary>
/// <returns></returns>
string GetRootDirectorySafe();
string GetRootDirectoryBinFolder();
/// <summary>
/// Allows you to overwrite RootDirectory, which would otherwise be resolved
/// automatically upon application start.
/// </summary>
/// <remarks>The supplied path should be the absolute path to the root of the umbraco site.</remarks>
/// <param name="rootPath"></param>
void SetRootDirectory(string rootPath);
/// <summary>
/// Check to see if filename passed has any special chars in it and strips them to create a safe filename. Used to overcome an issue when Umbraco is used in IE in an intranet environment.
/// </summary>
/// <param name="filePath">The filename passed to the file handler from the upload field.</param>
/// <returns>A safe filename without any path specific chars.</returns>
string SafeFileName(string filePath);
void EnsurePathExists(string path);
/// <summary>
/// Get properly formatted relative path from an existing absolute or relative path
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
string GetRelativePath(string path);
}
}
+24 -53
View File
@@ -11,13 +11,13 @@ using System.IO.Compression;
namespace Umbraco.Core.IO
{
public static class IOHelper
public class IOHelper : IIOHelper
{
/// <summary>
/// Gets or sets a value forcing Umbraco to consider it is non-hosted.
/// </summary>
/// <remarks>This should always be false, unless unit testing.</remarks>
public static bool ForceNotHosted { get; set; }
public bool ForceNotHosted { get; set; }
private static string _rootDir = "";
@@ -27,12 +27,12 @@ namespace Umbraco.Core.IO
/// <summary>
/// Gets a value indicating whether Umbraco is hosted.
/// </summary>
public static bool IsHosted => !ForceNotHosted && (HttpContext.Current != null || HostingEnvironment.IsHosted);
public bool IsHosted => !ForceNotHosted && (HttpContext.Current != null || HostingEnvironment.IsHosted);
public static char DirSepChar => Path.DirectorySeparatorChar;
public char DirSepChar => Path.DirectorySeparatorChar;
//helper to try and match the old path to a new virtual one
public static string FindFile(string virtualPath)
public string FindFile(string virtualPath)
{
string retval = virtualPath;
@@ -45,14 +45,14 @@ namespace Umbraco.Core.IO
return retval;
}
public static string ResolveVirtualUrl(string path)
public string ResolveVirtualUrl(string path)
{
if (string.IsNullOrWhiteSpace(path)) return path;
return path.StartsWith("~/") ? ResolveUrl(path) : path;
}
//Replaces tildes with the root dir
public static string ResolveUrl(string virtualPath)
public string ResolveUrl(string virtualPath)
{
if (virtualPath.StartsWith("~"))
return virtualPath.Replace("~", SystemDirectories.Root).Replace("//", "/");
@@ -62,7 +62,7 @@ namespace Umbraco.Core.IO
return VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root);
}
public static Attempt<string> TryResolveUrl(string virtualPath)
public Attempt<string> TryResolveUrl(string virtualPath)
{
try
{
@@ -78,7 +78,7 @@ namespace Umbraco.Core.IO
}
}
public static string MapPath(string path, bool useHttpContext)
public string MapPath(string path, bool useHttpContext)
{
if (path == null) throw new ArgumentNullException("path");
useHttpContext = useHttpContext && IsHosted;
@@ -102,19 +102,19 @@ namespace Umbraco.Core.IO
}
var root = GetRootDirectorySafe();
var newPath = path.TrimStart('~', '/').Replace('/', IOHelper.DirSepChar);
var retval = root + IOHelper.DirSepChar.ToString(CultureInfo.InvariantCulture) + newPath;
var newPath = path.TrimStart('~', '/').Replace('/', DirSepChar);
var retval = root + DirSepChar.ToString(CultureInfo.InvariantCulture) + newPath;
return retval;
}
public static string MapPath(string path)
public string MapPath(string path)
{
return MapPath(path, true);
}
//use a tilde character instead of the complete path
internal static string ReturnPath(string settingsKey, string standardPath, bool useTilde)
public string ReturnPath(string settingsKey, string standardPath, bool useTilde)
{
var retval = ConfigurationManager.AppSettings[settingsKey];
@@ -124,7 +124,7 @@ namespace Umbraco.Core.IO
return retval.TrimEnd('/');
}
internal static string ReturnPath(string settingsKey, string standardPath)
public string ReturnPath(string settingsKey, string standardPath)
{
return ReturnPath(settingsKey, standardPath, false);
@@ -136,7 +136,7 @@ namespace Umbraco.Core.IO
/// <param name="filePath">The filepath to validate.</param>
/// <param name="validDir">The valid directory.</param>
/// <returns>A value indicating whether the filepath is valid.</returns>
internal static bool VerifyEditPath(string filePath, string validDir)
public bool VerifyEditPath(string filePath, string validDir)
{
return VerifyEditPath(filePath, new[] { validDir });
}
@@ -147,7 +147,7 @@ namespace Umbraco.Core.IO
/// <param name="filePath">The filepath to validate.</param>
/// <param name="validDirs">The valid directories.</param>
/// <returns>A value indicating whether the filepath is valid.</returns>
internal static bool VerifyEditPath(string filePath, IEnumerable<string> validDirs)
public bool VerifyEditPath(string filePath, IEnumerable<string> validDirs)
{
// this is called from ScriptRepository, PartialViewRepository, etc.
// filePath is the fullPath (rooted, filesystem path, can be trusted)
@@ -185,13 +185,13 @@ namespace Umbraco.Core.IO
/// <param name="filePath">The filepath to validate.</param>
/// <param name="validFileExtensions">The valid extensions.</param>
/// <returns>A value indicating whether the filepath is valid.</returns>
internal static bool VerifyFileExtension(string filePath, IEnumerable<string> validFileExtensions)
public bool VerifyFileExtension(string filePath, IEnumerable<string> validFileExtensions)
{
var ext = Path.GetExtension(filePath);
return ext != null && validFileExtensions.Contains(ext.TrimStart('.'));
}
public static bool PathStartsWith(string path, string root, char separator)
public bool PathStartsWith(string path, string root, char separator)
{
// either it is identical to root,
// or it is root + separator + anything
@@ -208,7 +208,7 @@ namespace Umbraco.Core.IO
/// even if the assembly is in a /bin/debug or /bin/release folder
/// </summary>
/// <returns></returns>
internal static string GetRootDirectorySafe()
public string GetRootDirectorySafe()
{
if (String.IsNullOrEmpty(_rootDir) == false)
{
@@ -229,7 +229,7 @@ namespace Umbraco.Core.IO
return _rootDir;
}
internal static string GetRootDirectoryBinFolder()
public string GetRootDirectoryBinFolder()
{
string binFolder = String.Empty;
if (String.IsNullOrEmpty(_rootDir))
@@ -262,7 +262,7 @@ namespace Umbraco.Core.IO
/// </summary>
/// <remarks>The supplied path should be the absolute path to the root of the umbraco site.</remarks>
/// <param name="rootPath"></param>
internal static void SetRootDirectory(string rootPath)
public void SetRootDirectory(string rootPath)
{
_rootDir = rootPath;
}
@@ -272,39 +272,25 @@ namespace Umbraco.Core.IO
/// </summary>
/// <param name="filePath">The filename passed to the file handler from the upload field.</param>
/// <returns>A safe filename without any path specific chars.</returns>
internal static string SafeFileName(string filePath)
public string SafeFileName(string filePath)
{
// use string extensions
return filePath.ToSafeFileName();
}
public static void EnsurePathExists(string path)
public void EnsurePathExists(string path)
{
var absolutePath = MapPath(path);
if (Directory.Exists(absolutePath) == false)
Directory.CreateDirectory(absolutePath);
}
/// <summary>
/// Checks if a given path is a full path including drive letter
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
// From: http://stackoverflow.com/a/35046453/5018
internal static bool IsFullPath(this string path)
{
return string.IsNullOrWhiteSpace(path) == false
&& path.IndexOfAny(Path.GetInvalidPathChars().ToArray()) == -1
&& Path.IsPathRooted(path)
&& Path.GetPathRoot(path).Equals(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal) == false;
}
/// <summary>
/// Get properly formatted relative path from an existing absolute or relative path
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
internal static string GetRelativePath(this string path)
public string GetRelativePath(string path)
{
if (path.IsFullPath())
{
@@ -316,20 +302,5 @@ namespace Umbraco.Core.IO
return path.EnsurePathIsApplicationRootPrefixed();
}
/// <summary>
/// Ensures that a path has `~/` as prefix
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
internal static string EnsurePathIsApplicationRootPrefixed(this string path)
{
if (path.StartsWith("~/"))
return path;
if (path.StartsWith("/") == false && path.StartsWith("\\") == false)
path = string.Format("/{0}", path);
if (path.StartsWith("~") == false)
path = string.Format("~{0}", path);
return path;
}
}
}
+2 -2
View File
@@ -68,7 +68,7 @@ namespace Umbraco.Core.IO
{
filename = Path.GetFileName(filename);
if (filename == null) throw new ArgumentException("Cannot become a safe filename.", nameof(filename));
filename = IOHelper.SafeFileName(filename.ToLowerInvariant());
filename = Current.IOHelper.SafeFileName(filename.ToLowerInvariant());
return _mediaPathScheme.GetFilePath(this, cuid, puid, filename);
}
@@ -78,7 +78,7 @@ namespace Umbraco.Core.IO
{
filename = Path.GetFileName(filename);
if (filename == null) throw new ArgumentException("Cannot become a safe filename.", nameof(filename));
filename = IOHelper.SafeFileName(filename.ToLowerInvariant());
filename = Current.IOHelper.SafeFileName(filename.ToLowerInvariant());
return _mediaPathScheme.GetFilePath(this, cuid, puid, filename, prevpath);
}
+7 -7
View File
@@ -32,9 +32,9 @@ namespace Umbraco.Core.IO
if (virtualRoot.StartsWith("~/") == false)
throw new ArgumentException("The virtualRoot argument must be a virtual path and start with '~/'");
_rootPath = EnsureDirectorySeparatorChar(IOHelper.MapPath(virtualRoot)).TrimEnd(Path.DirectorySeparatorChar);
_rootPath = EnsureDirectorySeparatorChar(Current.IOHelper.MapPath(virtualRoot)).TrimEnd(Path.DirectorySeparatorChar);
_rootPathFwd = EnsureUrlSeparatorChar(_rootPath);
_rootUrl = EnsureUrlSeparatorChar(IOHelper.ResolveUrl(virtualRoot)).TrimEnd('/');
_rootUrl = EnsureUrlSeparatorChar(Current.IOHelper.ResolveUrl(virtualRoot)).TrimEnd('/');
}
public PhysicalFileSystem(string rootPath, string rootUrl)
@@ -47,7 +47,7 @@ namespace Umbraco.Core.IO
if (Path.IsPathRooted(rootPath) == false)
{
// but the test suite App.config cannot really "root" anything so we have to do it here
var localRoot = IOHelper.GetRootDirectorySafe();
var localRoot = Current.IOHelper.GetRootDirectorySafe();
rootPath = Path.Combine(localRoot, rootPath);
}
@@ -257,12 +257,12 @@ namespace Umbraco.Core.IO
// if it starts with the root url, strip it and trim the starting slash to make it relative
// eg "/Media/1234/img.jpg" => "1234/img.jpg"
if (IOHelper.PathStartsWith(path, _rootUrl, '/'))
if (Current.IOHelper.PathStartsWith(path, _rootUrl, '/'))
return path.Substring(_rootUrl.Length).TrimStart('/');
// if it starts with the root path, strip it and trim the starting slash to make it relative
// eg "c:/websites/test/root/Media/1234/img.jpg" => "1234/img.jpg"
if (IOHelper.PathStartsWith(path, _rootPathFwd, '/'))
if (Current.IOHelper.PathStartsWith(path, _rootPathFwd, '/'))
return path.Substring(_rootPathFwd.Length).TrimStart('/');
// unchanged - what else?
@@ -292,7 +292,7 @@ namespace Umbraco.Core.IO
path = GetRelativePath(path);
// if not already rooted, combine with the root path
if (IOHelper.PathStartsWith(path, _rootPath, Path.DirectorySeparatorChar) == false)
if (Current.IOHelper.PathStartsWith(path, _rootPath, Path.DirectorySeparatorChar) == false)
path = Path.Combine(_rootPath, path);
// sanitize - GetFullPath will take care of any relative
@@ -303,7 +303,7 @@ namespace Umbraco.Core.IO
// at that point, path is within legal parts of the filesystem, ie we have
// permissions to reach that path, but it may nevertheless be outside of
// our root path, due to relative segments, so better check
if (IOHelper.PathStartsWith(path, _rootPath, Path.DirectorySeparatorChar))
if (Current.IOHelper.PathStartsWith(path, _rootPath, Path.DirectorySeparatorChar))
{
// this says that 4.7.2 supports long paths - but Windows does not
// https://docs.microsoft.com/en-us/dotnet/api/system.io.pathtoolongexception?view=netframework-4.7.2
+4 -3
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Umbraco.Core.Composing;
namespace Umbraco.Core.IO
{
@@ -37,7 +38,7 @@ namespace Umbraco.Core.IO
var id = GuidUtils.ToBase32String(Guid.NewGuid(), idLength);
var virt = ShadowFsPath + "/" + id;
var shadowDir = IOHelper.MapPath(virt);
var shadowDir = Current.IOHelper.MapPath(virt);
if (Directory.Exists(shadowDir))
continue;
@@ -55,7 +56,7 @@ namespace Umbraco.Core.IO
// in a single thread anyways
var virt = ShadowFsPath + "/" + id + "/" + _shadowPath;
_shadowDir = IOHelper.MapPath(virt);
_shadowDir = Current.IOHelper.MapPath(virt);
Directory.CreateDirectory(_shadowDir);
var tempfs = new PhysicalFileSystem(virt);
_shadowFileSystem = new ShadowFileSystem(_innerFileSystem, tempfs);
@@ -82,7 +83,7 @@ namespace Umbraco.Core.IO
// shadowPath make be path/to/dir, remove each
dir = dir.Replace("/", "\\");
var min = IOHelper.MapPath(ShadowFsPath).Length;
var min = Current.IOHelper.MapPath(ShadowFsPath).Length;
var pos = dir.LastIndexOf("\\", StringComparison.OrdinalIgnoreCase);
while (pos > min)
{
+5 -4
View File
@@ -1,4 +1,5 @@
using System.Web;
using Umbraco.Core.Composing;
namespace Umbraco.Core.IO
{
@@ -29,13 +30,13 @@ namespace Umbraco.Core.IO
public static string MacroPartials => MvcViews + "/MacroPartials/";
public static string Media => IOHelper.ReturnPath("umbracoMediaPath", "~/media");
public static string Media => Current.IOHelper.ReturnPath("umbracoMediaPath", "~/media");
public static string Scripts => IOHelper.ReturnPath("umbracoScriptsPath", "~/scripts");
public static string Scripts => Current.IOHelper.ReturnPath("umbracoScriptsPath", "~/scripts");
public static string Css => IOHelper.ReturnPath("umbracoCssPath", "~/css");
public static string Css => Current.IOHelper.ReturnPath("umbracoCssPath", "~/css");
public static string Umbraco => IOHelper.ReturnPath("umbracoPath", "~/umbraco");
public static string Umbraco => Current.IOHelper.ReturnPath("umbracoPath", "~/umbraco");
public static string Packages => Data + "/packages";
@@ -5,6 +5,7 @@ using System.Xml;
using Newtonsoft.Json;
using Serilog;
using Serilog.Events;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
@@ -18,7 +19,7 @@ namespace Umbraco.Core.Logging.Viewer
{
if (string.IsNullOrEmpty(pathToSearches))
// ReSharper disable once StringLiteralTypo
pathToSearches = IOHelper.MapPath("~/Config/logviewer.searches.config.js");
pathToSearches = Current.IOHelper.MapPath("~/Config/logviewer.searches.config.js");
_searchesConfigPath = pathToSearches;
}
@@ -93,7 +94,7 @@ namespace Umbraco.Core.Logging.Viewer
}
/// <summary>
/// Get the Serilog minimum-level value from the config file.
/// Get the Serilog minimum-level value from the config file.
/// </summary>
/// <returns></returns>
public string GetLogLevel()
@@ -181,7 +182,7 @@ namespace Umbraco.Core.Logging.Viewer
private static void EnsureFileExists(string path, string contents)
{
var absolutePath = IOHelper.MapPath(path);
var absolutePath = Current.IOHelper.MapPath(path);
if (System.IO.File.Exists(absolutePath)) return;
using (var writer = System.IO.File.CreateText(absolutePath))
@@ -1,5 +1,6 @@
using System;
using System.Runtime.Serialization;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
namespace Umbraco.Core.Manifest
@@ -67,7 +68,7 @@ namespace Umbraco.Core.Manifest
public string View
{
get => _view;
set => _view = IOHelper.ResolveVirtualUrl(value);
set => _view = Current.IOHelper.ResolveVirtualUrl(value);
}
/// <summary>
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using Newtonsoft.Json;
using Umbraco.Core.Composing;
using Umbraco.Core.Dashboards;
using Umbraco.Core.IO;
@@ -21,7 +22,7 @@ namespace Umbraco.Core.Manifest
public string View
{
get => _view;
set => _view = IOHelper.ResolveVirtualUrl(value);
set => _view = Current.IOHelper.ResolveVirtualUrl(value);
}
[JsonProperty("sections")]
+4 -3
View File
@@ -6,6 +6,7 @@ using System.Text;
using Newtonsoft.Json;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration.Grid;
using Umbraco.Core.Composing;
using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -51,7 +52,7 @@ namespace Umbraco.Core.Manifest
public string Path
{
get => _path;
set => _path = value.StartsWith("~/") ? IOHelper.MapPath(value) : value;
set => _path = value.StartsWith("~/") ? Current.IOHelper.MapPath(value) : value;
}
/// <summary>
@@ -166,9 +167,9 @@ namespace Umbraco.Core.Manifest
// scripts and stylesheets are raw string, must process here
for (var i = 0; i < manifest.Scripts.Length; i++)
manifest.Scripts[i] = IOHelper.ResolveVirtualUrl(manifest.Scripts[i]);
manifest.Scripts[i] = Current.IOHelper.ResolveVirtualUrl(manifest.Scripts[i]);
for (var i = 0; i < manifest.Stylesheets.Length; i++)
manifest.Stylesheets[i] = IOHelper.ResolveVirtualUrl(manifest.Stylesheets[i]);
manifest.Stylesheets[i] = Current.IOHelper.ResolveVirtualUrl(manifest.Stylesheets[i]);
// add property editors that are also parameter editors, to the parameter editors list
// (the manifest format is kinda legacy)
@@ -4,6 +4,7 @@ using System.Data.SqlServerCe;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
@@ -131,7 +132,7 @@ namespace Umbraco.Core.Migrations.Install
{
SaveConnectionString(EmbeddedDatabaseConnectionString, Constants.DbProviderNames.SqlCe, logger);
var path = Path.Combine(IOHelper.GetRootDirectorySafe(), "App_Data", "Umbraco.sdf");
var path = Path.Combine(Current.IOHelper.GetRootDirectorySafe(), "App_Data", "Umbraco.sdf");
if (File.Exists(path) == false)
{
// this should probably be in a "using (new SqlCeEngine)" clause but not sure
@@ -282,7 +283,7 @@ namespace Umbraco.Core.Migrations.Install
if (string.IsNullOrWhiteSpace(providerName)) throw new ArgumentNullOrEmptyException(nameof(providerName));
var fileSource = "web.config";
var fileName = IOHelper.MapPath(SystemDirectories.Root +"/" + fileSource);
var fileName = Current.IOHelper.MapPath(SystemDirectories.Root +"/" + fileSource);
var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
if (xml.Root == null) throw new Exception($"Invalid {fileSource} file (no root).");
@@ -295,7 +296,7 @@ namespace Umbraco.Core.Migrations.Install
if (configSourceAttribute != null)
{
fileSource = configSourceAttribute.Value;
fileName = IOHelper.MapPath(SystemDirectories.Root + "/" + fileSource);
fileName = Current.IOHelper.MapPath(SystemDirectories.Root + "/" + fileSource);
if (!File.Exists(fileName))
throw new Exception($"Invalid configSource \"{fileSource}\" (no such file).");
+20
View File
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a paged result for a model collection
/// </summary>
/// <typeparam name="T"></typeparam>
[DataContract(Name = "pagedCollection", Namespace = "")]
public class PagedResult<T> : PagedResult
{
public PagedResult(long totalItems, long pageNumber, long pageSize)
: base(totalItems, pageNumber, pageSize)
{ }
[DataMember(Name = "items")]
public IEnumerable<T> Items { get; set; }
}
}
@@ -4,6 +4,7 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -28,7 +29,7 @@ namespace Umbraco.Core.Packaging
_logger = logger;
_packageExtraction = new PackageExtraction();
}
/// <summary>
/// Returns a list of all installed file paths
/// </summary>
@@ -59,15 +60,15 @@ namespace Umbraco.Core.Packaging
foreach (var item in package.Files.ToArray())
{
removedFiles.Add(item.GetRelativePath());
removedFiles.Add(Current.IOHelper.GetRelativePath(item));
//here we need to try to find the file in question as most packages does not support the tilde char
var file = IOHelper.FindFile(item);
var file = Current.IOHelper.FindFile(item);
if (file != null)
{
// TODO: Surely this should be ~/ ?
file = file.EnsureStartsWith("/");
var filePath = IOHelper.MapPath(file);
var filePath = Current.IOHelper.MapPath(file);
if (File.Exists(filePath))
File.Delete(filePath);
@@ -5,6 +5,7 @@ using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Xml.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -139,7 +140,7 @@ namespace Umbraco.Core.Packaging
var updatedXml = _parser.ToXml(definition);
packageXml.ReplaceWith(updatedXml);
}
packagesXml.Save(packagesFile);
return true;
@@ -154,7 +155,7 @@ namespace Umbraco.Core.Packaging
ValidatePackage(definition);
//Create a folder for building this package
var temporaryPath = IOHelper.MapPath(_tempFolderPath.EnsureEndsWith('/') + Guid.NewGuid());
var temporaryPath = Current.IOHelper.MapPath(_tempFolderPath.EnsureEndsWith('/') + Guid.NewGuid());
if (Directory.Exists(temporaryPath) == false)
Directory.CreateDirectory(temporaryPath);
@@ -212,12 +213,12 @@ namespace Umbraco.Core.Packaging
compiledPackageXml.Save(packageXmlFileName);
// check if there's a packages directory below media
if (Directory.Exists(IOHelper.MapPath(_mediaFolderPath)) == false)
Directory.CreateDirectory(IOHelper.MapPath(_mediaFolderPath));
if (Directory.Exists(Current.IOHelper.MapPath(_mediaFolderPath)) == false)
Directory.CreateDirectory(Current.IOHelper.MapPath(_mediaFolderPath));
var packPath = _mediaFolderPath.EnsureEndsWith('/') + (definition.Name + "_" + definition.Version).Replace(' ', '_') + ".zip";
ZipPackage(temporaryPath, IOHelper.MapPath(packPath));
ZipPackage(temporaryPath, Current.IOHelper.MapPath(packPath));
//we need to update the package path and save it
definition.PackagePath = packPath;
@@ -448,7 +449,7 @@ namespace Umbraco.Core.Packaging
if (!path.StartsWith("~/") && !path.StartsWith("/"))
path = "~/" + path;
var serverPath = IOHelper.MapPath(path);
var serverPath = Current.IOHelper.MapPath(path);
if (File.Exists(serverPath))
AppendFileXml(new FileInfo(serverPath), path, packageDirectory, filesXml);
@@ -562,7 +563,7 @@ namespace Umbraco.Core.Packaging
package.Add(new XElement("url", definition.Url));
var requirements = new XElement("requirements");
requirements.Add(new XElement("major", definition.UmbracoVersion == null ? UmbracoVersion.SemanticVersion.Major.ToInvariantString() : definition.UmbracoVersion.Major.ToInvariantString()));
requirements.Add(new XElement("minor", definition.UmbracoVersion == null ? UmbracoVersion.SemanticVersion.Minor.ToInvariantString() : definition.UmbracoVersion.Minor.ToInvariantString()));
requirements.Add(new XElement("patch", definition.UmbracoVersion == null ? UmbracoVersion.SemanticVersion.Patch.ToInvariantString() : definition.UmbracoVersion.Build.ToInvariantString()));
@@ -589,7 +590,7 @@ namespace Umbraco.Core.Packaging
contributors.Add(new XElement("contributor", contributor));
}
}
info.Add(contributors);
info.Add(new XElement("readme", new XCData(definition.Readme)));
@@ -607,11 +608,11 @@ namespace Umbraco.Core.Packaging
private XDocument EnsureStorage(out string packagesFile)
{
var packagesFolder = IOHelper.MapPath(_packagesFolderPath);
var packagesFolder = Current.IOHelper.MapPath(_packagesFolderPath);
//ensure it exists
Directory.CreateDirectory(packagesFolder);
packagesFile = IOHelper.MapPath(CreatedPackagesFile);
packagesFile = Current.IOHelper.MapPath(CreatedPackagesFile);
if (!File.Exists(packagesFile))
{
var xml = new XDocument(new XElement("packages"));
@@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Text;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
@@ -103,8 +104,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// validate path & extension
var validDir = SystemDirectories.MvcViews;
var isValidPath = IOHelper.VerifyEditPath(fullPath, validDir);
var isValidExtension = IOHelper.VerifyFileExtension(fullPath, ValidExtensions);
var isValidPath = Current.IOHelper.VerifyEditPath(fullPath, validDir);
var isValidExtension = Current.IOHelper.VerifyFileExtension(fullPath, ValidExtensions);
return isValidPath && isValidExtension;
}
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
@@ -101,9 +102,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// validate path & extension
var validDir = SystemDirectories.Scripts;
var isValidPath = IOHelper.VerifyEditPath(fullPath, validDir);
var isValidPath = Current.IOHelper.VerifyEditPath(fullPath, validDir);
var validExts = new[] {"js"};
var isValidExtension = IOHelper.VerifyFileExtension(script.Path, validExts);
var isValidExtension = Current.IOHelper.VerifyFileExtension(script.Path, validExts);
return isValidPath && isValidExtension;
}
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
@@ -114,8 +115,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// validate path and extension
var validDir = SystemDirectories.Css;
var isValidPath = IOHelper.VerifyEditPath(fullPath, validDir);
var isValidExtension = IOHelper.VerifyFileExtension(stylesheet.Path, ValidExtensions);
var isValidPath = Current.IOHelper.VerifyEditPath(fullPath, validDir);
var isValidExtension = Current.IOHelper.VerifyFileExtension(stylesheet.Path, ValidExtensions);
return isValidPath && isValidExtension;
}
@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -592,8 +593,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
validExts.Add("vbhtml");
// validate path and extension
var validFile = IOHelper.VerifyEditPath(path, validDirs);
var validExtension = IOHelper.VerifyFileExtension(path, validExts);
var validFile = Current.IOHelper.VerifyEditPath(path, validDirs);
var validExtension = Current.IOHelper.VerifyFileExtension(path, validExts);
return validFile && validExtension;
}
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
namespace Umbraco.Core.PropertyEditors
@@ -93,7 +94,7 @@ namespace Umbraco.Core.PropertyEditors
public string View
{
get => _view;
set => _view = IOHelper.ResolveVirtualUrl(value);
set => _view = Current.IOHelper.ResolveVirtualUrl(value);
}
/// <summary>
@@ -75,7 +75,7 @@ namespace Umbraco.Core.PropertyEditors
public string View
{
get => _view;
set => _view = IOHelper.ResolveVirtualUrl(value);
set => _view = Current.IOHelper.ResolveVirtualUrl(value);
}
/// <summary>
@@ -204,7 +204,7 @@ namespace Umbraco.Core.PropertyEditors
/// <returns></returns>
/// <remarks>
/// By default this will attempt to automatically convert the string value to the value type supplied by ValueType.
///
///
/// If overridden then the object returned must match the type supplied in the ValueType, otherwise persisting the
/// value to the DB will fail when it tries to validate the value type.
/// </remarks>
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration.Grid;
using Umbraco.Core.IO;
@@ -28,14 +29,14 @@ namespace Umbraco.Core.PropertyEditors
public string View
{
get => _view;
set => _view = IOHelper.ResolveVirtualUrl(value);
set => _view = Current.IOHelper.ResolveVirtualUrl(value);
}
[JsonProperty("render")]
public string Render
{
get => _render;
set => _render = IOHelper.ResolveVirtualUrl(value);
set => _render = Current.IOHelper.ResolveVirtualUrl(value);
}
[JsonProperty("icon", Required = Required.Always)]
@@ -9,11 +9,11 @@ namespace Umbraco.Core.Runtime
{
// ensure we have some essential directories
// every other component can then initialize safely
IOHelper.EnsurePathExists("~/App_Data");
IOHelper.EnsurePathExists(SystemDirectories.Media);
IOHelper.EnsurePathExists(SystemDirectories.MvcViews);
IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/Partials");
IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/MacroPartials");
Current.IOHelper.EnsurePathExists("~/App_Data");
Current.IOHelper.EnsurePathExists(SystemDirectories.Media);
Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews);
Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/Partials");
Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/MacroPartials");
}
public void Terminate()
+1 -1
View File
@@ -216,7 +216,7 @@ namespace Umbraco.Core.Runtime
{
var path = GetApplicationRootPath();
if (string.IsNullOrWhiteSpace(path) == false)
IOHelper.SetRootDirectory(path);
Current.IOHelper.SetRootDirectory(path);
}
private bool AcquireMainDom(MainDom mainDom)
@@ -3083,7 +3083,7 @@ namespace Umbraco.Core.Services.Implement
var version = GetVersion(versionId);
//Good ole null checks
if (content == null || version == null)
if (content == null || version == null || content.Trashed)
{
return new OperationResult(OperationResultType.FailedCannot, evtMsgs);
}
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Umbraco.Core.Composing;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -405,6 +406,21 @@ namespace Umbraco.Core.Services.Implement
/// <returns></returns>
public ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = Constants.Security.SuperUserId)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentException("Name cannot be empty or contain only white-space characters", nameof(name));
}
if (name.Length > 255)
{
throw new ArgumentOutOfRangeException(nameof(name), "Name cannot be more than 255 characters in length.");
}
// file might already be on disk, if so grab the content to avoid overwriting
var template = new Template(name, alias)
{
@@ -539,6 +555,17 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId"></param>
public void SaveTemplate(ITemplate template, int userId = Constants.Security.SuperUserId)
{
if (template == null)
{
throw new ArgumentNullException(nameof(template));
}
if (string.IsNullOrWhiteSpace(template.Name) || template.Name.Length > 255)
{
throw new InvalidOperationException("Name cannot be null, empty, contain only white-space characters or be more than 255 characters in length.");
}
using (var scope = ScopeProvider.CreateScope())
{
if (scope.Events.DispatchCancelable(SavingTemplate, this, new SaveEventArgs<ITemplate>(template)))
@@ -675,7 +702,7 @@ namespace Umbraco.Core.Services.Implement
public IEnumerable<string> GetPartialViewSnippetNames(params string[] filterNames)
{
var snippetPath = IOHelper.MapPath($"{SystemDirectories.Umbraco}/PartialViewMacros/Templates/");
var snippetPath = Current.IOHelper.MapPath($"{SystemDirectories.Umbraco}/PartialViewMacros/Templates/");
var files = Directory.GetFiles(snippetPath, "*.cshtml")
.Select(Path.GetFileNameWithoutExtension)
.Except(filterNames, StringComparer.InvariantCultureIgnoreCase)
@@ -909,7 +936,7 @@ namespace Umbraco.Core.Services.Implement
fileName += ".cshtml";
}
var snippetPath = IOHelper.MapPath($"{SystemDirectories.Umbraco}/PartialViewMacros/Templates/{fileName}");
var snippetPath = Current.IOHelper.MapPath($"{SystemDirectories.Umbraco}/PartialViewMacros/Templates/{fileName}");
return System.IO.File.Exists(snippetPath)
? Attempt<string>.Succeed(snippetPath)
: Attempt<string>.Fail();
@@ -816,8 +816,8 @@ namespace Umbraco.Core.Services.Implement
{
//trimming username and email to make sure we have no trailing space
member.Username = member.Username.Trim();
member.Email = member.Email.Trim();
member.Email = member.Email.Trim();
using (var scope = ScopeProvider.CreateScope())
{
var saveEventArgs = new SaveEventArgs<IMember>(member);
@@ -6,6 +6,7 @@ using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
@@ -383,7 +384,7 @@ namespace Umbraco.Core.Services.Implement
var protocol = _globalSettings.UseHttps ? "https" : "http";
var subjectVars = new NotificationEmailSubjectParams(
string.Concat(siteUri.Authority, IOHelper.ResolveUrl(SystemDirectories.Umbraco)),
string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)),
actionName,
content.Name);
@@ -399,7 +400,7 @@ namespace Umbraco.Core.Services.Implement
string.Concat(content.Id, ".aspx"),
protocol),
performingUser.Name,
string.Concat(siteUri.Authority, IOHelper.ResolveUrl(SystemDirectories.Umbraco)),
string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)),
summary.ToString());
// create the mail message
@@ -5,6 +5,7 @@ using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Semver;
using Umbraco.Core.Composing;
using Umbraco.Core.Events;
using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
@@ -63,7 +64,7 @@ namespace Umbraco.Core.Services.Implement
//successful
if (bytes.Length > 0)
{
var packagePath = IOHelper.MapPath(SystemDirectories.Packages);
var packagePath = Current.IOHelper.MapPath(SystemDirectories.Packages);
// Check for package directory
if (Directory.Exists(packagePath) == false)
+31 -1
View File
@@ -112,7 +112,7 @@ namespace Umbraco.Core
if (isValid)
{
var resolvedUrlResult = IOHelper.TryResolveUrl(input);
var resolvedUrlResult = Current.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.
@@ -1475,5 +1475,35 @@ namespace Umbraco.Core
// /// </summary>
// public static string NullOrWhiteSpaceAsNull(this string text)
// => string.IsNullOrWhiteSpace(text) ? null : text;
/// <summary>
/// Checks if a given path is a full path including drive letter
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
// From: http://stackoverflow.com/a/35046453/5018
internal static bool IsFullPath(this string path)
{
return string.IsNullOrWhiteSpace(path) == false
&& path.IndexOfAny(Path.GetInvalidPathChars().ToArray()) == -1
&& Path.IsPathRooted(path)
&& Path.GetPathRoot(path).Equals(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal) == false;
}
/// <summary>
/// Ensures that a path has `~/` as prefix
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
internal static string EnsurePathIsApplicationRootPrefixed(this string path)
{
if (path.StartsWith("~/"))
return path;
if (path.StartsWith("/") == false && path.StartsWith("\\") == false)
path = string.Format("/{0}", path);
if (path.StartsWith("~") == false)
path = string.Format("~{0}", path);
return path;
}
}
}
@@ -1,5 +1,6 @@
using System;
using System.Web;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
@@ -97,7 +98,7 @@ namespace Umbraco.Core.Sync
: "";
var ssl = globalSettings.UseHttps ? "s" : ""; // force, whatever the first request
var url = "http" + ssl + "://" + request.ServerVariables["SERVER_NAME"] + port + IOHelper.ResolveUrl(SystemDirectories.Umbraco);
var url = "http" + ssl + "://" + request.ServerVariables["SERVER_NAME"] + port + Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco);
return url.TrimEnd('/');
}
+4
View File
@@ -178,6 +178,7 @@
<Compile Include="Composing\TargetedServiceFactory.cs" />
<Compile Include="Composing\TypeFinder.cs" />
<Compile Include="Composing\TypeLoader.cs" />
<Compile Include="IO\IIOHelper.cs" />
<Compile Include="IO\IMediaFileSystem.cs" />
<Compile Include="IO\IMediaPathScheme.cs" />
<Compile Include="IO\IOHelper.cs" />
@@ -536,6 +537,9 @@
<Compile Include="Models\MemberTypePropertyProfileAccess.cs" />
<Compile Include="Models\Packaging\InstallationSummary.cs" />
<Compile Include="Models\Packaging\PreInstallWarnings.cs" />
<Compile Include="Models\PagedResultOfT.cs" />
<Compile Include="Models\Property.cs" />
<Compile Include="Models\PropertyCollection.cs" />
<Compile Include="Models\PropertyGroup.cs" />
<Compile Include="Models\PropertyGroupCollection.cs" />
<Compile Include="Models\PropertyTypeCollection.cs" />
+1 -1
View File
@@ -115,7 +115,7 @@ namespace Umbraco.Core
.TrimStart("/");
//check if this is in the umbraco back office
return afterAuthority.InvariantStartsWith(IOHelper.ResolveUrl("~/install").TrimStart("/"));
return afterAuthority.InvariantStartsWith(Current.IOHelper.ResolveUrl("~/install").TrimStart("/"));
}
/// <summary>
+4 -3
View File
@@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using Umbraco.Core.Composing;
using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
@@ -210,14 +211,14 @@ namespace Umbraco.Core.Xml
/// <returns>Returns a XmlDocument class</returns>
public static XmlDocument OpenAsXmlDocument(string filePath)
{
using (var reader = new XmlTextReader(IOHelper.MapPath(filePath)) {WhitespaceHandling = WhitespaceHandling.All})
using (var reader = new XmlTextReader(Current.IOHelper.MapPath(filePath)) {WhitespaceHandling = WhitespaceHandling.All})
{
var xmlDoc = new XmlDocument();
//Load the file into the XmlDocument
xmlDoc.Load(reader);
return xmlDoc;
}
}
}
/// <summary>
+2 -2
View File
@@ -28,8 +28,8 @@ namespace Umbraco.Examine
/// <returns></returns>
public virtual Lucene.Net.Store.Directory CreateFileSystemLuceneDirectory(string folderName)
{
var dirInfo = new DirectoryInfo(Path.Combine(IOHelper.MapPath(SystemDirectories.TempData), "ExamineIndexes", folderName));
var dirInfo = new DirectoryInfo(Path.Combine(Current.IOHelper.MapPath(SystemDirectories.TempData), "ExamineIndexes", folderName));
if (!dirInfo.Exists)
System.IO.Directory.CreateDirectory(dirInfo.FullName);
@@ -5,6 +5,7 @@ using Umbraco.Core.Logging;
using Lucene.Net.Store;
using Umbraco.Core.IO;
using System.Linq;
using Umbraco.Core.Composing;
namespace Umbraco.Examine
{
@@ -66,18 +67,18 @@ namespace Umbraco.Examine
{
[nameof(UmbracoExamineIndex.CommitCount)] = Index.CommitCount,
[nameof(UmbracoExamineIndex.DefaultAnalyzer)] = Index.DefaultAnalyzer.GetType().Name,
["LuceneDirectory"] = luceneDir.GetType().Name
["LuceneDirectory"] = luceneDir.GetType().Name
};
if (luceneDir is FSDirectory fsDir)
{
d[nameof(UmbracoExamineIndex.LuceneIndexFolder)] = fsDir.Directory.ToString().ToLowerInvariant().TrimStart(IOHelper.MapPath(SystemDirectories.Root).ToLowerInvariant()).Replace("\\", "/").EnsureStartsWith('/');
d[nameof(UmbracoExamineIndex.LuceneIndexFolder)] = fsDir.Directory.ToString().ToLowerInvariant().TrimStart(Current.IOHelper.MapPath(SystemDirectories.Root).ToLowerInvariant()).Replace("\\", "/").EnsureStartsWith('/');
}
return d;
}
}
}
}
@@ -3,6 +3,7 @@ using System.Configuration;
using System.IO;
using System.Web.Configuration;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
namespace Umbraco.ModelsBuilder.Embedded.Configuration
@@ -28,7 +29,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Configuration
// ensure defaults are initialized for tests
ModelsNamespace = DefaultModelsNamespace;
ModelsDirectory = IOHelper.MapPath(DefaultModelsDirectory);
ModelsDirectory = Current.IOHelper.MapPath(DefaultModelsDirectory);
DebugLevel = 0;
// stop here, everything is false
@@ -74,7 +75,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Configuration
value = ConfigurationManager.AppSettings[prefix + "ModelsDirectory"];
if (!string.IsNullOrWhiteSpace(value))
{
var root = IOHelper.MapPath("~/");
var root = Current.IOHelper.MapPath("~/");
if (root == null)
throw new ConfigurationErrorsException("Could not determine root directory.");
@@ -363,7 +363,7 @@ namespace Umbraco.Tests.Components
[Test]
public void AllComposers()
{
var typeLoader = new TypeLoader(AppCaches.Disabled.RuntimeCache, IOHelper.MapPath("~/App_Data/TEMP"), Mock.Of<IProfilingLogger>());
var typeLoader = new TypeLoader(AppCaches.Disabled.RuntimeCache, Current.IOHelper.MapPath("~/App_Data/TEMP"), Mock.Of<IProfilingLogger>());
var register = MockRegister();
var composition = new Composition(register, typeLoader, Mock.Of<IProfilingLogger>(), MockRuntimeState(RuntimeLevel.Run), Configs);
@@ -22,7 +22,7 @@ namespace Umbraco.Tests.Composing
{
ProfilingLogger = new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>());
TypeLoader = new TypeLoader(NoAppCache.Instance, IOHelper.MapPath("~/App_Data/TEMP"), ProfilingLogger, detectChanges: false)
TypeLoader = new TypeLoader(NoAppCache.Instance, Current.IOHelper.MapPath("~/App_Data/TEMP"), ProfilingLogger, detectChanges: false)
{
AssembliesToScan = AssembliesToScan
};
@@ -37,7 +37,7 @@ namespace Umbraco.Tests.Composing
.Returns(() => factoryFactory?.Invoke(mockedFactory));
var logger = new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>());
var typeLoader = new TypeLoader(Mock.Of<IAppPolicyCache>(), IOHelper.MapPath("~/App_Data/TEMP"), logger);
var typeLoader = new TypeLoader(Mock.Of<IAppPolicyCache>(), Current.IOHelper.MapPath("~/App_Data/TEMP"), logger);
var composition = new Composition(mockedRegister, typeLoader, logger, Mock.Of<IRuntimeState>(), new ConfigsFactory().Create());
// create the factory, ensure it is the mocked factory
@@ -207,7 +207,7 @@ namespace Umbraco.Tests.Composing
//here we are trying to get the App_Code assembly
var fileExtensions = new[] { ".cs", ".vb" }; //only vb and cs files are supported
var appCodeFolder = new DirectoryInfo(IOHelper.MapPath(IOHelper.ResolveUrl("~/App_code")));
var appCodeFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.IOHelper.ResolveUrl("~/App_code")));
//check if the folder exists and if there are any files in it with the supported file extensions
if (appCodeFolder.Exists && (fileExtensions.Any(x => appCodeFolder.GetFiles("*" + x).Any())))
{
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Composing
public void Initialize()
{
// this ensures it's reset
_typeLoader = new TypeLoader(NoAppCache.Instance, IOHelper.MapPath("~/App_Data/TEMP"), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>()), false);
_typeLoader = new TypeLoader(NoAppCache.Instance, Current.IOHelper.MapPath("~/App_Data/TEMP"), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>()), false);
// for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
// TODO: Should probably update this so it only searches this assembly and add custom types to be found
@@ -49,15 +49,15 @@ namespace Umbraco.Tests.Configurations
var globalSettings = SettingsForTests.GenerateMockGlobalSettings();
var globalSettingsMock = Mock.Get(globalSettings);
globalSettingsMock.Setup(x => x.Path).Returns(() => IOHelper.ResolveUrl(path));
globalSettingsMock.Setup(x => x.Path).Returns(() => Current.IOHelper.ResolveUrl(path));
SystemDirectories.Root = rootPath;
Assert.AreEqual(outcome, globalSettings.GetUmbracoMvcAreaNoCache());
}
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.CoreThings
var container = new Mock<IFactory>();
var globalSettings = SettingsForTests.GenerateMockGlobalSettings();
container.Setup(x => x.GetInstance(typeof(TypeLoader))).Returns(
new TypeLoader(NoAppCache.Instance, IOHelper.MapPath("~/App_Data/TEMP"), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())));
new TypeLoader(NoAppCache.Instance, Current.IOHelper.MapPath("~/App_Data/TEMP"), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())));
Current.Factory = container.Object;
CurrentCore.Factory = container.Object;
+1 -1
View File
@@ -107,7 +107,7 @@ namespace Umbraco.Tests.IO
fs.AddFile(virtPath, ms);
// ~/media/1234/file.txt exists
var physPath = IOHelper.MapPath(Path.Combine("media", virtPath));
var physPath = Current.IOHelper.MapPath(Path.Combine("media", virtPath));
Assert.IsTrue(File.Exists(physPath));
// ~/media/1234/file.txt is gone
+15 -13
View File
@@ -1,6 +1,8 @@
using System;
using NUnit.Framework;
using Umbraco.Core.IO;
using Umbraco.Core;
using Umbraco.Core.Composing;
namespace Umbraco.Tests.IO
{
@@ -14,11 +16,11 @@ namespace Umbraco.Tests.IO
{
if (expectedExceptionType != null)
{
Assert.Throws(expectedExceptionType, () => IOHelper.ResolveUrl(input));
Assert.Throws(expectedExceptionType, () => Current.IOHelper.ResolveUrl(input));
}
else
{
var result = IOHelper.ResolveUrl(input);
var result = Current.IOHelper.ResolveUrl(input);
Assert.AreEqual(expected, result);
}
}
@@ -31,17 +33,17 @@ namespace Umbraco.Tests.IO
{
//System.Diagnostics.Debugger.Break();
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Bin, true), IOHelper.MapPath(SystemDirectories.Bin, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Config, true), IOHelper.MapPath(SystemDirectories.Config, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Css, true), IOHelper.MapPath(SystemDirectories.Css, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Data, true), IOHelper.MapPath(SystemDirectories.Data, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Install, true), IOHelper.MapPath(SystemDirectories.Install, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Media, true), IOHelper.MapPath(SystemDirectories.Media, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Packages, true), IOHelper.MapPath(SystemDirectories.Packages, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Preview, true), IOHelper.MapPath(SystemDirectories.Preview, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Root, true), IOHelper.MapPath(SystemDirectories.Root, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Scripts, true), IOHelper.MapPath(SystemDirectories.Scripts, false));
Assert.AreEqual(IOHelper.MapPath(SystemDirectories.Umbraco, true), IOHelper.MapPath(SystemDirectories.Umbraco, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Bin, true), Current.IOHelper.MapPath(SystemDirectories.Bin, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Config, true), Current.IOHelper.MapPath(SystemDirectories.Config, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Css, true), Current.IOHelper.MapPath(SystemDirectories.Css, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Data, true), Current.IOHelper.MapPath(SystemDirectories.Data, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Install, true), Current.IOHelper.MapPath(SystemDirectories.Install, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Media, true), Current.IOHelper.MapPath(SystemDirectories.Media, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Packages, true), Current.IOHelper.MapPath(SystemDirectories.Packages, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Preview, true), Current.IOHelper.MapPath(SystemDirectories.Preview, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Root, true), Current.IOHelper.MapPath(SystemDirectories.Root, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Scripts, true), Current.IOHelper.MapPath(SystemDirectories.Scripts, false));
Assert.AreEqual(Current.IOHelper.MapPath(SystemDirectories.Umbraco, true), Current.IOHelper.MapPath(SystemDirectories.Umbraco, false));
}
[Test]
+27 -27
View File
@@ -40,8 +40,8 @@ namespace Umbraco.Tests.IO
private static void ClearFiles()
{
TestHelper.DeleteDirectory(IOHelper.MapPath("FileSysTests"));
TestHelper.DeleteDirectory(IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"));
TestHelper.DeleteDirectory(Current.IOHelper.MapPath("FileSysTests"));
TestHelper.DeleteDirectory(Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"));
}
private static string NormPath(string path)
@@ -52,7 +52,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowDeleteDirectory()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -86,7 +86,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowDeleteDirectoryInDir()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -135,7 +135,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowDeleteFile()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -174,7 +174,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowDeleteFileInDir()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -229,7 +229,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowCantCreateFile()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -248,7 +248,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowCreateFile()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -287,7 +287,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowCreateFileInDir()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -327,7 +327,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowAbort()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -349,7 +349,7 @@ namespace Umbraco.Tests.IO
[Test]
public void ShadowComplete()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -387,8 +387,8 @@ namespace Umbraco.Tests.IO
{
var logger = Mock.Of<ILogger>();
var path = IOHelper.MapPath("FileSysTests");
var shadowfs = IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
var path = Current.IOHelper.MapPath("FileSysTests");
var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
Directory.CreateDirectory(path);
Directory.CreateDirectory(shadowfs);
@@ -482,8 +482,8 @@ namespace Umbraco.Tests.IO
{
var logger = Mock.Of<ILogger>();
var path = IOHelper.MapPath("FileSysTests");
var shadowfs = IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
var path = Current.IOHelper.MapPath("FileSysTests");
var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
Directory.CreateDirectory(path);
var scopedFileSystems = false;
@@ -535,8 +535,8 @@ namespace Umbraco.Tests.IO
{
var logger = Mock.Of<ILogger>();
var path = IOHelper.MapPath("FileSysTests");
var shadowfs = IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
var path = Current.IOHelper.MapPath("FileSysTests");
var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs");
Directory.CreateDirectory(path);
var scopedFileSystems = false;
@@ -603,7 +603,7 @@ namespace Umbraco.Tests.IO
[Test]
public void GetFilesReturnsChildrenOnly()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
File.WriteAllText(path + "/f1.txt", "foo");
Directory.CreateDirectory(path + "/test");
@@ -625,7 +625,7 @@ namespace Umbraco.Tests.IO
[Test]
public void DeleteDirectoryAndFiles()
{
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
File.WriteAllText(path + "/f1.txt", "foo");
Directory.CreateDirectory(path + "/test");
@@ -646,7 +646,7 @@ namespace Umbraco.Tests.IO
public void ShadowGetFiles()
{
// Arrange
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -678,7 +678,7 @@ namespace Umbraco.Tests.IO
public void ShadowGetFilesUsingEmptyFilter()
{
// Arrange
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -713,7 +713,7 @@ namespace Umbraco.Tests.IO
public void ShadowGetFilesUsingNullFilter()
{
// Arrange
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -745,7 +745,7 @@ namespace Umbraco.Tests.IO
public void ShadowGetFilesUsingWildcardFilter()
{
// Arrange
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -780,7 +780,7 @@ namespace Umbraco.Tests.IO
public void ShadowGetFilesUsingSingleCharacterFilter()
{
// Arrange
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -827,7 +827,7 @@ namespace Umbraco.Tests.IO
public void ShadowGetFullPath()
{
// Arrange
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -861,7 +861,7 @@ namespace Umbraco.Tests.IO
public void ShadowGetRelativePath()
{
// Arrange
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -900,7 +900,7 @@ namespace Umbraco.Tests.IO
public void ShadowGetUrl()
{
// Arrange
var path = IOHelper.MapPath("FileSysTests");
var path = Current.IOHelper.MapPath("FileSysTests");
Directory.CreateDirectory(path);
Directory.CreateDirectory(path + "/ShadowTests");
Directory.CreateDirectory(path + "/ShadowSystem");
@@ -108,7 +108,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_previewXml = _xmlStore.GetPreviewXml(contentId, includeSubs);
// make sure the preview folder exists
var dir = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Preview));
var dir = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Preview));
if (dir.Exists == false)
dir.Create();
@@ -122,7 +122,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
// get the full path to the preview set
private static string GetPreviewSetPath(int userId, Guid previewSet)
{
return IOHelper.MapPath(Path.Combine(SystemDirectories.Preview, userId + "_" + previewSet + ".config"));
return Current.IOHelper.MapPath(Path.Combine(SystemDirectories.Preview, userId + "_" + previewSet + ".config"));
}
// deletes files for the user, and files accessed more than one hour ago
@@ -86,7 +86,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_memberRepository = memberRepository;
_globalSettings = globalSettings;
_entitySerializer = entitySerializer;
_xmlFileName = IOHelper.MapPath(SystemFiles.GetContentCacheXml(_globalSettings));
_xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(_globalSettings));
if (testing)
{
@@ -110,7 +110,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_mediaRepository = mediaRepository;
_memberRepository = memberRepository;
_xmlFileEnabled = false;
_xmlFileName = IOHelper.MapPath(SystemFiles.GetContentCacheXml(Current.Configs.Global()));
_xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(Current.Configs.Global()));
// do not plug events, we may not have what it takes to handle them
}
@@ -124,7 +124,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_memberRepository = memberRepository;
GetXmlDocument = getXmlDocument ?? throw new ArgumentNullException(nameof(getXmlDocument));
_xmlFileEnabled = false;
_xmlFileName = IOHelper.MapPath(SystemFiles.GetContentCacheXml(Current.Configs.Global()));
_xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(Current.Configs.Global()));
// do not plug events, we may not have what it takes to handle them
}
+3 -2
View File
@@ -4,6 +4,7 @@ using System;
using System.IO;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging.Viewer;
@@ -42,8 +43,8 @@ namespace Umbraco.Tests.Logging
_newSearchfilePath = Path.Combine(_newSearchfileDirPath, _searchfileName);
//Create/ensure Directory exists
IOHelper.EnsurePathExists(_newLogfileDirPath);
IOHelper.EnsurePathExists(_newSearchfileDirPath);
Current.IOHelper.EnsurePathExists(_newLogfileDirPath);
Current.IOHelper.EnsurePathExists(_newSearchfileDirPath);
//Copy the sample files
File.Copy(exampleLogfilePath, _newLogfilePath, true);
@@ -34,7 +34,7 @@ namespace Umbraco.Tests.Packaging
base.TearDown();
//clear out files/folders
Directory.Delete(IOHelper.MapPath("~/" + _testBaseFolder), true);
Directory.Delete(Current.IOHelper.MapPath("~/" + _testBaseFolder), true);
}
public ICreatedPackagesRepository PackageBuilder => new PackagesRepository(
@@ -146,8 +146,8 @@ namespace Umbraco.Tests.Packaging
{
var file1 = $"~/{_testBaseFolder}/App_Plugins/MyPlugin/package.manifest";
var file2 = $"~/{_testBaseFolder}/App_Plugins/MyPlugin/styles.css";
var mappedFile1 = IOHelper.MapPath(file1);
var mappedFile2 = IOHelper.MapPath(file2);
var mappedFile1 = Current.IOHelper.MapPath(file1);
var mappedFile2 = Current.IOHelper.MapPath(file2);
Directory.CreateDirectory(Path.GetDirectoryName(mappedFile1));
Directory.CreateDirectory(Path.GetDirectoryName(mappedFile2));
File.WriteAllText(mappedFile1, "hello world");
@@ -171,7 +171,7 @@ namespace Umbraco.Tests.Packaging
def = PackageBuilder.GetById(def.Id); //re-get
Assert.IsNotNull(def.PackagePath);
using (var archive = ZipFile.OpenRead(IOHelper.MapPath(zip)))
using (var archive = ZipFile.OpenRead(Current.IOHelper.MapPath(zip)))
{
Assert.AreEqual(3, archive.Entries.Count);
@@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using NUnit.Framework;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Packaging;
@@ -15,7 +16,7 @@ namespace Umbraco.Tests.Packaging
private static FileInfo GetTestPackagePath(string packageName)
{
const string testPackagesDirName = "Packaging\\Packages";
string path = Path.Combine(IOHelper.GetRootDirectorySafe(), testPackagesDirName, packageName);
string path = Path.Combine(Current.IOHelper.GetRootDirectorySafe(), testPackagesDirName, packageName);
return new FileInfo(path);
}
@@ -35,7 +35,7 @@ namespace Umbraco.Tests.Packaging
base.TearDown();
//clear out files/folders
var path = IOHelper.MapPath("~/" + _testBaseFolder);
var path = Current.IOHelper.MapPath("~/" + _testBaseFolder);
if (Directory.Exists(path))
Directory.Delete(path, true);
}
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.Packaging
PackageDataInstallation,
new PackageFileInstallation(Parser, ProfilingLogger),
Parser, Mock.Of<IPackageActionRunner>(),
applicationRootFolder: new DirectoryInfo(IOHelper.MapPath("~/" + _testBaseFolder))); //we don't want to extract package files to the real root, so extract to a test folder
applicationRootFolder: new DirectoryInfo(Current.IOHelper.MapPath("~/" + _testBaseFolder))); //we don't want to extract package files to the real root, so extract to a test folder
private const string DocumentTypePickerPackage = "Document_Type_Picker_1.1.umb";
private const string HelloPackage = "Hello_1.0.0.zip";
@@ -63,7 +63,7 @@ namespace Umbraco.Tests.Packaging
{
var package = PackageInstallation.ReadPackage(
//this is where our test zip file is
new FileInfo(Path.Combine(IOHelper.MapPath("~/Packaging/packages"), DocumentTypePickerPackage)));
new FileInfo(Path.Combine(Current.IOHelper.MapPath("~/Packaging/packages"), DocumentTypePickerPackage)));
Assert.IsNotNull(package);
Assert.AreEqual(1, package.Files.Count);
Assert.AreEqual("095e064b-ba4d-442d-9006-3050983c13d8.dll", package.Files[0].UniqueFileName);
@@ -86,7 +86,7 @@ namespace Umbraco.Tests.Packaging
{
var package = PackageInstallation.ReadPackage(
//this is where our test zip file is
new FileInfo(Path.Combine(IOHelper.MapPath("~/Packaging/packages"), HelloPackage)));
new FileInfo(Path.Combine(Current.IOHelper.MapPath("~/Packaging/packages"), HelloPackage)));
Assert.IsNotNull(package);
Assert.AreEqual(0, package.Files.Count);
Assert.AreEqual("Hello", package.Name);
@@ -111,7 +111,7 @@ namespace Umbraco.Tests.Packaging
public void Can_Read_Compiled_Package_Warnings()
{
//copy a file to the same path that the package will install so we can detect file conflicts
var path = IOHelper.MapPath("~/" + _testBaseFolder);
var path = Current.IOHelper.MapPath("~/" + _testBaseFolder);
Console.WriteLine(path);
var filePath = Path.Combine(path, "bin", "Auros.DocumentTypePicker.dll");
@@ -119,7 +119,7 @@ namespace Umbraco.Tests.Packaging
File.WriteAllText(filePath, "test");
//this is where our test zip file is
var packageFile = Path.Combine(IOHelper.MapPath("~/Packaging/packages"), DocumentTypePickerPackage);
var packageFile = Path.Combine(Current.IOHelper.MapPath("~/Packaging/packages"), DocumentTypePickerPackage);
Console.WriteLine(packageFile);
var package = PackageInstallation.ReadPackage(new FileInfo(packageFile));
@@ -137,7 +137,7 @@ namespace Umbraco.Tests.Packaging
{
var package = PackageInstallation.ReadPackage(
//this is where our test zip file is
new FileInfo(Path.Combine(IOHelper.MapPath("~/Packaging/packages"), DocumentTypePickerPackage)));
new FileInfo(Path.Combine(Current.IOHelper.MapPath("~/Packaging/packages"), DocumentTypePickerPackage)));
var def = PackageDefinition.FromCompiledPackage(package);
def.Id = 1;
@@ -148,7 +148,7 @@ namespace Umbraco.Tests.Packaging
Assert.AreEqual(1, result.Count);
Assert.AreEqual("bin\\Auros.DocumentTypePicker.dll", result[0]);
Assert.IsTrue(File.Exists(Path.Combine(IOHelper.MapPath("~/" + _testBaseFolder), result[0])));
Assert.IsTrue(File.Exists(Path.Combine(Current.IOHelper.MapPath("~/" + _testBaseFolder), result[0])));
//make sure the def is updated too
Assert.AreEqual(result.Count, def.Files.Count);
@@ -159,7 +159,7 @@ namespace Umbraco.Tests.Packaging
{
var package = PackageInstallation.ReadPackage(
//this is where our test zip file is
new FileInfo(Path.Combine(IOHelper.MapPath("~/Packaging/packages"), DocumentTypePickerPackage)));
new FileInfo(Path.Combine(Current.IOHelper.MapPath("~/Packaging/packages"), DocumentTypePickerPackage)));
var def = PackageDefinition.FromCompiledPackage(package);
def.Id = 1;
def.PackageId = Guid.NewGuid();
@@ -19,7 +19,7 @@ namespace Umbraco.Tests.Publishing
{
base.SetUp();
//LegacyUmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false);
//LegacyUmbracoSettings.SettingsFilePath = Current.IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false);
}
private IContent _homePage;
@@ -47,7 +47,7 @@ namespace Umbraco.Tests.Runtimes
IFactory factory = null;
// clear
foreach (var file in Directory.GetFiles(Path.Combine(IOHelper.MapPath("~/App_Data")), "NuCache.*"))
foreach (var file in Directory.GetFiles(Path.Combine(Current.IOHelper.MapPath("~/App_Data")), "NuCache.*"))
File.Delete(file);
// settings
@@ -61,7 +61,7 @@ namespace Umbraco.Tests.Runtimes
var profilingLogger = new ProfilingLogger(logger, profiler);
var appCaches = AppCaches.Disabled;
var databaseFactory = new UmbracoDatabaseFactory(logger, new Lazy<IMapperCollection>(() => factory.GetInstance<IMapperCollection>()));
var typeLoader = new TypeLoader(appCaches.RuntimeCache, IOHelper.MapPath("~/App_Data/TEMP"), profilingLogger);
var typeLoader = new TypeLoader(appCaches.RuntimeCache, Current.IOHelper.MapPath("~/App_Data/TEMP"), profilingLogger);
var mainDom = new SimpleMainDom();
var runtimeState = new RuntimeState(logger, null, null, new Lazy<IMainDom>(() => mainDom), new Lazy<IServerRegistrar>(() => factory.GetInstance<IServerRegistrar>()));
var configs = new ConfigsFactory().Create();
@@ -250,7 +250,7 @@ namespace Umbraco.Tests.Runtimes
var profilingLogger = new ProfilingLogger(logger, profiler);
var appCaches = AppCaches.Disabled;
var databaseFactory = Mock.Of<IUmbracoDatabaseFactory>();
var typeLoader = new TypeLoader(appCaches.RuntimeCache, IOHelper.MapPath("~/App_Data/TEMP"), profilingLogger);
var typeLoader = new TypeLoader(appCaches.RuntimeCache, Current.IOHelper.MapPath("~/App_Data/TEMP"), profilingLogger);
var runtimeState = Mock.Of<IRuntimeState>();
Mock.Get(runtimeState).Setup(x => x.Level).Returns(RuntimeLevel.Run);
var mainDom = Mock.Of<IMainDom>();
@@ -44,16 +44,16 @@ namespace Umbraco.Tests.Scoping
private static void ClearFiles()
{
TestHelper.DeleteDirectory(IOHelper.MapPath("media"));
TestHelper.DeleteDirectory(IOHelper.MapPath("FileSysTests"));
TestHelper.DeleteDirectory(IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"));
TestHelper.DeleteDirectory(Current.IOHelper.MapPath("media"));
TestHelper.DeleteDirectory(Current.IOHelper.MapPath("FileSysTests"));
TestHelper.DeleteDirectory(Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"));
}
[TestCase(true)]
[TestCase(false)]
public void CreateMediaTest(bool complete)
{
var physMediaFileSystem = new PhysicalFileSystem(IOHelper.MapPath("media"), "ignore");
var physMediaFileSystem = new PhysicalFileSystem(Current.IOHelper.MapPath("media"), "ignore");
var mediaFileSystem = Current.MediaFileSystem;
Assert.IsFalse(physMediaFileSystem.FileExists("f1.txt"));
@@ -86,7 +86,7 @@ namespace Umbraco.Tests.Scoping
[Test]
public void MultiThread()
{
var physMediaFileSystem = new PhysicalFileSystem(IOHelper.MapPath("media"), "ignore");
var physMediaFileSystem = new PhysicalFileSystem(Current.IOHelper.MapPath("media"), "ignore");
var mediaFileSystem = Current.MediaFileSystem;
var scopeProvider = ScopeProvider;
@@ -38,7 +38,7 @@ namespace Umbraco.Tests.TestHelpers
var logger = new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>());
var typeLoader = new TypeLoader(NoAppCache.Instance,
IOHelper.MapPath("~/App_Data/TEMP"),
Current.IOHelper.MapPath("~/App_Data/TEMP"),
logger,
false);
@@ -2,6 +2,7 @@
using System.Configuration;
using Moq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
@@ -17,11 +18,11 @@ namespace Umbraco.Tests.TestHelpers
settings.ConfigurationStatus == UmbracoVersion.SemanticVersion.ToSemanticString() &&
settings.UseHttps == false &&
settings.HideTopLevelNodeFromPath == false &&
settings.Path == IOHelper.ResolveUrl("~/umbraco") &&
settings.Path == Current.IOHelper.ResolveUrl("~/umbraco") &&
settings.TimeOutInMinutes == 20 &&
settings.DefaultUILanguage == "en" &&
settings.LocalTempStorageLocation == LocalTempStorage.Default &&
settings.LocalTempPath == IOHelper.MapPath("~/App_Data/TEMP") &&
settings.LocalTempPath == Current.IOHelper.MapPath("~/App_Data/TEMP") &&
settings.ReservedPaths == (GlobalSettings.StaticReservedPaths + "~/umbraco") &&
settings.ReservedUrls == GlobalSettings.StaticReservedUrls);
return config;
+4 -3
View File
@@ -9,6 +9,7 @@ using System.Reflection;
using System.Threading;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
@@ -67,9 +68,9 @@ namespace Umbraco.Tests.TestHelpers
{
foreach (var directory in directories)
{
var directoryInfo = new DirectoryInfo(IOHelper.MapPath(directory));
var directoryInfo = new DirectoryInfo(Current.IOHelper.MapPath(directory));
if (directoryInfo.Exists == false)
Directory.CreateDirectory(IOHelper.MapPath(directory));
Directory.CreateDirectory(Current.IOHelper.MapPath(directory));
}
}
@@ -81,7 +82,7 @@ namespace Umbraco.Tests.TestHelpers
};
foreach (var directory in directories)
{
var directoryInfo = new DirectoryInfo(IOHelper.MapPath(directory));
var directoryInfo = new DirectoryInfo(Current.IOHelper.MapPath(directory));
var preserve = preserves.ContainsKey(directory) ? preserves[directory] : null;
if (directoryInfo.Exists)
foreach (var x in directoryInfo.GetFiles().Where(x => preserve == null || preserve.Contains(x.Name) == false))
+4 -4
View File
@@ -118,9 +118,9 @@ namespace Umbraco.Tests.TestHelpers
var localizedTextService = GetLazyService<ILocalizedTextService>(factory, c => new LocalizedTextService(
new Lazy<LocalizedTextServiceFileSources>(() =>
{
var mainLangFolder = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/"));
var appPlugins = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.AppPlugins));
var configLangFolder = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Config + "/lang/"));
var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/"));
var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.AppPlugins));
var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Config + "/lang/"));
var pluginLangFolders = appPlugins.Exists == false
? Enumerable.Empty<LocalizedTextServiceSupplementaryFileSource>()
@@ -181,7 +181,7 @@ namespace Umbraco.Tests.TestHelpers
new PackageDataInstallation(logger, fileService.Value, macroService.Value, localizationService.Value, dataTypeService.Value, entityService.Value, contentTypeService.Value, contentService.Value, propertyEditorCollection, scopeProvider),
new PackageFileInstallation(compiledPackageXmlParser, new ProfilingLogger(logger, new TestProfiler())),
compiledPackageXmlParser, Mock.Of<IPackageActionRunner>(),
new DirectoryInfo(IOHelper.GetRootDirectorySafe())));
new DirectoryInfo(Current.IOHelper.GetRootDirectorySafe())));
});
var relationService = GetLazyService<IRelationService>(factory, c => new RelationService(scopeProvider, logger, eventMessagesFactory, entityService.Value, GetRepo<IRelationRepository>(c), GetRepo<IRelationTypeRepository>(c)));
var tagService = GetLazyService<ITagService>(factory, c => new TagService(scopeProvider, logger, eventMessagesFactory, GetRepo<ITagRepository>(c)));
@@ -70,10 +70,10 @@ namespace Umbraco.Tests.Web.Controllers
}
else
{
var baseDir = IOHelper.MapPath("", false).TrimEnd(IOHelper.DirSepChar);
var baseDir = Current.IOHelper.MapPath("", false).TrimEnd(Current.IOHelper.DirSepChar);
HttpContext.Current = new HttpContext(new SimpleWorkerRequest("/", baseDir, "", "", new StringWriter()));
}
IOHelper.ForceNotHosted = true;
Current.IOHelper.ForceNotHosted = true;
var usersController = new AuthenticationController(
Factory.GetInstance<IGlobalSettings>(),
umbracoContextAccessor,
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Web
// FIXME: bad in a unit test - but Udi has a static ctor that wants it?!
var factory = new Mock<IFactory>();
factory.Setup(x => x.GetInstance(typeof(TypeLoader))).Returns(
new TypeLoader(NoAppCache.Instance, IOHelper.MapPath("~/App_Data/TEMP"), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())));
new TypeLoader(NoAppCache.Instance, Current.IOHelper.MapPath("~/App_Data/TEMP"), new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())));
factory.Setup(x => x.GetInstance(typeof (ServiceContext))).Returns(serviceContext);
var settings = SettingsForTests.GetDefaultUmbracoSettings();
+1 -1
View File
@@ -265,7 +265,7 @@ namespace Umbraco.Tests.Web
.Setup(x => x.GetInstance(typeof(TypeLoader)))
.Returns(new TypeLoader(
NoAppCache.Instance,
IOHelper.MapPath("~/App_Data/TEMP"),
Current.IOHelper.MapPath("~/App_Data/TEMP"),
new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())
)
);
@@ -239,12 +239,13 @@ Use this directive to construct a header inside the main editor window.
if (scope.editorfor) {
localizeVars.push(scope.editorfor);
}
localizationService.localizeMany(localizeVars).then(function (data) {
localizationService.localizeMany(localizeVars).then(function(data) {
setAccessibilityForEditor(data);
scope.loading = false;
});
} else {
scope.loading = false;
}
scope.goBack = function () {
if (scope.onBack) {
scope.onBack();
@@ -389,7 +389,7 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) {
(umbRequestHelper.getApiUrl(
"dataTypeApiBaseUrl",
"PostRenameContainer",
{ id: id, name: name })),
{ id: id, name: encodeURIComponent(name) })),
"Failed to rename the folder with id " + id);
}
};
@@ -107,5 +107,5 @@
.umb-panel-group__details-status-action-description {
margin-top: 5px;
font-size: 12px;
padding-left: 165px;
padding-left:165px;
}
@@ -8,7 +8,6 @@
.umb-healthcheck-help-text {
line-height: 1.6em;
max-width: 750px;
}
.umb-healthcheck-action-bar {
@@ -415,8 +415,6 @@
text-decoration: none;
display: flex;
flex-direction: row;
opacity: 0;
visibility: hidden;
}
.umb-sortable-thumbnails.ui-sortable:not(.ui-sortable-disabled) {
@@ -425,9 +423,8 @@
}
}
.umb-sortable-thumbnails li:hover .umb-sortable-thumbnails__actions {
.umb-sortable-thumbnails li:hover .umb-sortable-thumbnails__action {
opacity: 1;
visibility: visible;
}
.umb-sortable-thumbnails .umb-sortable-thumbnails__action {
@@ -443,6 +440,12 @@
margin-left: 5px;
text-decoration: none;
.box-shadow(0 1px 2px rgba(0,0,0,0.25));
opacity: 0;
transition: opacity .1s ease-in-out;
.tabbing-active &:focus {
opacity: 1;
}
}
.umb-sortable-thumbnails .umb-sortable-thumbnails__action.-red {
@@ -46,6 +46,7 @@
title="{{historyLabel}}">
<umb-button
ng-hide="node.trashed"
type="button"
button-style="outline"
action="openRollback()"
@@ -4,13 +4,15 @@
<umb-box>
<umb-box-content>
<h3>Hours of Umbraco training videos are only a click away</h3>
<p>Want to master Umbraco? Spend a couple of minutes learning some best practices by watching one of these videos about using Umbraco. And visit <a href="https://umbraco.tv" target="_blank">umbraco.tv</a> for even more Umbraco videos</p>
<h3><localize key="settingsDashboardVideos_trainingHeadline">Hours of Umbraco training videos are only a click away</localize></h3>
<localize key="settingsDashboardVideos_trainingDescription">
<p>Want to master Umbraco? Spend a couple of minutes learning some best practices by watching one of these videos about using Umbraco. And visit <a href="http://umbraco.tv" target="_blank">umbraco.tv</a> for even more Umbraco videos</p>
</localize>
</umb-box-content>
</umb-box>
<div ng-show="videos.length">
<h4>To get you started:</h4>
<h4><localize key="settingsDashboardVideos_getStarted">To get you started</localize>:</h4>
<ul class="thumbnails" >
<li class="span2" ng-repeat="video in videos">
<div class="thumbnail" style="margin-right: 20px">
@@ -100,8 +100,12 @@
<div class="umb-panel-group__details-check">
<div class="umb-panel-group__details-check-title">
<div class="umb-panel-group__details-check-name">Search</div>
<div class="umb-panel-group__details-check-description">Search the index and view the results</div>
<div class="umb-panel-group__details-check-name">
<localize key="general_search">Search</localize>
</div>
<div class="umb-panel-group__details-check-description">
<localize key="examineManagement_searchDescription">Search the index and view the results</localize>
</div>
</div>
<div class="umb-panel-group__details-status">
@@ -225,7 +229,7 @@
<div class="umb-panel-group__details-status-text">
<div>{{vm.selectedIndex.healthStatus}}</div>
<div ng-show="!vm.selectedIndex" class="color-red">
The index cannot be read and will need to be rebuilt
<localize key="examineManagement_indexCannotRead">The index cannot be read and will need to be rebuilt</localize>
</div>
<!--<div ng-if="status.description" ng-bind-html="status.description"></div>-->
</div>
@@ -377,13 +381,14 @@
</div>
<div ng-show="vm.selectedIndex.processingAttempts >= 100">
The process is taking longer than expected, check the umbraco log to see if there have been any errors during this operation
<localize key="examineManagement_processIsTakingLonger">The process is taking longer than expected, check the umbraco log to see if there have been any errors during this operation</localize>
</div>
</ng-form>
<div class="umb-panel-group__details-status-action-description" ng-show="!vm.selectedIndex.canRebuild">
This index cannot be rebuilt because it has no assigned <code>IIndexPopulator</code>
<localize key="examineManagement_indexCannotRebuild">This index cannot be rebuilt because it has no assigned </localize>
<code><localize key="examineManagement_iIndexPopulator">IIndexPopulator</localize></code>
</div>
</div>
</div>
@@ -4,78 +4,70 @@
<umb-box>
<umb-box-content>
<div class="flex justify-between items-center">
<h3 class="bold">Health Check</h3>
<umb-button
type="button"
button-style="success"
label="Check All Groups"
action="vm.checkAllGroups(vm.groups)">
</umb-button>
</div>
<div class="umb-healthcheck-help-text">
<p>The health checker evaluates various areas of your site for best practice settings, configuration, potential problems, etc. You can easily fix problems by pressing a button.
You can add your own health checks, have a look at <a href="https://our.umbraco.com/documentation/Extending/Healthcheck/" target="_blank" class="btn-link -underline">the documentation for more information</a> about custom health checks.</p>
<p>
The health checker evaluates various areas of your site for best practice settings, configuration, potential problems, etc. You can easily fix problems by pressing a button.
You can add your own health checks, have a look at <a href="https://our.umbraco.com/documentation/Extending/Healthcheck/" target="_blank" class="btn-link -underline">the documentation for more information</a> about custom health checks.
</p>
</div>
<div class="umb-panel-group__details-status-actions">
<umb-button type="button"
button-style="success"
label="Check All Groups"
action="vm.checkAllGroups(vm.groups)">
</umb-button>
</div>
</umb-box-content>
</umb-box>
<div class="umb-healthcheck">
<div class="umb-air" ng-repeat="group in vm.groups">
<button type="button" class="umb-healthcheck-group" ng-click="vm.openGroup(group);">
<div class="umb-healthcheck-title">{{group.name}}</div>
<div class="umb-healthcheck-title">{{group.name}}</div>
<div class="umb-healthcheck-group__load-container" ng-if="group.loading">
<umb-load-indicator></umb-load-indicator>
<div class="umb-healthcheck-group__load-container" ng-if="group.loading">
<umb-load-indicator></umb-load-indicator>
</div>
<div class="umb-healthcheck-messages"
ng-hide="group.loading || !group.totalSuccess && !group.totalWarning && !group.totalError && !group.totalInfo">
<div class="umb-healthcheck-message" ng-if="group.totalSuccess > 0">
<i class="icon-check color-green" aria-hidden="true"></i>
{{ group.totalSuccess }}
<span class="sr-only">
<localize key="visuallyHiddenTexts_passed">passed</localize>
</span>
</div>
<div
class="umb-healthcheck-messages"
ng-hide="group.loading || !group.totalSuccess && !group.totalWarning && !group.totalError && !group.totalInfo"
>
<div class="umb-healthcheck-message" ng-if="group.totalSuccess > 0">
<i class="icon-check color-green" aria-hidden="true"></i>
{{ group.totalSuccess }}
<span class="sr-only">
<localize key="visuallyHiddenTexts_passed">passed</localize>
</span>
</div>
<div class="umb-healthcheck-message" ng-if="group.totalWarning > 0">
<i class="icon-alert color-orange" aria-hidden="true"></i>
{{ group.totalWarning }}
<span class="sr-only">
<localize key="visuallyHiddenTexts_warning">warning</localize>
</span>
</div>
<div class="umb-healthcheck-message" ng-if="group.totalError > 0">
<i class="icon-delete color-red" aria-hidden="true"></i>
{{ group.totalError }}
<span class="sr-only">
<localize key="visuallyHiddenTexts_failed">failed</localize>
</span>
</div>
<div class="umb-healthcheck-message" ng-if="group.totalInfo > 0">
<i class="umb-healthcheck-status-icon icon-info" aria-hidden="true"></i>
{{ group.totalInfo }}
<span class="sr-only">
<localize key="visuallyHiddenTexts_suggestion">suggestion</localize>
</span>
</div>
<div class="umb-healthcheck-message" ng-if="group.totalWarning > 0">
<i class="icon-alert color-orange" aria-hidden="true"></i>
{{ group.totalWarning }}
<span class="sr-only">
<localize key="visuallyHiddenTexts_warning">warning</localize>
</span>
</div>
<div class="umb-healthcheck-message" ng-if="group.totalError > 0">
<i class="icon-delete color-red" aria-hidden="true"></i>
{{ group.totalError }}
<span class="sr-only">
<localize key="visuallyHiddenTexts_failed">failed</localize>
</span>
</div>
<div class="umb-healthcheck-message" ng-if="group.totalInfo > 0">
<i class="umb-healthcheck-status-icon icon-info" aria-hidden="true"></i>
{{ group.totalInfo }}
<span class="sr-only">
<localize key="visuallyHiddenTexts_suggestion">suggestion</localize>
</span>
</div>
</div>
</button>
</div>
</div>
</div>
<div ng-if="vm.viewState === 'details'">
@@ -88,31 +80,25 @@
</umb-editor-sub-header-content-left>
</umb-editor-sub-header>
<div class="umb-panel-group__details">
<div class="umb-panel-group__details-group">
<div class="umb-panel-group__details-group-title">
<div class="umb-panel-group__details-group-name">{{ vm.selectedGroup.name }}</div>
<umb-button
type="button"
action="vm.checkAllInGroup(vm.selectedGroup, vm.selectedGroup.checks)"
label="Check group">
<umb-button type="button" button-style="success"
action="vm.checkAllInGroup(vm.selectedGroup, vm.selectedGroup.checks)"
label="Check group">
</umb-button>
</div>
<div class="umb-panel-group__details-checks">
<div class="umb-panel-group__details-check" ng-repeat="check in vm.selectedGroup.checks">
<div class="umb-panel-group__details-check-title">
<div class="umb-panel-group__details-check-name">{{ check.name }}</div>
<div class="umb-panel-group__details-check-description">{{ check.description }}</div>
</div>
<div class="umb-panel-group__details-status" ng-repeat="status in check.status">
<div class="umb-panel-group__details-status-icon-container" aria-hidden="true">
<i class="umb-healthcheck-status-icon icon-check color-green" ng-if="status.resultType === 0"></i>
<i class="umb-healthcheck-status-icon icon-alert icon-alert color-yellow" ng-if="status.resultType === 1"></i>
@@ -121,7 +107,6 @@
</div>
<div class="umb-panel-group__details-status-content">
<div class="umb-panel-group__details-status-text">
<span class="sr-only" ng-if="status.resultType === 0">
<localize key="visuallyHiddenTexts_checkPassed">Check passed</localize>:
@@ -145,16 +130,15 @@
<div ng-if="action.valueRequired">
<div><label class="bold">Set new value:</label></div>
<input name="providedValue" type="text" ng-model="action.providedValue" required val-email/>
<input name="providedValue" type="text" ng-model="action.providedValue" required val-email />
</div>
<umb-button
type="button"
button-style="success"
size="s"
disabled="healthCheckAction.providedValue.$invalid"
action="vm.executeAction(check, $parent.$index, action)"
label="{{action.name}}">
<umb-button type="button"
button-style="success"
size="s"
disabled="healthCheckAction.providedValue.$invalid"
action="vm.executeAction(check, $parent.$index, action)"
label="{{action.name}}">
</umb-button>
</ng-form>
@@ -162,9 +146,7 @@
<div class="umb-panel-group__details-status-action-description" ng-if="action.description" ng-bind-html="action.description"></div>
</div>
</div>
</div>
</div>
<div ng-show="check.loading">
@@ -173,13 +155,8 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -4,12 +4,14 @@
<umb-load-indicator></umb-load-indicator>
</div>
<p>
<span ng-show="vm.working">(wait)</span>
<span ng-show="vm.working">(<localize key="nuCache_wait">wait</localize>)</span>
</p>
<div class="umb-panel-group__details-group">
<div class="umb-panel-group__details-group-title">
<div class="umb-panel-group__details-group-name">Published Cache Status</div>
<div class="umb-panel-group__details-group-name">
<localize key="nuCache_publishedCacheStatus">Published Cache Status</localize>
</div>
</div>
<div class="umb-panel-group__details-checks">
<div class="umb-panel-group__details-check">
@@ -20,7 +22,9 @@
</div>
<div class="umb-panel-group__details-status-actions">
<div class="umb-panel-group__details-status-action no-background no-left-padding">
<button type="button" ng-click="vm.verify($event)" class="btn btn-danger">Refresh status</button>
<button type="button" ng-click="vm.verify($event)" class="btn btn-danger">
<localize key="nuCache_refreshStatus">Refresh status</localize>
</button>
</div>
</div>
</div>
@@ -31,53 +35,75 @@
<br />
<div class="umb-panel-group__details-group">
<div class="umb-panel-group__details-group-title">
<div class="umb-panel-group__details-group-name">Caches</div>
<div class="umb-panel-group__details-group-name">
<localize key="nuCache_caches">Caches</localize>
</div>
</div>
<div class="umb-panel-group__details-checks">
<div class="umb-panel-group__details-check">
<div class="umb-panel-group__details-check-title">
<div class="umb-panel-group__details-check-name">Memory Cache</div>
<div class="umb-panel-group__details-check-name">
<localize key="nuCache_memoryCache">Memory Cache</localize>
</div>
<div class="umb-panel-group__details-check-description">
This button lets you reload the in-memory cache, by entirely reloading it from the database
cache (but it does not rebuild that database cache). This is relatively fast.
Use it when you think that the memory cache has not been properly refreshed, after some events
triggered&mdash;which would indicate a minor Umbraco issue.
(note: triggers the reload on all servers in an LB environment).
<localize key="nuCache_memoryCacheDescription">
This button lets you reload the in-memory cache, by entirely reloading it from the database
cache (but it does not rebuild that database cache). This is relatively fast.
Use it when you think that the memory cache has not been properly refreshed, after some events
triggered&mdash;which would indicate a minor Umbraco issue.
(note: triggers the reload on all servers in an LB environment).
</localize>
</div>
<div class="umb-panel-group__details-status-actions">
<div class="umb-panel-group__details-status-action no-background no-left-padding">
<button type="button" ng-click="vm.reload($event)" class="btn btn-danger">Reload</button>
<button type="button" ng-click="vm.reload($event)" class="btn btn-danger">
<localize key="nuCache_reload">Reload</localize>
</button>
</div>
</div>
</div>
<div class="umb-panel-group__details-check-title top-border">
<div class="umb-panel-group__details-check-name">Database Cache</div>
<div class="umb-panel-group__details-check-name">
<localize key="nuCache_databaseCache">Database Cache</localize>
</div>
<div class="umb-panel-group__details-check-description">
This button lets you rebuild the database cache, ie the content of the cmsContentNu table.
<strong>Rebuilding can be expensive.</strong>
Use it when reloading is not enough, and you think that the database cache has not been
properly generated&mdash;which would indicate some critical Umbraco issue.
<localize key="nuCache_databaseCacheDescription">
This button lets you rebuild the database cache, ie the content of the cmsContentNu table.
<strong>Rebuilding can be expensive.</strong>
Use it when reloading is not enough, and you think that the database cache has not been
properly generated&mdash;which would indicate some critical Umbraco issue.
</localize>
</div>
<div class="umb-panel-group__details-status-actions">
<div class="umb-panel-group__details-status-action no-background no-left-padding">
<button type="button" ng-click="vm.rebuild($event)" class="btn btn-danger">Rebuild</button>
<button type="button" ng-click="vm.rebuild($event)" class="btn btn-danger">
<localize key="nuCache_rebuild">Rebuild</localize>
</button>
</div>
</div>
</div>
<div class="umb-panel-group__details-check-title top-border">
<div class="umb-panel-group__details-check-name">Internals</div>
<div class="umb-panel-group__details-check-name">
<localize key="nuCache_internals">Internals</localize>
</div>
<div class="umb-panel-group__details-check-description">
This button lets you trigger a NuCache snapshots collection (after running a fullCLR GC).
Unless you know what that means, you probably do <em>not</em> need to use it.
<localize key="nuCache_internalsDescription">
This button lets you trigger a NuCache snapshots collection (after running a fullCLR GC).
Unless you know what that means, you probably do <em>not</em> need to use it.
</localize>
</div>
<div class="umb-panel-group__details-status-actions">
<div class="umb-panel-group__details-status-action no-background no-left-padding">
<button type="button" ng-click="vm.collect($event)" class="btn btn-danger">Collect</button>
<button type="button" ng-click="vm.collect($event)" class="btn btn-danger">
<localize key="nuCache_collect">Collect</localize>
</button>
</div>
</div>
</div>
@@ -6,39 +6,51 @@
<umb-box ng-hide="vm.loading">
<umb-box-content>
<h3 class="bold">Performance profiling</h3>
<h3 class="bold">
<localize key="profiling_performanceProfiling">Performance profiling</localize>
</h3>
<div ng-show="vm.profilerEnabled">
<div class="mb4">
<p>
Umbraco currently runs in debug mode. This means you can use the built-in performance profiler to assess the performance when rendering pages.
</p>
<p>
If you want to activate the profiler for a specific page rendering, simply add <b>umbDebug=true</b> to the querystring when requesting the page.
</p>
<p>
If you want the profiler to be activated by default for all page renderings, you can use the toggle below.
It will set a cookie in your browser, which then activates the profiler automatically.
In other words, the profiler will only be active by default in <i>your</i> browser - not everyone else's.
</p>
<localize key="profiling_performanceProfilingDescription">
<p>
Umbraco currently runs in debug mode. This means you can use the built-in performance profiler to assess the performance when rendering pages.
</p>
<p>
If you want to activate the profiler for a specific page rendering, simply add <b>umbDebug=true</b> to the querystring when requesting the page.
</p>
<p>
If you want the profiler to be activated by default for all page renderings, you can use the toggle below.
It will set a cookie in your browser, which then activates the profiler automatically.
In other words, the profiler will only be active by default in <i>your</i> browser - not everyone else's.
</p>
</localize>
</div>
<div class="mb4">
<div class="flex items-center">
<umb-toggle checked="vm.alwaysOn" id="profilerAlwaysOn" on-click="vm.toggle()"></umb-toggle>
<label for="profilerAlwaysOn" class="mb0 ml2">Activate the profiler by default</label>
<label for="profilerAlwaysOn" class="mb0 ml2">
<localize key="profiling_activateByDefault">Activate the profiler by default</localize>
</label>
</div>
</div>
<h4>Friendly reminder</h4>
<p>
You should never let a production site run in debug mode. Debug mode is turned off by setting <b>debug="false"</b> on the <b>&lt;compilation /&gt;</b> element in web.config.
</p>
<h4>
<localize key="profiling_reminder">Friendly reminder</localize>
</h4>
<localize key="profiling_reminderDescription">
<p>
You should never let a production site run in debug mode. Debug mode is turned off by setting <b>debug="false"</b> on the <b>&lt;compilation /&gt;</b> element in web.config.
</p>
</localize>
</div>
<div ng-hide="vm.profilerEnabled">
<p>
Umbraco currently does not run in debug mode, so you can't use the built-in profiler. This is how it should be for a production site.
</p>
<p>
Debug mode is turned on by setting <b>debug="true"</b> on the <b>&lt;compilation /&gt;</b> element in web.config.
</p>
<localize key="profiling_profilerEnabledDescription">
<p>
Umbraco currently does not run in debug mode, so you can't use the built-in profiler. This is how it should be for a production site.
</p>
<p>
Debug mode is turned on by setting <b>debug="true"</b> on the <b>&lt;compilation /&gt;</b> element in web.config.
</p>
</localize>
</div>
</umb-box-content>
</umb-box>
@@ -1,12 +1,18 @@
<h3>Hours of Umbraco training videos are only a click away</h3>
<p>Want to master Umbraco? Spend a couple of minutes learning some best practices by watching one of these videos about using Umbraco. And visit <a href="http://umbraco.tv" target="_blank">umbraco.tv</a> for even more Umbraco videos</p>
<h3>
<localize key="settingsDashboardVideos_trainingHeadline">Hours of Umbraco training videos are only a click away</localize>
</h3>
<localize key="settingsDashboardVideos_trainingDescription">
<p>Want to master Umbraco? Spend a couple of minutes learning some best practices by watching one of these videos about using Umbraco. And visit <a href="http://umbraco.tv" target="_blank">umbraco.tv</a> for even more Umbraco videos</p>
</localize>
<div class="row-fluid"
ng-init="init('https://umbraco.tv/videos/implementor/chapterrss?sort=no')"
ng-controller="Umbraco.Dashboard.StartupVideosController">
<div ng-show="videos.length">
<h4>To get you started:</h4>
<h4>
<localize key="settingsDashboardVideos_getStarted">To get you started</localize>:
</h4>
<ul class="thumbnails" >
<li class="span2" ng-repeat="video in videos">
<div class="thumbnail" style="margin-right: 20px">
@@ -54,7 +54,7 @@
</div>
<umb-control-group label="Enter a folder name" hide-label="false">
<input type="text" name="folderName" ng-model="model.folderName" class="umb-textstring textstring input-block-level" umb-auto-focus required />
<input type="text" name="folderName" maxlength="255" ng-model="model.folderName" class="umb-textstring textstring input-block-level" umb-auto-focus required />
</umb-control-group>
<button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button>
@@ -81,7 +81,7 @@
<umb-control-group>
<label for="collectionName" class="control-label">Name of the Parent Document Type</label>
<input type="text" name="collectionName" id="collectionName" ng-model="model.collectionName" class="umb-textstring textstring input-block-level" umb-auto-focus required />
<input type="text" name="collectionName" id="collectionName" ng-model="model.collectionName" maxlength="255" class="umb-textstring textstring input-block-level" umb-auto-focus required />
<umb-checkbox ng-if="model.disableTemplates === false"
name="collectionCreateTemplate"
@@ -91,7 +91,7 @@
<umb-control-group>
<label for="collectionItemName" class="control-label">Name of the Item Document Type</label>
<input type="text" name="collectionItemName" id="collectionItemName" ng-model="model.collectionItemName" class="umb-textstring textstring input-block-level" required />
<input type="text" name="collectionItemName" id="collectionItemName" ng-model="model.collectionItemName" maxlength="255" class="umb-textstring textstring input-block-level" required />
<umb-checkbox ng-if="model.disableTemplates === false"
name="collectionItemCreateTemplate"
@@ -18,6 +18,8 @@
var documentTypeId = $routeParams.id;
var create = $routeParams.create;
var noTemplate = $routeParams.notemplate;
var isElement = $routeParams.iselement;
var allowVaryByCulture = $routeParams.culturevary;
var infiniteMode = $scope.model && $scope.model.infiniteMode;
vm.save = save;
@@ -63,6 +65,8 @@
documentTypeId = $scope.model.id;
create = $scope.model.create;
noTemplate = $scope.model.notemplate;
isElement = $scope.model.isElement;
allowVaryByCulture = $scope.model.allowVaryByCulture;
vm.submitButtonKey = "buttons_saveAndClose";
vm.generateModelsKey = "buttons_generateModelsAndClose";
}
@@ -430,7 +434,14 @@
contentType.defaultTemplate = contentTypeHelper.insertDefaultTemplatePlaceholder(contentType.defaultTemplate);
contentType.allowedTemplates = contentTypeHelper.insertTemplatePlaceholder(contentType.allowedTemplates);
}
// set isElement checkbox by default
if (isElement) {
contentType.isElement = true;
}
// set vary by culture checkbox by default
if (allowVaryByCulture) {
contentType.allowCultureVariant = true;
}
// convert icons for content type
convertLegacyIcons(contentType);
@@ -58,7 +58,9 @@
</td>
<td>
<span ng-if="language.fallbackLanguageId">{{vm.getLanguageById(language.fallbackLanguageId).name}}</span>
<span ng-if="!language.fallbackLanguageId">(none)</span>
<span ng-if="!language.fallbackLanguageId">
(<localize key="languages_none">none</localize>)
</span>
</td>
<td style="text-align: right;">
<umb-button ng-if="!language.isDefault"
@@ -20,16 +20,16 @@
<div class="umb-sortable-thumbnails__actions" data-element="sortable-thumbnail-actions">
<a role="button" aria-label="Remove" class="umb-sortable-thumbnails__action -red" data-element="action-remove" ng-click="remove()">
<i class="icon icon-delete"></i>
</a>
<button aria-label="Remove" class="umb-sortable-thumbnails__action -red btn-reset" data-element="action-remove" ng-click="remove()">
<i class="icon icon-delete" aria-hidden="true"></i>
</button>
</div>
</li>
<li style="border: none;" class="add-wrapper unsortable" ng-hide="model.value">
<a role="button" aria-label="Open media picker" data-element="sortable-thumbnails-add" class="add-link add-link-square" ng-click="add()" prevent-default>
<i class="icon icon-add large"></i>
</a>
<button aria-label="Open media picker" data-element="sortable-thumbnails-add" class="add-link add-link-square btn-reset" ng-click="add()" prevent-default>
<i class="icon icon-add large" aria-hidden="true"></i>
</button>
</li>
</ul>
</div>
@@ -36,18 +36,18 @@
</umb-file-icon>
<div class="umb-sortable-thumbnails__actions" data-element="sortable-thumbnail-actions">
<a role="button" aria-label="Edit media" ng-if="allowEditMedia" class="umb-sortable-thumbnails__action" data-element="action-edit" ng-click="vm.editItem(media)">
<i class="icon icon-edit"></i>
</a>
<a role="button" aria-label="Remove" class="umb-sortable-thumbnails__action -red" data-element="action-remove" ng-click="vm.remove($index)">
<i class="icon icon-delete"></i>
</a>
<button aria-label="Edit media" ng-if="allowEditMedia" class="umb-sortable-thumbnails__action btn-reset" data-element="action-edit" ng-click="vm.editItem(media)">
<i class="icon icon-edit" aria-hidden="true"></i>
</button>
<button aria-label="Remove" class="umb-sortable-thumbnails__action -red btn-reset" data-element="action-remove" ng-click="vm.remove($index)">
<i class="icon icon-delete" aria-hidden="true"></i>
</button>
</div>
</li>
<li style="border: none;" class="add-wrapper unsortable" ng-if="vm.showAdd() && allowAddMedia">
<a role="button" aria-label="Open media picker" data-element="sortable-thumbnails-add" class="add-link" ng-click="vm.add()" ng-class="{'add-link-square': (mediaItems.length === 0 || isMultiPicker)}" prevent-default>
<i class="icon icon-add large"></i>
</a>
<button aria-label="Open media picker" data-element="sortable-thumbnails-add" class="add-link btn-reset" ng-click="vm.add()" ng-class="{'add-link-square': (mediaItems.length === 0 || isMultiPicker)}" prevent-default>
<i class="icon icon-add large" aria-hidden="true"></i>
</button>
</li>
</ul>
</div>
+1 -1
View File
@@ -432,4 +432,4 @@
<Message Text="ConfigFile: $(OriginalFileName) -&gt; $(OutputFileName)" Importance="high" Condition="Exists('$(ModifiedFileName)')" />
<Copy SourceFiles="$(ModifiedFileName)" DestinationFiles="$(OutputFileName)" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" Condition="Exists('$(ModifiedFileName)')" />
</Target>
</Project>
</Project>
@@ -9,7 +9,7 @@
Html.EnableClientValidation();
Html.EnableUnobtrusiveJavaScript();
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js");
@@ -11,7 +11,7 @@
Html.EnableClientValidation();
Html.EnableUnobtrusiveJavaScript();
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js");
}
@@ -33,7 +33,7 @@
Html.EnableClientValidation();
Html.EnableUnobtrusiveJavaScript();
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.min.js");
Html.RequiresJs("https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js");
@@ -7,6 +7,7 @@
@using Microsoft.Owin.Security
@using Newtonsoft.Json
@using Newtonsoft.Json.Linq
@using Umbraco.Core.Composing
@using Umbraco.Core.IO
@using Umbraco.Web
@using Umbraco.Web.Editors
@@ -32,7 +33,7 @@
<title>Umbraco</title>
@Html.RenderCssHere(
new BasicPath("Umbraco", IOHelper.ResolveUrl(SystemDirectories.Umbraco)))
new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)))
@*Because we're lazy loading angular js, the embedded cloak style will not be loaded initially, but we need it*@
<style>
@@ -41,7 +41,7 @@
<title ng-bind="$root.locationTitle">Umbraco</title>
@Html.RenderCssHere(
new BasicPath("Umbraco", IOHelper.ResolveUrl(SystemDirectories.Umbraco)))
new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)))
</head>
<body ng-class="{'touch':touchDevice, 'emptySection':emptySection, 'umb-drawer-is-visible':drawer.show, 'umb-tour-is-visible': tour.show, 'tabbing-active':tabbingActive}" ng-controller="Umbraco.MainController" id="umbracoMainPageBody">
@@ -1,6 +1,7 @@
@using Umbraco.Core
@using ClientDependency.Core
@using ClientDependency.Core.Mvc
@using Umbraco.Core.Composing
@using Umbraco.Core.IO
@using Umbraco.Web
@using Umbraco.Core.Configuration
@@ -21,7 +22,7 @@
<meta name="pinterest" content="nopin" />
@Html.RenderCssHere(
new BasicPath("Umbraco", IOHelper.ResolveUrl(SystemDirectories.Umbraco)))
new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)))
</head>
<body id="canvasdesignerPanel" ng-mouseover="outlinePositionHide()" ng-controller="previewController">

Some files were not shown because too many files have changed in this diff Show More