Compare commits

...

23 Commits

Author SHA1 Message Date
Sebastiaan Janssen 267cd46ea0 Another additional fix to make the reloading of trees work after package install 2012-11-28 13:34:35 -01:00
Sebastiaan Janssen 96f6a0161f Merge with 4.11.1 2012-11-28 13:08:13 -01:00
Sebastiaan Janssen 7bc53adc67 Closing 4.11.1 branch 2012-11-28 13:06:01 -01:00
Sebastiaan Janssen 8ecff73c18 Added tag Release-4.11.1 for changeset 7f827760cb49 2012-11-28 13:05:21 -01:00
Stephan 35e65ad18c add support for "/foo" hostnames ONLY for backward compat.
fix invalid hostname message
2012-11-28 12:43:19 -01:00
Sebastiaan Janssen 8def8eaa86 Bumping the version to 4.11.1 2012-11-28 09:44:03 -01:00
Sebastiaan Janssen c0774ad9b9 Merge 2012-11-28 09:24:54 -01:00
Sebastiaan Janssen f306cbe457 Move invalidDomain entry to the correct area. 2012-11-28 09:24:40 -01:00
Sebastiaan Janssen 577b989c4c Aha, string needs to start all the way to the left to appear nicely in the editor 2012-11-28 08:41:54 -01:00
Sebastiaan Janssen e6b162f4f6 Add translation for invalid hostname 2012-11-28 08:37:08 -01:00
Stephan b40cc1879f missing entry in language file 2012-11-28 07:36:08 -01:00
Shannon Deminick 8a7c7bf77d Merge 2012-11-27 21:47:20 +05:00
Shannon Deminick 38a1179de5 applied patch from rev 189f37a1dd63 which reverts the last minute changes before 4.11
release, namely changes to the ApplicationTreeRegistrar, TreeDefinitionCollection, theend installer step.
2012-11-27 21:45:57 +05:00
Sebastiaan Janssen f263b4d92b Fixes U4-1162 - In MVC mode, creating a child template doesn't set the layout
correctly (it's missing the .cshtml extension)
2012-11-27 15:36:54 -01:00
Sebastiaan Janssen c612727116 Add translations that got lost in merge, fixes U4-1254 2012-11-27 14:07:13 -01:00
Sebastiaan Janssen ab9c9df7d6 Reverting last minute hacks around the pluginmanager and adding Shannon's fixes
from changeset 85f9e5879e60
2012-11-27 13:27:33 -01:00
Stephan c607e50433 U4-1245, U4-1186... fix the mess I created with hostnames 2012-11-27 12:43:57 -01:00
Stephan df5555bdf1 Opened branch 4.11.1 2012-11-27 12:40:42 -01:00
Sebastiaan Janssen 9506339e6f Merge with 4.11.0 2012-11-23 13:37:17 -01:00
Sebastiaan Janssen 68605a7560 Closed branch 4.11.0 2012-11-23 13:36:14 -01:00
Sebastiaan Janssen 839dd7315a Added tag Release-4.11.0 for changeset 20e4dff821d8 2012-11-23 13:33:15 -01:00
NielsHartvig@UMBRACORATI.localdomain d148c10c66 Update to sanitizer 2012-11-16 14:24:24 -01:00
NielsHartvig@UMBRACORATI.localdomain 2b573b9070 The BOSS is fixing U4-367 2012-11-16 14:08:28 -01:00
22 changed files with 1692 additions and 1378 deletions
+2
View File
@@ -12,3 +12,5 @@ d03fcffb8834a9583a56813bb44b6abbd9f042cc Release-4.6.0
de73e687ddf6086ed52b6554676c1632865d07f2 Release-4.9.0
8d7d8609e2e4b971da99cd97f72132ce85ce3333 Release-4.9.1
f6da531fbb4c251ff61d314e2a7effb13c71e74a Release-4.10.0
20e4dff821d8ac2527a5353618fa1a23ea1d8b34 Release-4.11.0
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
+1 -1
View File
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms.Core</id>
<version>4.11.0</version>
<version>4.11.1</version>
<title>Umbraco Cms Core Binaries</title>
<authors>Morten Christensen</authors>
<owners>Umbraco HQ</owners>
+2 -2
View File
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms</id>
<version>4.11.0</version>
<version>4.11.1</version>
<title>Umbraco Cms</title>
<authors>Morten Christensen</authors>
<owners>Umbraco HQ</owners>
@@ -15,7 +15,7 @@
<language>en-US</language>
<tags>umbraco</tags>
<dependencies>
<dependency id="UmbracoCms.Core" version="4.11.0" />
<dependency id="UmbracoCms.Core" version="4.11.1" />
</dependencies>
</metadata>
<files>
@@ -28,7 +28,7 @@ namespace Umbraco.Core.Configuration
#region Private static fields
// CURRENT UMBRACO VERSION ID
private const string CurrentUmbracoVersion = "4.11.0";
private const string CurrentUmbracoVersion = "4.11.1";
private static string _reservedUrlsCache;
private static string _reservedPathsCache;
+121 -110
View File
@@ -4,124 +4,135 @@ using Umbraco.Core.Logging;
namespace Umbraco.Core
{
/// <summary>
/// Starts the timer and invokes a callback upon disposal. Provides a simple way of timing an operation by wrapping it in a <code>using</code> (C#) statement.
/// </summary>
/// <example>
/// <code>
/// Console.WriteLine("Testing Stopwatchdisposable, should be 567:");
// using (var timer = new DisposableTimer(result => Console.WriteLine("Took {0}ms", result)))
// {
// Thread.Sleep(567);
// }
/// </code>
/// </example>
public class DisposableTimer : DisposableObject
{
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private readonly Action<long> _callback;
/// <summary>
/// Starts the timer and invokes a callback upon disposal. Provides a simple way of timing an operation by wrapping it in a <code>using</code> (C#) statement.
/// </summary>
/// <example>
/// <code>
/// Console.WriteLine("Testing Stopwatchdisposable, should be 567:");
// using (var timer = new DisposableTimer(result => Console.WriteLine("Took {0}ms", result)))
// {
// Thread.Sleep(567);
// }
/// </code>
/// </example>
public class DisposableTimer : DisposableObject
{
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private readonly Action<long> _callback;
protected DisposableTimer(Action<long> callback)
{
_callback = callback;
}
protected DisposableTimer(Action<long> callback)
{
_callback = callback;
}
public Stopwatch Stopwatch
{
get { return _stopwatch; }
}
public Stopwatch Stopwatch
{
get { return _stopwatch; }
}
/// <summary>
/// Starts the timer and invokes the specified callback upon disposal.
/// </summary>
/// <param name="callback">The callback.</param>
/// <returns></returns>
public static DisposableTimer Start(Action<long> callback)
{
return new DisposableTimer(callback);
}
/// <summary>
/// Starts the timer and invokes the specified callback upon disposal.
/// </summary>
/// <param name="callback">The callback.</param>
/// <returns></returns>
public static DisposableTimer Start(Action<long> callback)
{
return new DisposableTimer(callback);
}
/// <summary>
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer TraceDuration<T>(string startMessage, string completeMessage)
{
return TraceDuration(typeof(T), startMessage, completeMessage);
}
public static DisposableTimer TraceDuration<T>(Func<string> startMessage, Func<string> completeMessage)
{
return TraceDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage)
{
LogHelper.Info(loggerType, () => startMessage);
return new DisposableTimer(x => LogHelper.Info(loggerType, () => completeMessage + " (took " + x + "ms)"));
}
public static DisposableTimer TraceDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
{
LogHelper.Debug(loggerType, startMessage);
return new DisposableTimer(x => LogHelper.Info(loggerType, () => completeMessage() + " (took " + x + "ms)"));
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration<T>(string startMessage, string completeMessage)
{
return DebugDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer TraceDuration<T>(string startMessage, string completeMessage)
{
return TraceDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration<T>(Func<string> startMessage, Func<string> completeMessage)
{
return DebugDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage)
{
LogHelper.Info(loggerType, () => startMessage);
return new DisposableTimer(x => LogHelper.Info(loggerType, () => completeMessage + " (took " + x + "ms)"));
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration(Type loggerType, string startMessage, string completeMessage)
{
LogHelper.Debug(loggerType, () => startMessage);
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage + " (took " + x + "ms)"));
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration<T>(string startMessage, string completeMessage)
{
return DebugDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
{
LogHelper.Debug(loggerType, startMessage);
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage() + " (took " + x + "ms)"));
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration<T>(Func<string> startMessage, Func<string> completeMessage)
{
return DebugDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
/// </summary>
protected override void DisposeResources()
{
_callback.Invoke(Stopwatch.ElapsedMilliseconds);
}
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration(Type loggerType, string startMessage, string completeMessage)
{
LogHelper.Debug(loggerType, () => startMessage);
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage + " (took " + x + "ms)"));
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
public static DisposableTimer DebugDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
{
LogHelper.Debug(loggerType, startMessage);
return new DisposableTimer(x => LogHelper.Debug(loggerType, () => completeMessage() + " (took " + x + "ms)"));
}
/// <summary>
/// Handles the disposal of resources. Derived from abstract class <see cref="DisposableObject"/> which handles common required locking logic.
/// </summary>
protected override void DisposeResources()
{
_callback.Invoke(Stopwatch.ElapsedMilliseconds);
}
}
}
File diff suppressed because it is too large Load Diff
+289 -257
View File
@@ -8,12 +8,12 @@ using System.Web.Compilation;
using NUnit.Framework;
using SqlCE4Umbraco;
using Umbraco.Core;
using Umbraco.Core.IO;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web;
using umbraco;
using umbraco.DataLayer;
using umbraco.MacroEngines;
using umbraco.MacroEngines.Iron;
using umbraco.businesslogic;
using umbraco.cms.businesslogic;
using umbraco.editorControls;
@@ -24,21 +24,21 @@ using umbraco.cms;
namespace Umbraco.Tests
{
[TestFixture]
public class PluginManagerTests
{
[TestFixture]
public class PluginManagerTests
{
[SetUp]
public void Initialize()
{
TestHelper.SetupLog4NetForTests();
[SetUp]
public void Initialize()
{
TestHelper.SetupLog4NetForTests();
//this ensures its reset
PluginManager.Current = new PluginManager(false);
//this ensures its reset
PluginManager.Current = new PluginManager(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
PluginManager.Current.AssembliesToScan = new[]
//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
PluginManager.Current.AssembliesToScan = new[]
{
this.GetType().Assembly,
typeof(ApplicationStartupHandler).Assembly,
@@ -54,286 +54,318 @@ namespace Umbraco.Tests
typeof(System.Web.Mvc.ActionResult).Assembly,
typeof(TypeFinder).Assembly,
typeof(ISqlHelper).Assembly,
typeof(DLRScriptingEngine).Assembly,
typeof(ICultureDictionary).Assembly,
typeof(UmbracoContext).Assembly,
typeof(BaseDataType).Assembly
};
}
}
private DirectoryInfo PrepareFolder()
{
var assDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
var dir = Directory.CreateDirectory(Path.Combine(assDir.FullName, "PluginManager", Guid.NewGuid().ToString("N")));
foreach (var f in dir.GetFiles())
{
f.Delete();
}
return dir;
}
private DirectoryInfo PrepareFolder()
{
var assDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
var dir = Directory.CreateDirectory(Path.Combine(assDir.FullName, "PluginManager", Guid.NewGuid().ToString("N")));
foreach (var f in dir.GetFiles())
{
f.Delete();
}
return dir;
}
//[Test]
//public void Scan_Vs_Load_Benchmark()
//{
// var pluginManager = new PluginManager(false);
// var watch = new Stopwatch();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = Type.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type3 = Type.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type4 = Type.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type5 = Type.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = BuildManager.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type3 = BuildManager.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type4 = BuildManager.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type5 = BuildManager.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
// watch.Reset();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var refreshers = pluginManager.ResolveTypes<ICacheRefresher>(false);
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (2nd round): " + watch.ElapsedMilliseconds);
//}
//[Test]
//public void Scan_Vs_Load_Benchmark()
//{
// var pluginManager = new PluginManager(false);
// var watch = new Stopwatch();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = Type.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type3 = Type.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type4 = Type.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type5 = Type.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = BuildManager.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type3 = BuildManager.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type4 = BuildManager.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type5 = BuildManager.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
// watch.Reset();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var refreshers = pluginManager.ResolveTypes<ICacheRefresher>(false);
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (2nd round): " + watch.ElapsedMilliseconds);
//}
////NOTE: This test shows that Type.GetType is 100% faster than Assembly.Load(..).GetType(...) so we'll use that :)
//[Test]
//public void Load_Type_Benchmark()
//{
// var watch = new Stopwatch();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = Type.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type3 = Type.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type4 = Type.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type5 = Type.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
// watch.Reset();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
// .GetType("umbraco.macroCacheRefresh");
// var type3 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
// .GetType("umbraco.templateCacheRefresh");
// var type4 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
// .GetType("umbraco.presentation.cache.MediaLibraryRefreshers");
// var type5 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
// .GetType("umbraco.presentation.cache.pageRefresher");
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (2nd round): " + watch.ElapsedMilliseconds);
// watch.Reset();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = BuildManager.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type3 = BuildManager.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type4 = BuildManager.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type5 = BuildManager.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
//}
////NOTE: This test shows that Type.GetType is 100% faster than Assembly.Load(..).GetType(...) so we'll use that :)
//[Test]
//public void Load_Type_Benchmark()
//{
// var watch = new Stopwatch();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = Type.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type3 = Type.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type4 = Type.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// var type5 = Type.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null");
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
// watch.Reset();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
// .GetType("umbraco.macroCacheRefresh");
// var type3 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
// .GetType("umbraco.templateCacheRefresh");
// var type4 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
// .GetType("umbraco.presentation.cache.MediaLibraryRefreshers");
// var type5 = Assembly.Load("umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null")
// .GetType("umbraco.presentation.cache.pageRefresher");
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (2nd round): " + watch.ElapsedMilliseconds);
// watch.Reset();
// watch.Start();
// for (var i = 0; i < 1000; i++)
// {
// var type2 = BuildManager.GetType("umbraco.macroCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type3 = BuildManager.GetType("umbraco.templateCacheRefresh, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type4 = BuildManager.GetType("umbraco.presentation.cache.MediaLibraryRefreshers, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// var type5 = BuildManager.GetType("umbraco.presentation.cache.pageRefresher, umbraco, Version=1.0.4698.259, Culture=neutral, PublicKeyToken=null", true);
// }
// watch.Stop();
// Debug.WriteLine("TOTAL TIME (1st round): " + watch.ElapsedMilliseconds);
//}
[Test]
public void Create_Cached_Plugin_File()
{
var types = new[] {typeof (PluginManager), typeof (PluginManagerTests), typeof (UmbracoContext)};
[Test]
public void Detect_Legacy_Plugin_File_List()
{
var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/PluginCache");
var manager = new PluginManager(false);
var filePath = Path.Combine(tempFolder, "umbraco-plugins.list");
File.WriteAllText(filePath, @"<?xml version=""1.0"" encoding=""utf-8""?>
<plugins>
<baseType type=""umbraco.interfaces.ICacheRefresher"">
<add type=""umbraco.macroCacheRefresh, umbraco, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null"" />
</baseType>
</plugins>");
var manager = new PluginManager(false);
//yes this is silly, none of these types inherit from string, but this is just to test the xml file format
manager.UpdateCachedPluginsFile<string>(types);
Assert.IsTrue(manager.DetectLegacyPluginListFile());
var plugins = manager.TryGetCachedPluginsFromFile<string>();
Assert.IsTrue(plugins.Success);
Assert.AreEqual(3, plugins.Result.Count());
var shouldContain = types.Select(x => x.AssemblyQualifiedName);
//ensure they are all found
Assert.IsTrue(plugins.Result.ContainsAll(shouldContain));
}
File.Delete(filePath);
[Test]
public void PluginHash_From_String()
{
var s = "hello my name is someone".GetHashCode().ToString("x", CultureInfo.InvariantCulture);
var output = PluginManager.ConvertPluginsHashFromHex(s);
Assert.AreNotEqual(0, output);
}
//now create a valid one
File.WriteAllText(filePath, @"<?xml version=""1.0"" encoding=""utf-8""?>
<plugins>
<baseType type=""umbraco.interfaces.ICacheRefresher"" resolutionType=""FindAllTypes"">
<add type=""umbraco.macroCacheRefresh, umbraco, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null"" />
</baseType>
</plugins>");
[Test]
public void Get_Plugins_Hash()
{
//Arrange
var dir = PrepareFolder();
var d1 = dir.CreateSubdirectory("1");
var d2 = dir.CreateSubdirectory("2");
var d3 = dir.CreateSubdirectory("3");
var d4 = dir.CreateSubdirectory("4");
var f1 = new FileInfo(Path.Combine(d1.FullName, "test1.dll"));
var f2 = new FileInfo(Path.Combine(d1.FullName, "test2.dll"));
var f3 = new FileInfo(Path.Combine(d2.FullName, "test1.dll"));
var f4 = new FileInfo(Path.Combine(d2.FullName, "test2.dll"));
var f5 = new FileInfo(Path.Combine(d3.FullName, "test1.dll"));
var f6 = new FileInfo(Path.Combine(d3.FullName, "test2.dll"));
var f7 = new FileInfo(Path.Combine(d4.FullName, "test1.dll"));
f1.CreateText().Close();
f2.CreateText().Close();
f3.CreateText().Close();
f4.CreateText().Close();
f5.CreateText().Close();
f6.CreateText().Close();
f7.CreateText().Close();
var list1 = new[] { f1, f2, f3, f4, f5, f6 };
var list2 = new[] { f1, f3, f5 };
var list3 = new[] { f1, f3, f5, f7 };
Assert.IsFalse(manager.DetectLegacyPluginListFile());
}
//Act
var hash1 = PluginManager.GetAssembliesHash(list1);
var hash2 = PluginManager.GetAssembliesHash(list2);
var hash3 = PluginManager.GetAssembliesHash(list3);
[Test]
public void Create_Cached_Plugin_File()
{
var types = new[] { typeof(PluginManager), typeof(PluginManagerTests), typeof(UmbracoContext) };
//Assert
var manager = new PluginManager(false);
//yes this is silly, none of these types inherit from string, but this is just to test the xml file format
manager.UpdateCachedPluginsFile<string>(types, PluginManager.TypeResolutionKind.FindAllTypes);
//both should be the same since we only create the hash based on the unique folder of the list passed in, yet
//all files will exist in those folders still
Assert.AreEqual(hash1, hash2);
Assert.AreNotEqual(hash1, hash3);
}
var plugins = manager.TryGetCachedPluginsFromFile<string>(PluginManager.TypeResolutionKind.FindAllTypes);
var diffType = manager.TryGetCachedPluginsFromFile<string>(PluginManager.TypeResolutionKind.FindAttributedTypes);
[Test]
public void Ensure_Only_One_Type_List_Created()
{
var foundTypes1 = PluginManager.Current.ResolveFindMeTypes();
var foundTypes2 = PluginManager.Current.ResolveFindMeTypes();
Assert.AreEqual(1,
PluginManager.Current.GetTypeLists()
.Count(x => x.IsTypeList<IFindMe>(PluginManager.TypeResolutionKind.FindAllTypes)));
}
Assert.IsTrue(plugins.Success);
//this will be false since there is no cache of that type resolution kind
Assert.IsFalse(diffType.Success);
[Test]
public void Resolves_Types()
{
var foundTypes1 = PluginManager.Current.ResolveFindMeTypes();
Assert.AreEqual(2, foundTypes1.Count());
}
Assert.AreEqual(3, plugins.Result.Count());
var shouldContain = types.Select(x => x.AssemblyQualifiedName);
//ensure they are all found
Assert.IsTrue(plugins.Result.ContainsAll(shouldContain));
}
[Test]
public void Resolves_Attributed_Trees()
{
var trees = PluginManager.Current.ResolveAttributedTrees();
Assert.AreEqual(27, trees.Count());
}
[Test]
public void PluginHash_From_String()
{
var s = "hello my name is someone".GetHashCode().ToString("x", CultureInfo.InvariantCulture);
var output = PluginManager.ConvertPluginsHashFromHex(s);
Assert.AreNotEqual(0, output);
}
[Test]
public void Resolves_Actions()
{
var actions = PluginManager.Current.ResolveActions();
Assert.AreEqual(37, actions.Count());
}
[Test]
public void Get_Plugins_Hash()
{
//Arrange
var dir = PrepareFolder();
var d1 = dir.CreateSubdirectory("1");
var d2 = dir.CreateSubdirectory("2");
var d3 = dir.CreateSubdirectory("3");
var d4 = dir.CreateSubdirectory("4");
var f1 = new FileInfo(Path.Combine(d1.FullName, "test1.dll"));
var f2 = new FileInfo(Path.Combine(d1.FullName, "test2.dll"));
var f3 = new FileInfo(Path.Combine(d2.FullName, "test1.dll"));
var f4 = new FileInfo(Path.Combine(d2.FullName, "test2.dll"));
var f5 = new FileInfo(Path.Combine(d3.FullName, "test1.dll"));
var f6 = new FileInfo(Path.Combine(d3.FullName, "test2.dll"));
var f7 = new FileInfo(Path.Combine(d4.FullName, "test1.dll"));
f1.CreateText().Close();
f2.CreateText().Close();
f3.CreateText().Close();
f4.CreateText().Close();
f5.CreateText().Close();
f6.CreateText().Close();
f7.CreateText().Close();
var list1 = new[] { f1, f2, f3, f4, f5, f6 };
var list2 = new[] { f1, f3, f5 };
var list3 = new[] { f1, f3, f5, f7 };
[Test]
public void Resolves_Trees()
{
var trees = PluginManager.Current.ResolveTrees();
Assert.AreEqual(36, trees.Count());
}
//Act
var hash1 = PluginManager.GetAssembliesHash(list1);
var hash2 = PluginManager.GetAssembliesHash(list2);
var hash3 = PluginManager.GetAssembliesHash(list3);
[Test]
public void Resolves_Applications()
{
var apps = PluginManager.Current.ResolveApplications();
Assert.AreEqual(7, apps.Count());
}
//Assert
Assert.AreNotEqual(hash1, hash2);
Assert.AreNotEqual(hash1, hash3);
Assert.AreNotEqual(hash2, hash3);
[Test]
public void Resolves_Action_Handlers()
{
var types = PluginManager.Current.ResolveActionHandlers();
Assert.AreEqual(1, types.Count());
}
Assert.AreEqual(hash1, PluginManager.GetAssembliesHash(list1));
}
[Test]
public void Resolves_DataTypes()
{
var types = PluginManager.Current.ResolveDataTypes();
Assert.AreEqual(37, types.Count());
}
[Test]
public void Ensure_Only_One_Type_List_Created()
{
var foundTypes1 = PluginManager.Current.ResolveFindMeTypes();
var foundTypes2 = PluginManager.Current.ResolveFindMeTypes();
Assert.AreEqual(1,
PluginManager.Current.GetTypeLists()
.Count(x => x.IsTypeList<IFindMe>(PluginManager.TypeResolutionKind.FindAllTypes)));
}
[Test]
public void Resolves_RazorDataTypeModels()
{
var types = PluginManager.Current.ResolveRazorDataTypeModels();
Assert.AreEqual(2, types.Count());
}
[Test]
public void Resolves_Types()
{
var foundTypes1 = PluginManager.Current.ResolveFindMeTypes();
Assert.AreEqual(2, foundTypes1.Count());
}
[Test]
public void Resolves_RestExtensions()
{
var types = PluginManager.Current.ResolveRestExtensions();
Assert.AreEqual(2, types.Count());
}
[Test]
public void Resolves_Attributed_Trees()
{
var trees = PluginManager.Current.ResolveAttributedTrees();
Assert.AreEqual(27, trees.Count());
}
[Test]
public void Resolves_LegacyRestExtensions()
{
var types = PluginManager.Current.ResolveLegacyRestExtensions();
Assert.AreEqual(1, types.Count());
}
[Test]
public void Resolves_Actions()
{
var actions = PluginManager.Current.ResolveActions();
Assert.AreEqual(37, actions.Count());
}
[Test]
public void Resolves_XsltExtensions()
{
var types = PluginManager.Current.ResolveXsltExtensions();
Assert.AreEqual(1, types.Count());
}
[Test]
public void Resolves_Trees()
{
var trees = PluginManager.Current.ResolveTrees();
Assert.AreEqual(36, trees.Count());
}
[XsltExtension("Blah.Blah")]
public class MyXsltExtension
{
[Test]
public void Resolves_Applications()
{
var apps = PluginManager.Current.ResolveApplications();
Assert.AreEqual(7, apps.Count());
}
}
[Test]
public void Resolves_Action_Handlers()
{
var types = PluginManager.Current.ResolveActionHandlers();
Assert.AreEqual(1, types.Count());
}
[umbraco.presentation.umbracobase.RestExtension("Blah")]
public class MyLegacyRestExtension
{
}
[Test]
public void Resolves_DataTypes()
{
var types = PluginManager.Current.ResolveDataTypes();
Assert.AreEqual(37, types.Count());
}
[Umbraco.Web.BaseRest.RestExtension("Blah")]
public class MyRestExtesion
{
}
[Test]
public void Resolves_RazorDataTypeModels()
{
var types = PluginManager.Current.ResolveRazorDataTypeModels();
Assert.AreEqual(2, types.Count());
}
public interface IFindMe
{
[Test]
public void Resolves_RestExtensions()
{
var types = PluginManager.Current.ResolveRestExtensions();
Assert.AreEqual(2, types.Count());
}
}
[Test]
public void Resolves_LegacyRestExtensions()
{
var types = PluginManager.Current.ResolveLegacyRestExtensions();
Assert.AreEqual(1, types.Count());
}
public class FindMe1 : IFindMe
{
[Test]
public void Resolves_XsltExtensions()
{
var types = PluginManager.Current.ResolveXsltExtensions();
Assert.AreEqual(1, types.Count());
}
}
[XsltExtension("Blah.Blah")]
public class MyXsltExtension
{
public class FindMe2 : IFindMe
{
}
}
[umbraco.presentation.umbracobase.RestExtension("Blah")]
public class MyLegacyRestExtension
{
}
}
[Umbraco.Web.BaseRest.RestExtension("Blah")]
public class MyRestExtesion
{
}
public interface IFindMe
{
}
public class FindMe1 : IFindMe
{
}
public class FindMe2 : IFindMe
{
}
}
}
+157 -75
View File
@@ -36,11 +36,16 @@
</area>
<area alias="assignDomain">
<key alias="addNew">Add new Domain</key>
<key alias="invalidDomain">Invalid hostname</key>
<key alias="domain">Domain</key>
<key alias="domainCreated">New domain '%0%' has been created</key>
<key alias="domainDeleted">Domain '%0%' is deleted</key>
<key alias="domainExists">Domain '%0%' has already been assigned</key>
<key alias="domainHelp">ei: yourdomain.com, www.yourdomain.com</key>
<key alias="domainHelp">
<![CDATA[eg: example.com, www.example.com, example.com:8080,<br/>
https://www.example.com/, example.com/en, etc. Use * to match<br/>
any domain and just set the culture.]]>
</key>
<key alias="domainUpdated">Domain '%0%' has been updated</key>
<key alias="orEdit">Edit Current Domains</key>
</area>
@@ -69,6 +74,7 @@
<key alias="saveAndPublish">Save and publish</key>
<key alias="saveToPublish">Save and send for approval</key>
<key alias="showPage">Preview</key>
<key alias="showPageDisabled">Preview is disabled because there's no template assigned</key>
<key alias="styleChoose">Choose style</key>
<key alias="styleShow">Show styles</key>
<key alias="tableInsert">Insert table</key>
@@ -88,7 +94,7 @@
<key alias="itemNotPublished">This item is not published</key>
<key alias="lastPublished">Last published</key>
<key alias="mediatype">Media Type</key>
<key alias="mediaLinks">Link to media item(s)</key>
<key alias="mediaLinks">Link to media item(s)</key>
<key alias="membergroup">Member Group</key>
<key alias="memberrole">Role</key>
<key alias="membertype">Member Type</key>
@@ -164,18 +170,24 @@
<key alias="siterepublishHelp">The website cache will be refreshed. All published content will be updated, while unpublished content will stay unpublished.</key>
<key alias="tableColumns">Number of columns</key>
<key alias="tableRows">Number of rows</key>
<key alias="templateContentAreaHelp"><![CDATA[<strong>Set a placeholder id</strong> by setting an ID on your placeholder you can inject content into this template from child templates,
by refering this ID using a <code>&lt;asp:content /&gt;</code> element.]]></key>
<key alias="templateContentPlaceHolderHelp"><![CDATA[<strong>Select a placeholder id</strong> from the list below. You can only
choose Id's from the current template's master.]]></key>
<key alias="templateContentAreaHelp">
<![CDATA[<strong>Set a placeholder id</strong> by setting an ID on your placeholder you can inject content into this template from child templates,
by refering this ID using a <code>&lt;asp:content /&gt;</code> element.]]>
</key>
<key alias="templateContentPlaceHolderHelp">
<![CDATA[<strong>Select a placeholder id</strong> from the list below. You can only
choose Id's from the current template's master.]]>
</key>
<key alias="thumbnailimageclickfororiginal">Click on the image to see full size</key>
<key alias="treepicker">Pick item</key>
<key alias="viewCacheItem">View Cache Item</key>
</area>
<area alias="dictionaryItem">
<key alias="description"><![CDATA[
<key alias="description">
<![CDATA[
Edit the different language versions for the dictionary item '<em>%0%</em>' below<br/>You can add additional languages under the 'languages' in the menu on the left
]]></key>
]]>
</key>
<key alias="displayName">Culture Name</key>
</area>
<area alias="editcontenttype">
@@ -340,34 +352,45 @@
<key alias="databaseErrorWebConfig">Could not save the web.config file. Please modify the connection string manually.</key>
<key alias="databaseFound">Your database has been found and is identified as</key>
<key alias="databaseHeader">Database configuration</key>
<key alias="databaseInstall"><![CDATA[
<key alias="databaseInstall">
<![CDATA[
Press the <strong>install</strong> button to install the Umbraco %0% database
]]></key>
]]>
</key>
<key alias="databaseInstallDone"><![CDATA[Umbraco %0% has now been copied to your database. Press <strong>Next</strong> to proceed.]]></key>
<key alias="databaseNotFound"><![CDATA[<p>Database not found! Please check that the information in the "connection string" of the “web.config” file is correct.</p>
<key alias="databaseNotFound">
<![CDATA[<p>Database not found! Please check that the information in the "connection string" of the “web.config” file is correct.</p>
<p>To proceed, please edit the "web.config" file (using Visual Studio or your favourite text editor), scroll to the bottom, add the connection string for your database in the key named "umbracoDbDSN" and save the file. </p>
<p>
Click the <strong>retry</strong> button when
done.<br /><a href="http://umbraco.org/redir/installWebConfig" target="_blank">
More information on editing web.config here.</a></p>]]></key>
<key alias="databaseText"><![CDATA[To complete this step, you must know some information regarding your database server ("connection string").<br />
More information on editing web.config here.</a></p>]]>
</key>
<key alias="databaseText">
<![CDATA[To complete this step, you must know some information regarding your database server ("connection string").<br />
Please contact your ISP if necessary.
If you're installing on a local machine or server you might need information from your system administrator.]]></key>
<key alias="databaseUpgrade"><![CDATA[
If you're installing on a local machine or server you might need information from your system administrator.]]>
</key>
<key alias="databaseUpgrade">
<![CDATA[
<p>
Press the <strong>upgrade</strong> button to upgrade your database to Umbraco %0%</p>
<p>
Don't worry - no content will be deleted and everything will continue working afterwards!
</p>
]]></key>
<key alias="databaseUpgradeDone"><![CDATA[Your database has been upgraded to the final version %0%.<br />Press <strong>Next</strong> to
proceed. ]]></key>
]]>
</key>
<key alias="databaseUpgradeDone">
<![CDATA[Your database has been upgraded to the final version %0%.<br />Press <strong>Next</strong> to
proceed. ]]>
</key>
<key alias="databaseUpToDate"><![CDATA[Your current database is up-to-date!. Click <strong>next</strong> to continue the configuration wizard]]></key>
<key alias="defaultUserChangePass"><![CDATA[<strong>The Default users password needs to be changed!</strong>]]></key>
<key alias="defaultUserDisabled"><![CDATA[<strong>The Default user has been disabled or has no access to umbraco!</strong></p><p>No further actions needs to be taken. Click <b>Next</b> to proceed.]]></key>
<key alias="defaultUserPassChanged"><![CDATA[<strong>The Default user's password has been successfully changed since the installation!</strong></p><p>No further actions needs to be taken. Click <strong>Next</strong> to proceed.]]></key>
<key alias="defaultUserPasswordChanged">The password is changed!</key>
<key alias="defaultUserText"><![CDATA[
<key alias="defaultUserText">
<![CDATA[
<p>
umbraco creates a default user with a login <strong>('admin')</strong> and password <strong>('default')</strong>. It's <strong>important</strong> that the password is
changed to something unique.
@@ -375,48 +398,64 @@
<p>
This step will check the default user's password and suggest if it needs to be changed.
</p>
]]></key>
]]>
</key>
<key alias="greatStart">Get a great start, watch our introduction videos</key>
<key alias="licenseText">By clicking the next button (or modifying the umbracoConfigurationStatus in web.config), you accept the license for this software as specified in the box below. Notice that this umbraco distribution consists of two different licenses, the open source MIT license for the framework and the umbraco freeware license that covers the UI.</key>
<key alias="None">Not installed yet.</key>
<key alias="permissionsAffectedFolders">Affected files and folders</key>
<key alias="permissionsAffectedFoldersMoreInfo">More information on setting up permissions for umbraco here</key>
<key alias="permissionsAffectedFoldersText">You need to grant ASP.NET modify permissions to the following files/folders</key>
<key alias="permissionsAlmostPerfect"><![CDATA[<strong>Your permission settings are almost perfect!</strong><br /><br />
You can run umbraco without problems, but you will not be able to install packages which are recommended to take full advantage of umbraco.]]></key>
<key alias="permissionsAlmostPerfect">
<![CDATA[<strong>Your permission settings are almost perfect!</strong><br /><br />
You can run umbraco without problems, but you will not be able to install packages which are recommended to take full advantage of umbraco.]]>
</key>
<key alias="permissionsHowtoResolve">How to Resolve</key>
<key alias="permissionsHowtoResolveLink">Click here to read the text version</key>
<key alias="permissionsHowtoResolveText"><![CDATA[Watch our <strong>video tutorial</strong> on setting up folder permissions for umbraco or read the text version.]]></key>
<key alias="permissionsMaybeAnIssue"><![CDATA[<strong>Your permission settings might be an issue!</strong>
<key alias="permissionsMaybeAnIssue">
<![CDATA[<strong>Your permission settings might be an issue!</strong>
<br/><br />
You can run umbraco without problems, but you will not be able to create folders or install packages which are recommended to take full advantage of umbraco.]]></key>
<key alias="permissionsNotReady"><![CDATA[<strong>Your permission settings are not ready for umbraco!</strong>
You can run umbraco without problems, but you will not be able to create folders or install packages which are recommended to take full advantage of umbraco.]]>
</key>
<key alias="permissionsNotReady">
<![CDATA[<strong>Your permission settings are not ready for umbraco!</strong>
<br /><br />
In order to run umbraco, you'll need to update your permission settings.]]></key>
<key alias="permissionsPerfect"><![CDATA[<strong>Your permission settings are perfect!</strong><br /><br />
You are ready to run umbraco and install packages!]]></key>
In order to run umbraco, you'll need to update your permission settings.]]>
</key>
<key alias="permissionsPerfect">
<![CDATA[<strong>Your permission settings are perfect!</strong><br /><br />
You are ready to run umbraco and install packages!]]>
</key>
<key alias="permissionsResolveFolderIssues">Resolving folder issue</key>
<key alias="permissionsResolveFolderIssuesLink">Follow this link for more information on problems with ASP.NET and creating folders</key>
<key alias="permissionsSettingUpPermissions">Setting up folder permissions</key>
<key alias="permissionsText"><![CDATA[
<key alias="permissionsText">
<![CDATA[
umbraco needs write/modify access to certain directories in order to store files like pictures and PDF's.
It also stores temporary data (aka: cache) for enhancing the performance of your website.
]]></key>
]]>
</key>
<key alias="runwayFromScratch">I want to start from scratch</key>
<key alias="runwayFromScratchText"><![CDATA[
<key alias="runwayFromScratchText">
<![CDATA[
Your website is completely empty at the moment, so thats perfect if you want to start from scratch and create your own document types and templates.
(<a href="http://umbraco.tv/documentation/videos/for-site-builders/foundation/document-types">learn how</a>)
You can still choose to install Runway later on. Please go to the Developer section and choose Packages.
]]></key>
]]>
</key>
<key alias="runwayHeader">Youve just set up a clean Umbraco platform. What do you want to do next?</key>
<key alias="runwayInstalled">Runway is installed</key>
<key alias="runwayInstalledText"><![CDATA[
<key alias="runwayInstalledText">
<![CDATA[
You have the foundation in place. Select what modules you wish to install on top of it.<br />
This is our list of recommended modules, check off the ones you would like to install, or view the <a href="#" onclick="toggleModules(); return false;" id="toggleModuleList">full list of modules</a>
]]></key>
]]>
</key>
<key alias="runwayOnlyProUsers">Only recommended for experienced users</key>
<key alias="runwaySimpleSite">I want to start with a simple website</key>
<key alias="runwaySimpleSiteText"><![CDATA[
<key alias="runwaySimpleSiteText">
<![CDATA[
<p>
"Runway" is a simple website providing some basic document types and templates. The installer can set up Runway for you automatically,
but you can easily edit, extend or remove it. Its not necessary and you can perfectly use Umbraco without it. However,
@@ -427,7 +466,8 @@
<em>Included with Runway:</em> Home page, Getting Started page, Installing Modules page.<br />
<em>Optional Modules:</em> Top Navigation, Sitemap, Contact, Gallery.
</small>
]]></key>
]]>
</key>
<key alias="runwayWhatIsRunway">What is Runway</key>
<key alias="step1">Step 1/5 Accept license</key>
<key alias="step2">Step 2/5: Database configuration</key>
@@ -435,24 +475,36 @@
<key alias="step4">Step 4/5: Check umbraco security</key>
<key alias="step5">Step 5/5: Umbraco is ready to get you started</key>
<key alias="thankYou">Thank you for choosing umbraco</key>
<key alias="theEndBrowseSite"><![CDATA[<h3>Browse your new site</h3>
You installed Runway, so why not see how your new website looks.]]></key>
<key alias="theEndFurtherHelp"><![CDATA[<h3>Further help and information</h3>
Get help from our award winning community, browse the documentation or watch some free videos on how to build a simple site, how to use packages and a quick guide to the umbraco terminology]]></key>
<key alias="theEndBrowseSite">
<![CDATA[<h3>Browse your new site</h3>
You installed Runway, so why not see how your new website looks.]]>
</key>
<key alias="theEndFurtherHelp">
<![CDATA[<h3>Further help and information</h3>
Get help from our award winning community, browse the documentation or watch some free videos on how to build a simple site, how to use packages and a quick guide to the umbraco terminology]]>
</key>
<key alias="theEndHeader">Umbraco %0% is installed and ready for use</key>
<key alias="theEndInstallFailed"><![CDATA[To finish the installation, you'll need to
manually edit the <strong>/web.config file</strong> and update the AppSetting key <strong>umbracoConfigurationStatus</strong> in the bottom to the value of <strong>'%0%'</strong>.]]></key>
<key alias="theEndInstallSuccess"><![CDATA[You can get <strong>started instantly</strong> by clicking the "Launch Umbraco" button below. <br />If you are <strong>new to umbraco</strong>,
you can find plenty of resources on our getting started pages.]]></key>
<key alias="theEndOpenUmbraco"><![CDATA[<h3>Launch Umbraco</h3>
To manage your website, simply open the umbraco back office and start adding content, updating the templates and stylesheets or add new functionality]]></key>
<key alias="theEndInstallFailed">
<![CDATA[To finish the installation, you'll need to
manually edit the <strong>/web.config file</strong> and update the AppSetting key <strong>umbracoConfigurationStatus</strong> in the bottom to the value of <strong>'%0%'</strong>.]]>
</key>
<key alias="theEndInstallSuccess">
<![CDATA[You can get <strong>started instantly</strong> by clicking the "Launch Umbraco" button below. <br />If you are <strong>new to umbraco</strong>,
you can find plenty of resources on our getting started pages.]]>
</key>
<key alias="theEndOpenUmbraco">
<![CDATA[<h3>Launch Umbraco</h3>
To manage your website, simply open the umbraco back office and start adding content, updating the templates and stylesheets or add new functionality]]>
</key>
<key alias="Unavailable">Connection to database failed.</key>
<key alias="Version3">Umbraco Version 3</key>
<key alias="Version4">Umbraco Version 4</key>
<key alias="watch">Watch</key>
<key alias="welcomeIntro"><![CDATA[This wizard will guide you through the process of configuring <strong>umbraco %0%</strong> for a fresh install or upgrading from version 3.0.
<key alias="welcomeIntro">
<![CDATA[This wizard will guide you through the process of configuring <strong>umbraco %0%</strong> for a fresh install or upgrading from version 3.0.
<br /><br />
Press <strong>"next"</strong> to start the wizard.]]></key>
Press <strong>"next"</strong> to start the wizard.]]>
</key>
</area>
<area alias="language">
<key alias="cultureCode">Culture Code</key>
@@ -486,7 +538,8 @@ To manage your website, simply open the umbraco back office and start adding con
</area>
<area alias="notifications">
<key alias="editNotifications">Edit your notification for %0%</key>
<key alias="mailBody"><![CDATA[
<key alias="mailBody">
<![CDATA[
Hi %0%
This is an automated mail to inform you that the task '%1%'
@@ -498,8 +551,10 @@ To manage your website, simply open the umbraco back office and start adding con
Have a nice day!
Cheers from the umbraco robot
]]></key>
<key alias="mailBodyHtml"><![CDATA[<p>Hi %0%</p>
]]>
</key>
<key alias="mailBodyHtml">
<![CDATA[<p>Hi %0%</p>
<p>This is an automated mail to inform you that the task <strong>'%1%'</strong>
has been performed on the page <a href="%7%"><strong>'%2%'</strong></a>
@@ -529,23 +584,28 @@ To manage your website, simply open the umbraco back office and start adding con
<p>Have a nice day!<br /><br />
Cheers from the umbraco robot
</p>]]></key>
</p>]]>
</key>
<key alias="mailSubject">[%0%] Notification about %1% performed on %2%</key>
<key alias="notifications">Notifications</key>
</area>
<area alias="packager">
<key alias="chooseLocalPackageText"><![CDATA[
<key alias="chooseLocalPackageText">
<![CDATA[
Choose Package from your machine, by clicking the Browse<br />
button and locating the package. umbraco packages usually have a ".umb" or ".zip" extension.
]]></key>
]]>
</key>
<key alias="packageAuthor">Author</key>
<key alias="packageDemonstration">Demonstration</key>
<key alias="packageDocumentation">Documentation</key>
<key alias="packageMetaData">Package meta data</key>
<key alias="packageName">Package name</key>
<key alias="packageNoItemsHeader">Package doesn't contain any items</key>
<key alias="packageNoItemsText"><![CDATA[This package file doesn't contain any items to uninstall.<br/><br/>
You can safely remove this from the system by clicking "uninstall package" below.]]></key>
<key alias="packageNoItemsText">
<![CDATA[This package file doesn't contain any items to uninstall.<br/><br/>
You can safely remove this from the system by clicking "uninstall package" below.]]>
</key>
<key alias="packageNoUpgrades">No upgrades available</key>
<key alias="packageOptions">Package options</key>
<key alias="packageReadme">Package readme</key>
@@ -554,9 +614,11 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="packageUninstalledHeader">Package was uninstalled</key>
<key alias="packageUninstalledText">The package was successfully uninstalled</key>
<key alias="packageUninstallHeader">Uninstall package</key>
<key alias="packageUninstallText"><![CDATA[You can unselect items you do not wish to remove, at this time, below. When you click "confirm uninstall" all checked-off items will be removed.<br />
<key alias="packageUninstallText">
<![CDATA[You can unselect items you do not wish to remove, at this time, below. When you click "confirm uninstall" all checked-off items will be removed.<br />
<span style="color: Red; font-weight: bold;">Notice:</span> any documents, media etc depending on the items you remove, will stop working, and could lead to system instability,
so uninstall with caution. If in doubt, contact the package author.]]></key>
so uninstall with caution. If in doubt, contact the package author.]]>
</key>
<key alias="packageUpgradeDownload">Download update from the repository</key>
<key alias="packageUpgradeHeader">Upgrade package</key>
<key alias="packageUpgradeInstructions">Upgrade instructions</key>
@@ -589,18 +651,27 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="paSimpleHelp">If you just want to setup simple protection using a single login and password</key>
</area>
<area alias="publish">
<key alias="contentPublishedFailedByEvent"><![CDATA[
<key alias="contentPublishedFailedByEvent">
<![CDATA[
%0% could not be published, due to a 3rd party extension cancelling the action.
]]></key>
]]>
</key>
<key alias="contentPublishedFailedByParent">
<![CDATA[
%0% can not be published, because a parent page is not published.
]]>
</key>
<key alias="includeUnpublished">Include unpublished child pages</key>
<key alias="inProgress">Publishing in progress - please wait...</key>
<key alias="inProgressCounter">%0% out of %1% pages have been published...</key>
<key alias="nodePublish">%0% has been published</key>
<key alias="nodePublishAll">%0% and subpages have been published</key>
<key alias="publishAll">Publish %0% and all its subpages</key>
<key alias="publishHelp"><![CDATA[Click <em>ok</em> to publish <strong>%0%</strong> and thereby making it's content publicly available.<br/><br />
<key alias="publishHelp">
<![CDATA[Click <em>ok</em> to publish <strong>%0%</strong> and thereby making it's content publicly available.<br/><br />
You can publish this page and all it's sub-pages by checking <em>publish all children</em> below.
]]></key>
]]>
</key>
</area>
<area alias="relatedlinks">
<key alias="addExternal">Add external link</key>
@@ -652,6 +723,9 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="tab">Tab</key>
<key alias="tabname">Tab Title</key>
<key alias="tabs">Tabs</key>
<key alias="contentTypeEnabled">Master Content Type enabled</key>
<key alias="contentTypeUses">This Content Type uses</key>
<key alias="asAContentMasterType">as a Master Content Type. Tabs from Master Content Types are not shown and can only be edited on the Master Content Type itself</key>
</area>
<area alias="sort">
<key alias="sortDone">Sorting complete.</key>
@@ -686,7 +760,7 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="editTemplateSaved">Template saved</key>
<key alias="editUserError">Error saving user (check log)</key>
<key alias="editUserSaved">User Saved</key>
<key alias="editUserTypeSaved">User type saved</key>
<key alias="editUserTypeSaved">User type saved</key>
<key alias="fileErrorHeader">File not saved</key>
<key alias="fileErrorText">file could not be saved. Please check file permissions</key>
<key alias="fileSavedHeader">File saved</key>
@@ -732,7 +806,7 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="chooseField">Choose field</key>
<key alias="convertLineBreaks">Convert Linebreaks</key>
<key alias="convertLineBreaksHelp">Replaces linebreaks with html-tag &amp;lt;br&amp;gt;</key>
<key alias="customFields">Custom Fields</key>
<key alias="customFields">Custom Fields</key>
<key alias="dateOnly">Yes, Date only</key>
<key alias="formatAsDate">Format as date</key>
<key alias="htmlEncode">HTML encode</key>
@@ -746,7 +820,7 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="recursive">Recursive</key>
<key alias="removeParagraph">Remove Paragraph tags</key>
<key alias="removeParagraphHelp">Will remove any &amp;lt;P&amp;gt; in the beginning and end of the text</key>
<key alias="standardFields">Standard Fields</key>
<key alias="standardFields">Standard Fields</key>
<key alias="uppercase">Uppercase</key>
<key alias="urlEncode">URL encode</key>
<key alias="urlEncodeHelp">Will format special characters in URLs</key>
@@ -756,10 +830,12 @@ To manage your website, simply open the umbraco back office and start adding con
</area>
<area alias="translation">
<key alias="assignedTasks">Tasks assigned to you</key>
<key alias="assignedTasksHelp"><![CDATA[ The list below shows translation tasks <strong>assigned to you</strong>. To see a detailed view including comments, click on "Details" or just the page name.
<key alias="assignedTasksHelp">
<![CDATA[ The list below shows translation tasks <strong>assigned to you</strong>. To see a detailed view including comments, click on "Details" or just the page name.
You can also download the page as XML directly by clicking the "Download Xml" link. <br/>
To close a translation task, please go to the Details view and click the "Close" button.
]]></key>
]]>
</key>
<key alias="closeTask">close task</key>
<key alias="details">Translation details</key>
<key alias="downloadAllAsXml">Download all translation tasks as xml</key>
@@ -767,7 +843,8 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="DownloadXmlDTD">Download xml DTD</key>
<key alias="fields">Fields</key>
<key alias="includeSubpages">Include subpages</key>
<key alias="mailBody"><![CDATA[
<key alias="mailBody">
<![CDATA[
Hi %0%
This is an automated mail to inform you that the document '%1%'
@@ -781,14 +858,17 @@ To manage your website, simply open the umbraco back office and start adding con
Have a nice day!
Cheers from the umbraco robot
]]></key>
]]>
</key>
<key alias="mailSubject">[%0%] Translation task for %1%</key>
<key alias="noTranslators">No translator users found. Please create a translator user before you start sending content to translation</key>
<key alias="ownedTasks">Tasks created by you</key>
<key alias="ownedTasksHelp"><![CDATA[ The list below shows pages <strong>created by you</strong>. To see a detailed view including comments,
<key alias="ownedTasksHelp">
<![CDATA[ The list below shows pages <strong>created by you</strong>. To see a detailed view including comments,
click on "Details" or just the page name. You can also download the page as XML directly by clicking the "Download Xml" link.
To close a translation task, please go to the Details view and click the "Close" button.
]]></key>
]]>
</key>
<key alias="pageHasBeenSendToTranslation">The page '%0%' has been send to translation</key>
<key alias="sendToTranslate">Send the page '%0%' to translation</key>
<key alias="taskAssignedBy">Assigned by</key>
@@ -821,7 +901,7 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="memberType">Member Types</key>
<key alias="nodeTypes">Document Types</key>
<key alias="packager">Packages</key>
<key alias="packages">Packages</key>
<key alias="packages">Packages</key>
<key alias="python">Python Files</key>
<key alias="repositories">Install from repository</key>
<key alias="runway">Install Runway</key>
@@ -842,6 +922,8 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="administrators">Administrator</key>
<key alias="categoryField">Category field</key>
<key alias="changePassword">Change Your Password</key>
<key alias="newPassword">Change Your Password</key>
<key alias="confirmNewPassword">Confirm new password</key>
<key alias="changePasswordDescription">You can change your password for accessing the Umbraco Back Office by filling out the form below and click the 'Change Password' button</key>
<key alias="contentChannel">Content Channel</key>
<key alias="defaultToLiveEditing">Redirect to canvas on login</key>
@@ -859,9 +941,9 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="passwordChanged">Your password has been changed!</key>
<key alias="passwordConfirm">Please confirm the new password</key>
<key alias="passwordEnterNew">Enter your new password</key>
<key alias="passwordIsBlank">Your new password cannot be blank!</key>
<key alias="passwordCurrent">Current password</key>
<key alias="passwordInvalid">Invalid current password</key>
<key alias="passwordIsBlank">Your new password cannot be blank!</key>
<key alias="passwordCurrent">Current password</key>
<key alias="passwordInvalid">Invalid current password</key>
<key alias="passwordIsDifferent">There was a difference between the new password and the confirmed password. Please try again!</key>
<key alias="passwordMismatch">The confirmed password doesn't match the new password!</key>
<key alias="permissionReplaceChildren">Replace child node permssions</key>
@@ -22,6 +22,7 @@
<cc1:PropertyPanel runat="server" ID="prop_domain" Text="Domain">
<asp:TextBox ID="DomainName" runat="server" Width="252px"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="DomainName" ErrorMessage="*" ID="DomainValidator" runat="server" Display="Dynamic" />
<asp:RegularExpressionValidator ControlToValidate="DomainName" ErrorMessage="*" ID="DomainValidator2" runat="server" Display="Dynamic" />
<br /><small><%= umbraco.ui.Text("assignDomain", "domainHelp") %></small>
</cc1:PropertyPanel>
+41 -12
View File
@@ -42,6 +42,31 @@ namespace Umbraco.Web.Routing
}
}
private static bool IsWildcardDomain(Domain d)
{
// supporting null or whitespace for backward compatibility,
// although we should not allow ppl to create them anymore
return string.IsNullOrWhiteSpace(d.Name) || d.Name.StartsWith("*");
}
private static Domain SanitizeForBackwardCompatibility(Domain d)
{
// this is a _really_ nasty one that should be removed in 6.x
// some people were using hostnames such as "/en" which happened to work pre-4.10
// but make _no_ sense at all... and 4.10 throws on them, so here we just try
// to find a way so 4.11 does not throw.
// but, really.
// no.
var context = System.Web.HttpContext.Current;
if (context != null && d.Name.StartsWith("/"))
{
// turn /en into http://whatever.com/en so it becomes a parseable uri
var authority = context.Request.Url.GetLeftPart(UriPartial.Authority);
d.Name = authority + d.Name;
}
return d;
}
/// <summary>
/// Finds the domain that best matches the current uri, into an enumeration of domains.
/// </summary>
@@ -56,7 +81,8 @@ namespace Umbraco.Web.Routing
// we need to order so example.com/foo matches before example.com/
var scheme = current == null ? Uri.UriSchemeHttp : current.Scheme;
var domainsAndUris = domains
.Where(d => !string.IsNullOrEmpty(d.Name) && d.Name != "*")
.Where(d => !IsWildcardDomain(d))
.Select(d => SanitizeForBackwardCompatibility(d))
.Select(d => new { Domain = d, UriString = UriUtility.EndPathWithSlash(UriUtility.StartWithScheme(d.Name, scheme)) })
.OrderByDescending(t => t.UriString)
.Select(t => new DomainAndUri { Domain = t.Domain, Uri = new Uri(t.UriString) });
@@ -96,7 +122,8 @@ namespace Umbraco.Web.Routing
{
var scheme = current == null ? Uri.UriSchemeHttp : current.Scheme;
var domainsAndUris = domains
.Where(d => !string.IsNullOrEmpty(d.Name) && d.Name != "*")
.Where(d => !IsWildcardDomain(d))
.Select(d => SanitizeForBackwardCompatibility(d))
.Select(d => new { Domain = d, UriString = UriUtility.TrimPathEndSlash(UriUtility.StartWithScheme(d.Name, scheme)) })
.OrderByDescending(t => t.UriString)
.Select(t => new DomainAndUri { Domain = t.Domain, Uri = new Uri(t.UriString) });
@@ -112,12 +139,13 @@ namespace Umbraco.Web.Routing
public static bool ExistsDomainInPath(Domain current, string path)
{
var domains = Domain.GetDomains();
var stopNodeId = current == null ? -1 : current.RootNodeId;
return path.Split(',')
.Reverse()
.Select(id => int.Parse(id))
.TakeWhile(id => id != current.RootNodeId)
.Any(id => domains.Any(d => d.RootNodeId == id && !string.IsNullOrEmpty(d.Name) && d.Name != "*"));
.TakeWhile(id => id != stopNodeId)
.Any(id => domains.Any(d => d.RootNodeId == id && !IsWildcardDomain(d)));
}
/// <summary>
@@ -129,20 +157,21 @@ namespace Umbraco.Web.Routing
/// <returns>The deepest wildcard <see cref="Domain"/> in the path, or null.</returns>
public static Domain LookForWildcardDomain(IEnumerable<Domain> domains, string path, int? rootNodeId)
{
var nodeIds = path.Split(',').Select(p => int.Parse(p)).Reverse();
rootNodeId = rootNodeId ?? -1; // every paths begin with -1
var nodeIds = path.Split(',').Select(p => int.Parse(p)).Skip(1).Reverse();
foreach (var nodeId in nodeIds)
{
if (nodeId == rootNodeId) // stop at current domain or root
break;
// supporting null or whitespace for backward compatibility,
// although we should not allow ppl to create them anymore
var domain = domains.Where(d => d.RootNodeId == nodeId && (string.IsNullOrWhiteSpace(d.Name) || d.Name == "*")).FirstOrDefault();
var domain = domains.Where(d => d.RootNodeId == nodeId && IsWildcardDomain(d)).FirstOrDefault();
if (domain != null)
return domain;
// stop at current domain root if any
// "When you perform comparisons with nullable types, if the value of one of the nullable
// types is null and the other is not, all comparisons evaluate to false."
if (nodeId == rootNodeId)
break;
}
return null;
}
+3 -7
View File
@@ -82,13 +82,9 @@ namespace Umbraco.Web.Routing
docreq.PublishedContent = node;
LogHelper.Debug<LookupByNiceUrl>("Query matches, id={0}", () => docreq.DocumentId);
var iscanon = true;
if (docreq.HasDomain)
{
iscanon = !DomainHelper.ExistsDomainInPath(docreq.Domain, node.Path);
if (!iscanon)
LogHelper.Debug<LookupByNiceUrl>("Non canonical url");
}
var iscanon = !DomainHelper.ExistsDomainInPath(docreq.Domain, node.Path);
if (!iscanon)
LogHelper.Debug<LookupByNiceUrl>("Non canonical url");
// do not store if previewing or if non-canonical
if (!docreq.RoutingContext.UmbracoContext.InPreviewMode && iscanon)
+1 -1
View File
@@ -278,7 +278,7 @@ namespace Umbraco.Web.Routing
{
// domains were found : return absolute urls
// ignore vdir at that point
uris.AddRange(domainUris.Select(domainUri => new Uri(domainUri.GetLeftPart(UriPartial.Path).TrimEnd('/') + path)));
uris.AddRange(domainUris.Select(domainUri => new Uri(CombinePaths(domainUri.GetLeftPart(UriPartial.Path), path))));
}
// UriFromUmbraco will handle vdir
+3 -1
View File
@@ -1913,7 +1913,9 @@
<Content Include="umbraco.presentation\umbraco\developer\Packages\LoadNitros.ascx" />
<Content Include="umbraco.presentation\umbraco\developer\Packages\SubmitPackage.aspx" />
<Content Include="umbraco.presentation\umbraco\dialogs\about.aspx" />
<Content Include="umbraco.presentation\umbraco\dialogs\AssignDomain.aspx" />
<Content Include="umbraco.presentation\umbraco\dialogs\AssignDomain.aspx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\dialogs\create.aspx" />
<Content Include="umbraco.presentation\umbraco\dialogs\cruds.aspx" />
<Content Include="umbraco.presentation\umbraco\dialogs\editMacro.aspx" />
@@ -1,15 +1,16 @@
using System.IO;
using Umbraco.Core.IO;
using umbraco.BusinessLogic;
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace umbraco.presentation.install.steps
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for theend.
@@ -34,9 +35,6 @@ namespace umbraco.presentation.install.steps
if (!cms.businesslogic.skinning.Skinning.IsStarterKitInstalled())
customizeSite.Visible = false;
var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/PluginCache");
if(Directory.Exists(tempFolder))
Directory.Delete(tempFolder, true);
}
#region Web Form Designer generated code
@@ -15,7 +15,6 @@ using umbraco.interfaces;
using umbraco.BusinessLogic.Utils;
using umbraco.BusinessLogic;
using umbraco.BasePages;
using TypeFinder = umbraco.BusinessLogic.Utils.TypeFinder;
namespace umbraco.cms.presentation.Trees
{
@@ -152,12 +151,11 @@ namespace umbraco.cms.presentation.Trees
l.UpgradeToWriteLock();
List<Type> foundITrees = TypeFinder.FindClassesOfType<ITree>();
//var foundITrees = PluginManager.Current.ResolveTrees();
var foundITrees = PluginManager.Current.ResolveTrees();
var objTrees = ApplicationTree.getAll();
List<ApplicationTree> appTrees = new List<ApplicationTree>();
//var appTrees = new List<ApplicationTree>();
var appTrees = new List<ApplicationTree>();
appTrees.AddRange(objTrees);
var apps = Application.getAll();
@@ -22,6 +22,7 @@
<cc1:PropertyPanel runat="server" ID="prop_domain" Text="Domain">
<asp:TextBox ID="DomainName" runat="server" Width="252px"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="DomainName" ErrorMessage="*" ID="DomainValidator" runat="server" Display="Dynamic" />
<asp:RegularExpressionValidator ControlToValidate="DomainName" ErrorMessage="*" ID="DomainValidator2" runat="server" Display="Dynamic" />
<br /><small><%= umbraco.ui.Text("assignDomain", "domainHelp") %></small>
</cc1:PropertyPanel>
@@ -50,7 +50,7 @@ namespace umbraco.dialogs
{
Domain d = new Domain(editDomain);
selectedLanguage = d.Language.id;
DomainName.Text = d.Name;
DomainName.Text = d.Name.StartsWith("*") ? "*" : d.Name;
ok.Text = ui.Text("general", "update", base.getUser());
}
@@ -58,6 +58,10 @@ namespace umbraco.dialogs
LanguageValidator.ErrorMessage = ui.Text("defaultdialogs", "requiredField", base.getUser()) + "<br/>";
DomainValidator.ErrorMessage = ui.Text("defaultdialogs", "requiredField", base.getUser());
DomainValidator2.ErrorMessage = ui.Text("assignDomain", "invalidDomain", base.getUser());
//DomainValidator2.ValidationExpression = @"^(?i:http[s]?://)?([-\w]+(\.[-\w]+)*)(:\d+)?(/[-\w]*)?$";
DomainValidator2.ValidationExpression = @"^(\*|((?i:http[s]?://)?([-\w]+(\.[-\w]+)*)(:\d+)?(/[-\w]*)?))$";
Languages.Items.Add(new ListItem(ui.Text("general", "choose", base.getUser()), ""));
foreach (Language l in Language.getAll)
{
@@ -82,7 +86,8 @@ namespace umbraco.dialogs
allDomains.Text = "<table border=\"0\" cellspacing=\"10\">";
foreach (Domain d in domainList) {
allDomains.Text += "<tr><td>" + d.Name + "</td><td>(" + d.Language.CultureAlias + ")</td><td><a href=\"?id=" + currentID + "&editDomain=" +
var name = d.Name.StartsWith("*") ? "*" : d.Name;
allDomains.Text += "<tr><td>" + name + "</td><td>(" + d.Language.CultureAlias + ")</td><td><a href=\"?id=" + currentID + "&editDomain=" +
d.Id.ToString() + "\">" + ui.Text("edit") + "</a></td><td><a href=\"?id=" + currentID +
"&delDomain=" + d.Id.ToString() + "\" onClick=\"return confirm('" +
ui.Text("defaultdialogs", "confirmdelete", base.getUser()) +
@@ -120,11 +125,14 @@ namespace umbraco.dialogs
}
else
{
if( !Domain.Exists(DomainName.Text.ToLower())) {
Domain.MakeNew(DomainName.Text, currentID, int.Parse(Languages.SelectedValue));
FeedBackMessage.Text = ui.Text("assignDomain", "domainCreated", DomainName.Text, base.getUser());
// have to handle wildcard
var domainName = DomainName.Text.Trim();
domainName = domainName == "*" ? ("*" + currentID.ToString()) : domainName;
if (!Domain.Exists(domainName.ToLower()))
{
Domain.MakeNew(domainName, currentID, int.Parse(Languages.SelectedValue));
FeedBackMessage.Text = ui.Text("assignDomain", "domainCreated", domainName, base.getUser());
FeedBackMessage.type = umbraco.uicontrols.Feedback.feedbacktype.success;
DomainName.Text = "";
@@ -134,7 +142,7 @@ namespace umbraco.dialogs
//this is probably the worst webform I've ever seen...
Response.Redirect("AssignDomain.aspx?id=" + currentID.ToString());
} else {
FeedBackMessage.Text = ui.Text("assignDomain", "domainExists", DomainName.Text, base.getUser());
FeedBackMessage.Text = ui.Text("assignDomain", "domainExists", DomainName.Text.Trim(), base.getUser());
FeedBackMessage.type = umbraco.uicontrols.Feedback.feedbacktype.error;
}
}
@@ -57,6 +57,15 @@ namespace umbraco.dialogs {
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator DomainValidator;
/// <summary>
/// DomainValidator2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RegularExpressionValidator DomainValidator2;
/// <summary>
/// prop_lang control.
/// </summary>
@@ -31,7 +31,7 @@ namespace umbraco.BusinessLogic
public ApplicationTreeRegistrar()
{
//don't do anything if the application is not configured!
if (!ApplicationContext.Current.IsConfigured)
if (ApplicationContext.Current == null || !ApplicationContext.Current.IsConfigured)
return;
// Load all Trees by attribute and add them to the XML config
@@ -13,7 +13,8 @@ using ICSharpCode.SharpZipLib;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Zip.Compression;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using Umbraco.Core;
using Umbraco.Core.Logging;
using umbraco.cms.businesslogic.web;
using umbraco.cms.businesslogic.propertytype;
using umbraco.BusinessLogic;
@@ -76,7 +77,7 @@ namespace umbraco.cms.businesslogic.packager
public bool ContainsMacroConflict { get { return _containsMacroConflict; } }
public IDictionary<string, string> ConflictingMacroAliases { get { return _conflictingMacroAliases; } }
public bool ContainsUnsecureFiles { get { return _containUnsecureFiles; } }
public List<string> UnsecureFiles { get { return _unsecureFiles; } }
@@ -145,7 +146,7 @@ namespace umbraco.cms.businesslogic.packager
_macros.Add(MacroToAdd);
}
/// <summary>
/// Imports the specified package
@@ -154,33 +155,39 @@ namespace umbraco.cms.businesslogic.packager
/// <returns></returns>
public string Import(string InputFile)
{
string tempDir = "";
if (File.Exists(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile)))
using (DisposableTimer.DebugDuration<Installer>(
() => "Importing package file " + InputFile,
() => "Package file " + InputFile + "imported"))
{
FileInfo fi = new FileInfo(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile));
// Check if the file is a valid package
if (fi.Extension.ToLower() == ".umb")
string tempDir = "";
if (File.Exists(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile)))
{
try
FileInfo fi = new FileInfo(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile));
// Check if the file is a valid package
if (fi.Extension.ToLower() == ".umb")
{
tempDir = unPack(fi.FullName);
LoadConfig(tempDir);
}
catch (Exception unpackE)
{
throw new Exception("Error unpacking extension...", unpackE);
try
{
tempDir = unPack(fi.FullName);
LoadConfig(tempDir);
}
catch (Exception unpackE)
{
throw new Exception("Error unpacking extension...", unpackE);
}
}
else
throw new Exception("Error - file isn't a package (doesn't have a .umb extension). Check if the file automatically got named '.zip' upon download.");
}
else
throw new Exception("Error - file isn't a package (doesn't have a .umb extension). Check if the file automatically got named '.zip' upon download.");
throw new Exception("Error - file not found. Could find file named '" + IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile) + "'");
return tempDir;
}
else
throw new Exception("Error - file not found. Could find file named '" + IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile) + "'");
return tempDir;
}
public int CreateManifest(string tempDir, string guid, string repoGuid) {
public int CreateManifest(string tempDir, string guid, string repoGuid)
{
//This is the new improved install rutine, which chops up the process into 3 steps, creating the manifest, moving files, and finally handling umb objects
string _packName = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/name"));
string _packAuthor = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/name"));
@@ -216,225 +223,268 @@ namespace umbraco.cms.businesslogic.packager
insPack.Data.PackageGuid = guid; //the package unique key.
insPack.Data.RepositoryGuid = repoGuid; //the repository unique key, if the package is a file install, the repository will not get logged.
insPack.Save();
return insPack.Data.Id;
}
public void InstallFiles(int packageId, string tempDir) {
public void InstallFiles(int packageId, string tempDir)
{
using (DisposableTimer.DebugDuration<Installer>(
() => "Installing package files for package id " + packageId + " into temp folder " + tempDir,
() => "Package file installation complete for package id " + packageId))
{
//retrieve the manifest to continue installation
packager.InstalledPackage insPack = packager.InstalledPackage.GetById(packageId);
//retrieve the manifest to continue installation
packager.InstalledPackage insPack = packager.InstalledPackage.GetById(packageId);
// Move files
//string virtualBasePath = System.Web.HttpContext.Current.Request.ApplicationPath;
string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
// Move files
//string virtualBasePath = System.Web.HttpContext.Current.Request.ApplicationPath;
string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//file"))
{
//we enclose the whole file-moving to ensure that the entire installer doesn't crash
try
{
String destPath = getFileName(basePath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
String sourceFile = getFileName(tempDir, xmlHelper.GetNodeValue(n.SelectSingleNode("guid")));
String destFile = getFileName(destPath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//file")) {
//we enclose the whole file-moving to ensure that the entire installer doesn't crash
try {
String destPath = getFileName(basePath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
String sourceFile = getFileName(tempDir, xmlHelper.GetNodeValue(n.SelectSingleNode("guid")));
String destFile = getFileName(destPath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
// Create the destination directory if it doesn't exist
if (!Directory.Exists(destPath))
Directory.CreateDirectory(destPath);
//If a file with this name exists, delete it
else if (File.Exists(destFile))
File.Delete(destFile);
// Create the destination directory if it doesn't exist
if (!Directory.Exists(destPath))
Directory.CreateDirectory(destPath);
//If a file with this name exists, delete it
else if (File.Exists(destFile))
File.Delete(destFile);
// Move the file
File.Move(sourceFile, destFile);
// Move the file
File.Move(sourceFile, destFile);
//PPH log file install
insPack.Data.Files.Add(xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")) + "/" + xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
} catch (Exception ex) {
Log.Add(LogTypes.Error, -1, "Package install error: " + ex.ToString());
//PPH log file install
insPack.Data.Files.Add(xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")) + "/" + xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
}
catch (Exception ex)
{
Log.Add(LogTypes.Error, -1, "Package install error: " + ex.ToString());
}
}
}
insPack.Save();
insPack.Save();
}
}
public void InstallBusinessLogic(int packageId, string tempDir) {
//retrieve the manifest to continue installation
packager.InstalledPackage insPack = packager.InstalledPackage.GetById(packageId);
bool saveNeeded = false;
public void InstallBusinessLogic(int packageId, string tempDir)
{
//Install DataTypes
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//DataType")) {
cms.businesslogic.datatype.DataTypeDefinition newDtd = cms.businesslogic.datatype.DataTypeDefinition.Import(n);
using (DisposableTimer.DebugDuration<Installer>(
() => "Installing business logic for package id " + packageId + " into temp folder " + tempDir,
() => "Package business logic installation complete for package id " + packageId))
{
//retrieve the manifest to continue installation
packager.InstalledPackage insPack = packager.InstalledPackage.GetById(packageId);
bool saveNeeded = false;
if (newDtd != null) {
insPack.Data.DataTypes.Add(newDtd.Id.ToString());
saveNeeded = true;
}
}
//Install DataTypes
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//DataType"))
{
cms.businesslogic.datatype.DataTypeDefinition newDtd = cms.businesslogic.datatype.DataTypeDefinition.Import(n);
if (saveNeeded) {insPack.Save(); saveNeeded = false;}
//Install languages
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//Language")) {
language.Language newLang = language.Language.Import(n);
if (newLang != null) {
insPack.Data.Languages.Add(newLang.id.ToString());
saveNeeded = true;
}
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
//Install dictionary items
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("./DictionaryItems/DictionaryItem")) {
Dictionary.DictionaryItem newDi = Dictionary.DictionaryItem.Import(n);
if (newDi != null) {
insPack.Data.DictionaryItems.Add(newDi.id.ToString());
saveNeeded = true;
}
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Install macros
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//macro")) {
cms.businesslogic.macro.Macro m = cms.businesslogic.macro.Macro.Import(n);
if (m != null) {
insPack.Data.Macros.Add(m.Id.ToString());
saveNeeded = true;
}
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Get current user, with a fallback
User u = new User(0);
if (!string.IsNullOrEmpty(BasePages.UmbracoEnsuredPage.umbracoUserContextID)) {
if (BasePages.UmbracoEnsuredPage.ValidateUserContextID(BasePages.UmbracoEnsuredPage.umbracoUserContextID)) {
u = User.GetCurrent();
}
}
// Add Templates
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Templates/Template")) {
var t = Template.Import(n, u);
insPack.Data.Templates.Add(t.Id.ToString());
saveNeeded = true;
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
//NOTE: SD: I'm pretty sure the only thing the below script does is ensure that the Master template Id is set
// in the database, but this is also duplicating the saving of the design content since the above Template.Import
// already does this. I've left this for now because I'm not sure the reprocussions of removing it but seems there
// is a lot of excess database calls happening here.
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Templates/Template")) {
string master = xmlHelper.GetNodeValue(n.SelectSingleNode("Master"));
template.Template t = template.Template.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Alias")));
if (master.Trim() != "") {
template.Template masterTemplate = template.Template.GetByAlias(master);
if (masterTemplate != null) {
t.MasterTemplate = template.Template.GetByAlias(master).Id;
//SD: This appears to always just save an empty template because the design isn't set yet
// this fixes an issue now that we have MVC because if there is an empty template and MVC is
// the default, it will create a View not a master page and then the system will try to route via
// MVC which means that the package will not work anymore.
// The code below that imports the templates should suffice because it's actually importing
// template data not just blank data.
//if (UmbracoSettings.UseAspNetMasterPages)
// t.SaveMasterPageFile(t.Design);
if (newDtd != null)
{
insPack.Data.DataTypes.Add(newDtd.Id.ToString());
saveNeeded = true;
}
}
// Master templates can only be generated when their master is known
if (UmbracoSettings.UseAspNetMasterPages) {
t.ImportDesign(xmlHelper.GetNodeValue(n.SelectSingleNode("Design")));
t.SaveMasterPageFile(t.Design);
}
}
// Add documenttypes
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("DocumentTypes/DocumentType")) {
ImportDocumentType(n, u, false);
saveNeeded = true;
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
//Install languages
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//Language"))
{
language.Language newLang = language.Language.Import(n);
// Add documenttype structure
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("DocumentTypes/DocumentType")) {
DocumentType dt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Alias")));
if (dt != null) {
ArrayList allowed = new ArrayList();
foreach (XmlNode structure in n.SelectNodes("Structure/DocumentType")) {
DocumentType dtt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(structure));
if(dtt != null)
allowed.Add(dtt.Id);
if (newLang != null)
{
insPack.Data.Languages.Add(newLang.id.ToString());
saveNeeded = true;
}
}
int[] adt = new int[allowed.Count];
for (int i = 0; i < allowed.Count; i++)
adt[i] = (int)allowed[i];
dt.AllowedChildContentTypeIDs = adt;
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
//Install dictionary items
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("./DictionaryItems/DictionaryItem"))
{
Dictionary.DictionaryItem newDi = Dictionary.DictionaryItem.Import(n);
if (newDi != null)
{
insPack.Data.DictionaryItems.Add(newDi.id.ToString());
saveNeeded = true;
}
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Install macros
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//macro"))
{
cms.businesslogic.macro.Macro m = cms.businesslogic.macro.Macro.Import(n);
if (m != null)
{
insPack.Data.Macros.Add(m.Id.ToString());
saveNeeded = true;
}
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Get current user, with a fallback
User u = new User(0);
if (!string.IsNullOrEmpty(BasePages.UmbracoEnsuredPage.umbracoUserContextID))
{
if (BasePages.UmbracoEnsuredPage.ValidateUserContextID(BasePages.UmbracoEnsuredPage.umbracoUserContextID))
{
u = User.GetCurrent();
}
}
// Add Templates
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Templates/Template"))
{
var t = Template.Import(n, u);
insPack.Data.Templates.Add(t.Id.ToString());
//PPH we log the document type install here.
insPack.Data.Documenttypes.Add(dt.Id.ToString());
saveNeeded = true;
}
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Stylesheets
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Stylesheets/Stylesheet")) {
StyleSheet s = StyleSheet.Import(n, u);
insPack.Data.Stylesheets.Add(s.Id.ToString());
saveNeeded = true;
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Documents
foreach (XmlElement n in _packageConfig.DocumentElement.SelectNodes("Documents/DocumentSet [@importMode = 'root']/*")) {
insPack.Data.ContentNodeId = cms.businesslogic.web.Document.Import(-1, u, n).ToString();
}
//Package Actions
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action")) {
if (n.Attributes["undo"] == null || n.Attributes["undo"].Value == "true") {
insPack.Data.Actions += n.OuterXml;
Log.Add(LogTypes.Debug, -1, HttpUtility.HtmlEncode(n.OuterXml));
}
if (n.Attributes["runat"] != null && n.Attributes["runat"].Value == "install") {
try {
packager.PackageAction.RunPackageAction(insPack.Data.Name, n.Attributes["alias"].Value, n);
} catch {
//NOTE: SD: I'm pretty sure the only thing the below script does is ensure that the Master template Id is set
// in the database, but this is also duplicating the saving of the design content since the above Template.Import
// already does this. I've left this for now because I'm not sure the reprocussions of removing it but seems there
// is a lot of excess database calls happening here.
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Templates/Template"))
{
string master = xmlHelper.GetNodeValue(n.SelectSingleNode("Master"));
template.Template t = template.Template.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Alias")));
if (master.Trim() != "")
{
template.Template masterTemplate = template.Template.GetByAlias(master);
if (masterTemplate != null)
{
t.MasterTemplate = template.Template.GetByAlias(master).Id;
//SD: This appears to always just save an empty template because the design isn't set yet
// this fixes an issue now that we have MVC because if there is an empty template and MVC is
// the default, it will create a View not a master page and then the system will try to route via
// MVC which means that the package will not work anymore.
// The code below that imports the templates should suffice because it's actually importing
// template data not just blank data.
//if (UmbracoSettings.UseAspNetMasterPages)
// t.SaveMasterPageFile(t.Design);
}
}
// Master templates can only be generated when their master is known
if (UmbracoSettings.UseAspNetMasterPages)
{
t.ImportDesign(xmlHelper.GetNodeValue(n.SelectSingleNode("Design")));
t.SaveMasterPageFile(t.Design);
}
}
// Add documenttypes
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("DocumentTypes/DocumentType"))
{
ImportDocumentType(n, u, false);
saveNeeded = true;
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Add documenttype structure
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("DocumentTypes/DocumentType"))
{
DocumentType dt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Alias")));
if (dt != null)
{
ArrayList allowed = new ArrayList();
foreach (XmlNode structure in n.SelectNodes("Structure/DocumentType"))
{
DocumentType dtt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(structure));
if (dtt != null)
allowed.Add(dtt.Id);
}
int[] adt = new int[allowed.Count];
for (int i = 0; i < allowed.Count; i++)
adt[i] = (int)allowed[i];
dt.AllowedChildContentTypeIDs = adt;
//PPH we log the document type install here.
insPack.Data.Documenttypes.Add(dt.Id.ToString());
saveNeeded = true;
}
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Stylesheets
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Stylesheets/Stylesheet"))
{
StyleSheet s = StyleSheet.Import(n, u);
insPack.Data.Stylesheets.Add(s.Id.ToString());
saveNeeded = true;
}
if (saveNeeded) { insPack.Save(); saveNeeded = false; }
// Documents
foreach (XmlElement n in _packageConfig.DocumentElement.SelectNodes("Documents/DocumentSet [@importMode = 'root']/*"))
{
insPack.Data.ContentNodeId = cms.businesslogic.web.Document.Import(-1, u, n).ToString();
}
//Package Actions
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action"))
{
if (n.Attributes["undo"] == null || n.Attributes["undo"].Value == "true")
{
insPack.Data.Actions += n.OuterXml;
Log.Add(LogTypes.Debug, -1, HttpUtility.HtmlEncode(n.OuterXml));
}
if (n.Attributes["runat"] != null && n.Attributes["runat"].Value == "install")
{
try
{
packager.PackageAction.RunPackageAction(insPack.Data.Name, n.Attributes["alias"].Value, n);
}
catch
{
}
}
}
// Trigger update of Apps / Trees config.
// (These are ApplicationStartupHandlers so just instantiating them will trigger them)
new ApplicationRegistrar();
new ApplicationTreeRegistrar();
insPack.Save();
}
// Trigger update of Apps / Trees config.
// (These are ApplicationStartupHandlers so just instantiating them will trigger them)
new ApplicationRegistrar();
new ApplicationTreeRegistrar();
insPack.Save();
}
public void InstallCleanUp(int packageId, string tempDir) {
public void InstallCleanUp(int packageId, string tempDir)
{
//this will contain some logic to clean up all those old folders
@@ -448,12 +498,12 @@ namespace umbraco.cms.businesslogic.packager
{
//PPH added logging of installs, this adds all install info in the installedPackages config file.
string _packName = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/name"));
string _packAuthor= xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/name"));
string _packAuthor = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/name"));
string _packAuthorUrl = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/website"));
string _packVersion = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/version"));
string _packReadme = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/readme"));
string _packLicense = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/license "));
//Create a new package instance to record all the installed package adds - this is the same format as the created packages has.
//save the package meta data
@@ -465,10 +515,11 @@ namespace umbraco.cms.businesslogic.packager
insPack.Data.License = _packLicense;
insPack.Data.PackageGuid = guid; //the package unique key.
insPack.Data.RepositoryGuid = repoGuid; //the repository unique key, if the package is a file install, the repository will not get logged.
//Install languages
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//Language")) {
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//Language"))
{
language.Language newLang = language.Language.Import(n);
if (newLang != null)
@@ -476,11 +527,12 @@ namespace umbraco.cms.businesslogic.packager
}
//Install dictionary items
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("./DictionaryItems/DictionaryItem")) {
Dictionary.DictionaryItem newDi = Dictionary.DictionaryItem.Import(n);
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("./DictionaryItems/DictionaryItem"))
{
Dictionary.DictionaryItem newDi = Dictionary.DictionaryItem.Import(n);
if (newDi != null)
insPack.Data.DictionaryItems.Add(newDi.id.ToString());
if (newDi != null)
insPack.Data.DictionaryItems.Add(newDi.id.ToString());
}
// Install macros
@@ -488,7 +540,7 @@ namespace umbraco.cms.businesslogic.packager
{
cms.businesslogic.macro.Macro m = cms.businesslogic.macro.Macro.Import(n);
if(m != null)
if (m != null)
insPack.Data.Macros.Add(m.Id.ToString());
}
@@ -523,8 +575,8 @@ namespace umbraco.cms.businesslogic.packager
template.Template t = template.Template.MakeNew(xmlHelper.GetNodeValue(n.SelectSingleNode("Name")), u);
t.Alias = xmlHelper.GetNodeValue(n.SelectSingleNode("Alias"));
t.ImportDesign( xmlHelper.GetNodeValue(n.SelectSingleNode("Design")) );
t.ImportDesign(xmlHelper.GetNodeValue(n.SelectSingleNode("Design")));
insPack.Data.Templates.Add(t.Id.ToString());
}
@@ -536,14 +588,16 @@ namespace umbraco.cms.businesslogic.packager
if (master.Trim() != "")
{
template.Template masterTemplate = template.Template.GetByAlias(master);
if (masterTemplate != null) {
if (masterTemplate != null)
{
t.MasterTemplate = template.Template.GetByAlias(master).Id;
if (UmbracoSettings.UseAspNetMasterPages)
t.SaveMasterPageFile(t.Design);
}
}
// Master templates can only be generated when their master is known
if (UmbracoSettings.UseAspNetMasterPages) {
if (UmbracoSettings.UseAspNetMasterPages)
{
t.ImportDesign(xmlHelper.GetNodeValue(n.SelectSingleNode("Design")));
t.SaveMasterPageFile(t.Design);
}
@@ -602,27 +656,32 @@ namespace umbraco.cms.businesslogic.packager
}
// Documents
foreach (XmlElement n in _packageConfig.DocumentElement.SelectNodes("Documents/DocumentSet [@importMode = 'root']/*")) {
foreach (XmlElement n in _packageConfig.DocumentElement.SelectNodes("Documents/DocumentSet [@importMode = 'root']/*"))
{
cms.businesslogic.web.Document.Import(-1, u, n);
//PPH todo log document install...
}
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action [@runat != 'uninstall']")) {
try {
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action [@runat != 'uninstall']"))
{
try
{
packager.PackageAction.RunPackageAction(_packName, n.Attributes["alias"].Value, n);
} catch { }
}
catch { }
}
//saving the uninstall actions untill the package is uninstalled.
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action [@undo != false()]")) {
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action [@undo != false()]"))
{
insPack.Data.Actions += n.OuterXml;
}
insPack.Save();
}
public static void ImportDocumentType(XmlNode n, BusinessLogic.User u, bool ImportStructure)
@@ -633,7 +692,7 @@ namespace umbraco.cms.businesslogic.packager
dt = DocumentType.MakeNew(u, xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Name")));
dt.Alias = xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Alias"));
//Master content type
DocumentType mdt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Master")));
if (mdt != null)
@@ -644,7 +703,7 @@ namespace umbraco.cms.businesslogic.packager
dt.Text = xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Name"));
}
// Info
dt.IconUrl = xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Icon"));
dt.Thumbnail = xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Thumbnail"));
@@ -688,7 +747,7 @@ namespace umbraco.cms.businesslogic.packager
for (int t = 0; t < tabs.Length; t++)
tabNames += tabs[t].Caption + ";";
Hashtable ht = new Hashtable();
foreach (XmlNode t in n.SelectNodes("Tabs/Tab"))
@@ -712,19 +771,24 @@ namespace umbraco.cms.businesslogic.packager
// Generic Properties
datatype.controls.Factory f = new datatype.controls.Factory();
foreach (XmlNode gp in n.SelectNodes("GenericProperties/GenericProperty"))
{
{
int dfId = 0;
Guid dtId = new Guid(xmlHelper.GetNodeValue(gp.SelectSingleNode("Type")));
if (gp.SelectSingleNode("Definition") != null && !string.IsNullOrEmpty(xmlHelper.GetNodeValue(gp.SelectSingleNode("Definition")))) {
if (gp.SelectSingleNode("Definition") != null && !string.IsNullOrEmpty(xmlHelper.GetNodeValue(gp.SelectSingleNode("Definition"))))
{
Guid dtdId = new Guid(xmlHelper.GetNodeValue(gp.SelectSingleNode("Definition")));
if (CMSNode.IsNode(dtdId))
dfId = new CMSNode(dtdId).Id;
}
if (dfId == 0) {
try {
}
if (dfId == 0)
{
try
{
dfId = findDataTypeDefinitionFromType(ref dtId);
} catch {
}
catch
{
throw new Exception(String.Format("Could not find datatype with id {0}.", dtId));
}
}
@@ -820,22 +884,22 @@ namespace umbraco.cms.businesslogic.packager
//to support virtual dirs we try to lookup the file...
path = IOHelper.FindFile(path);
Debug.Assert(path != null && path.Length >= 1);
Debug.Assert(fileName != null && fileName.Length >= 1);
path = path.Replace('/', '\\');
fileName = fileName.Replace('/','\\');
fileName = fileName.Replace('/', '\\');
// Does filename start with a slash? Does path end with one?
bool fileNameStartsWithSlash = (fileName[0] == Path.DirectorySeparatorChar);
bool pathEndsWithSlash = (path[path.Length-1] == Path.DirectorySeparatorChar);
bool pathEndsWithSlash = (path[path.Length - 1] == Path.DirectorySeparatorChar);
// Path ends with a slash
if (pathEndsWithSlash)
{
if(!fileNameStartsWithSlash)
if (!fileNameStartsWithSlash)
// No double slash, just concatenate
return path + fileName;
else
@@ -884,27 +948,29 @@ namespace umbraco.cms.businesslogic.packager
_reqPatch = int.Parse(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/patch").FirstChild.Value);
_authorName = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/name").FirstChild.Value;
_authorUrl = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/website").FirstChild.Value;
string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//file")) {
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//file"))
{
bool badFile = false;
string destPath = getFileName(basePath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
string destFile = getFileName(destPath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
if (destPath.ToLower().Contains( IOHelper.DirSepChar + "app_code"))
if (destPath.ToLower().Contains(IOHelper.DirSepChar + "app_code"))
badFile = true;
if (destPath.ToLower().Contains(IOHelper.DirSepChar + "bin"))
if (destPath.ToLower().Contains(IOHelper.DirSepChar + "bin"))
badFile = true;
if (destFile.ToLower().EndsWith(".dll"))
badFile = true;
if (destFile.ToLower().EndsWith(".dll"))
badFile = true;
if (badFile) {
_containUnsecureFiles = true;
_unsecureFiles.Add(xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
}
if (badFile)
{
_containUnsecureFiles = true;
_unsecureFiles.Add(xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
}
}
//this will check for existing macros with the same alias
@@ -1028,7 +1094,8 @@ namespace umbraco.cms.businesslogic.packager
}
public static void updatePackageInfo(Guid Package, int VersionMajor, int VersionMinor, int VersionPatch, User User) {
public static void updatePackageInfo(Guid Package, int VersionMajor, int VersionMinor, int VersionPatch, User User)
{
}
}
@@ -1109,7 +1176,7 @@ namespace umbraco.cms.businesslogic.packager
if (Id == 0)
{
// The method is synchronized
SqlHelper.ExecuteNonQuery("INSERT INTO umbracoInstalledPackages (uninstalled, upgradeId, installDate, userId, versionMajor, versionMinor, versionPatch) VALUES (@uninstalled, @upgradeId, @installDate, @userId, @versionMajor, @versionMinor, @versionPatch)",values);
SqlHelper.ExecuteNonQuery("INSERT INTO umbracoInstalledPackages (uninstalled, upgradeId, installDate, userId, versionMajor, versionMinor, versionPatch) VALUES (@uninstalled, @upgradeId, @installDate, @userId, @versionMajor, @versionMinor, @versionPatch)", values);
Id = SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM umbracoInstalledPackages");
}
@@ -1133,7 +1200,7 @@ namespace umbraco.cms.businesslogic.packager
get { return _uninstalled; }
set { _uninstalled = value; }
}
private User _user;
@@ -1142,7 +1209,7 @@ namespace umbraco.cms.businesslogic.packager
get { return _user; }
set { _user = value; }
}
private DateTime _installDate;
@@ -1151,7 +1218,7 @@ namespace umbraco.cms.businesslogic.packager
get { return _installDate; }
set { _installDate = value; }
}
private int _id;
@@ -1160,7 +1227,7 @@ namespace umbraco.cms.businesslogic.packager
get { return _id; }
set { _id = value; }
}
private int _upgradeId;
@@ -1169,7 +1236,7 @@ namespace umbraco.cms.businesslogic.packager
get { return _upgradeId; }
set { _upgradeId = value; }
}
private Guid _packageId;
@@ -1178,7 +1245,7 @@ namespace umbraco.cms.businesslogic.packager
get { return _packageId; }
set { _packageId = value; }
}
private int _versionPatch;
@@ -1187,7 +1254,7 @@ namespace umbraco.cms.businesslogic.packager
get { return _versionPatch; }
set { _versionPatch = value; }
}
private int _versionMinor;
@@ -1196,7 +1263,7 @@ namespace umbraco.cms.businesslogic.packager
get { return _versionMinor; }
set { _versionMinor = value; }
}
private int _versionMajor;
@@ -1207,6 +1274,6 @@ namespace umbraco.cms.businesslogic.packager
}
}
}
@@ -32,7 +32,7 @@ namespace umbraco.cms.businesslogic.template
if (!File.Exists(GetFilePath(t)) || overWrite)
{
masterpageContent = CreateDefaultMasterPageContent(t, t.Alias);
saveDesignToFile(t, null, masterpageContent);
SaveDesignToFile(t, null, masterpageContent);
}
else
{
@@ -59,9 +59,9 @@ namespace umbraco.cms.businesslogic.template
internal static string UpdateMasterPageFile(Template t, string currentAlias)
{
var template = updateMasterPageContent(t, currentAlias);
updateChildTemplates(t, currentAlias);
saveDesignToFile(t, currentAlias, template);
var template = UpdateMasterPageContent(t, currentAlias);
UpdateChildTemplates(t, currentAlias);
SaveDesignToFile(t, currentAlias, template);
return template;
}
@@ -137,7 +137,7 @@ namespace umbraco.cms.businesslogic.template
* */
}
internal static string updateMasterPageContent(Template template, string currentAlias)
internal static string UpdateMasterPageContent(Template template, string currentAlias)
{
var masterPageContent = template.Design;
@@ -174,7 +174,7 @@ namespace umbraco.cms.businesslogic.template
return masterPageContent;
}
private static void updateChildTemplates(Template t, string currentAlias)
private static void UpdateChildTemplates(Template t, string currentAlias)
{
//if we have a Old Alias if the alias and therefor the masterpage file name has changed...
//so before we save the new masterfile, we'll clear the old one, so we don't up with
@@ -192,7 +192,7 @@ namespace umbraco.cms.businesslogic.template
}
private static void saveDesignToFile(Template t, string currentAlias, string design)
private static void SaveDesignToFile(Template t, string currentAlias, string design)
{
//kill the old file..
if (!string.IsNullOrEmpty(currentAlias) && currentAlias != t.Alias)
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Text;
using Umbraco.Core.IO;
@@ -27,7 +25,7 @@ namespace umbraco.cms.businesslogic.template
if (File.Exists(path))
{
System.IO.TextReader tr = new StreamReader(path);
TextReader tr = new StreamReader(path);
viewContent = tr.ReadToEnd();
tr.Close();
}
@@ -37,14 +35,14 @@ namespace umbraco.cms.businesslogic.template
internal static string CreateViewFile(Template t, bool overWrite = false)
{
string viewContent = "";
string viewContent;
string path = IOHelper.MapPath(ViewPath(t.Alias));
if (!File.Exists(path) || overWrite)
if (File.Exists(path) == false || overWrite)
viewContent = SaveTemplateToFile(t, t.Alias);
else
{
System.IO.TextReader tr = new StreamReader(path);
TextReader tr = new StreamReader(path);
viewContent = tr.ReadToEnd();
tr.Close();
}
@@ -55,7 +53,7 @@ namespace umbraco.cms.businesslogic.template
internal static string SaveTemplateToFile(Template template, string currentAlias)
{
var design = EnsureInheritedLayout(template);
System.IO.File.WriteAllText(IOHelper.MapPath(ViewPath(template.Alias)), design, Encoding.UTF8);
File.WriteAllText(IOHelper.MapPath(ViewPath(template.Alias)), design, Encoding.UTF8);
return template.Design;
}
@@ -64,7 +62,7 @@ namespace umbraco.cms.businesslogic.template
{
var path = IOHelper.MapPath(ViewPath(t.Alias));
if (!string.IsNullOrEmpty(currentAlias) && currentAlias != t.Alias)
if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != t.Alias)
{
//NOTE: I don't think this is needed for MVC, this was ported over from the
// masterpages helper but I think only relates to when templates are stored in the db.
@@ -78,31 +76,29 @@ namespace umbraco.cms.businesslogic.template
//then kill the old file..
var oldFile = IOHelper.MapPath(ViewPath(currentAlias));
if (System.IO.File.Exists(oldFile))
System.IO.File.Delete(oldFile);
if (File.Exists(oldFile))
File.Delete(oldFile);
}
System.IO.File.WriteAllText(path, t.Design, Encoding.UTF8);
File.WriteAllText(path, t.Design, Encoding.UTF8);
return t.Design;
}
internal static void RemoveViewFile(string alias)
{
if (!string.IsNullOrWhiteSpace(alias))
if (string.IsNullOrWhiteSpace(alias) == false)
{
var file = IOHelper.MapPath(ViewPath(alias));
if (System.IO.File.Exists(file))
System.IO.File.Delete(file);
if (File.Exists(file))
File.Delete(file);
}
}
public static string ViewPath(string alias)
{
return Umbraco.Core.IO.SystemDirectories.MvcViews + "/" + alias.Replace(" ", "") + ".cshtml";
return SystemDirectories.MvcViews + "/" + alias.Replace(" ", "") + ".cshtml";
}
private static string EnsureInheritedLayout(Template template)
{
string design = template.Design;
@@ -115,8 +111,7 @@ namespace umbraco.cms.businesslogic.template
}";
if (template.MasterTemplate > 0)
design = design.Replace("null", "\"" + new Template(template.MasterTemplate).Alias.Replace(" ", "") + "\"");
design = design.Replace("null", string.Format("\"{0}.cshtml\"", new Template(template.MasterTemplate).Alias.Replace(" ", "")));
}
return design;