From 766ba0c8f58e15ad060189c4c6650a7f5573fc5a Mon Sep 17 00:00:00 2001 From: dprothero Date: Tue, 13 Aug 2013 13:45:38 -0700 Subject: [PATCH 01/14] Fixed membership provider to correctly log failed attempts. --- src/umbraco.providers/members/MembersMembershipProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/umbraco.providers/members/MembersMembershipProvider.cs b/src/umbraco.providers/members/MembersMembershipProvider.cs index bab5a4b505..0572613d78 100644 --- a/src/umbraco.providers/members/MembersMembershipProvider.cs +++ b/src/umbraco.providers/members/MembersMembershipProvider.cs @@ -820,6 +820,7 @@ namespace umbraco.providers.members { UpdateMemberProperty(updateMemberDataObject, m_LockPropertyTypeAlias, true); } + updateMemberDataObject.Save(); } } From b899805ec9fe7acb9d49c6726d781981ff1663d5 Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Thu, 15 Aug 2013 10:08:59 +0200 Subject: [PATCH 02/14] Correcting issue introduced in d3b69e04e1e5f5620e18c805d5cf0b265f140f96 where the returned IProfile would contain the Username and not the Name. This will have changed the Creator and Writer name in the xml cache to be the Login instead of the Name of the user, so for those that use these fields its important to republish to update the xml cache. Fixes U4-2628 creatorName and writerName should use username - not loginname. Also verified through file history back to v4. --- src/Umbraco.Core/Services/UserService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Services/UserService.cs b/src/Umbraco.Core/Services/UserService.cs index e451d3aa05..5845c0faa0 100644 --- a/src/Umbraco.Core/Services/UserService.cs +++ b/src/Umbraco.Core/Services/UserService.cs @@ -43,13 +43,13 @@ namespace Umbraco.Core.Services public IProfile GetProfileById(int id) { var user = GetUserById(id); - return new Profile(user.Id, user.Username); + return new Profile(user.Id, user.Name); } public IProfile GetProfileByUserName(string username) { var user = GetUserByUserName(username); - return new Profile(user.Id, user.Username); + return new Profile(user.Id, user.Name); } public IUser GetUserByUserName(string username) From d0a9e3236ebf733d2c018b161d05675f8fcd987f Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Thu, 15 Aug 2013 10:26:24 +0200 Subject: [PATCH 03/14] Promise for the changed unit test was incorrect, so correcting it in this commit --- src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs b/src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs index d795ebe18d..a1d922e86d 100644 --- a/src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs +++ b/src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs @@ -61,7 +61,7 @@ namespace Umbraco.Tests.PublishedCache Assert.AreEqual(mRoot.Id, publishedMedia.Id); Assert.AreEqual(mRoot.CreateDateTime.ToString("dd/MM/yyyy HH:mm:ss"), publishedMedia.CreateDate.ToString("dd/MM/yyyy HH:mm:ss")); Assert.AreEqual(mRoot.User.Id, publishedMedia.CreatorId); - Assert.AreEqual(mRoot.User.LoginName, publishedMedia.CreatorName); + Assert.AreEqual(mRoot.User.Name, publishedMedia.CreatorName); Assert.AreEqual(mRoot.ContentType.Alias, publishedMedia.DocumentTypeAlias); Assert.AreEqual(mRoot.ContentType.Id, publishedMedia.DocumentTypeId); Assert.AreEqual(mRoot.Level, publishedMedia.Level); From a343a76a26f345446b8810c4c02cbb9359efcf59 Mon Sep 17 00:00:00 2001 From: Mads Krohn Date: Fri, 16 Aug 2013 00:01:31 +0200 Subject: [PATCH 04/14] Moved WriteLiteral method to UmbracoViewPage When we use a custom model through a custom controller, in our view, we inherit from UmbracoViewPage, so the WriteLiteral method, which provides preview badge and miniprofiler code, should be placed there. --- src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs | 41 ---------------------- src/Umbraco.Web/Mvc/UmbracoViewPage.cs | 41 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs b/src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs index 9eba36e21a..231c6e12b2 100644 --- a/src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoTemplatePage.cs @@ -71,46 +71,5 @@ namespace Umbraco.Web.Mvc : new UmbracoHelper(UmbracoContext, Model.Content)); } } - - /// - /// This will detect the end /body tag and insert the preview badge if in preview mode - /// - /// - public override void WriteLiteral(object value) - { - // filter / add preview banner - if (Response.ContentType.InvariantEquals("text/html")) // ASP.NET default value - { - - if (UmbracoContext.Current.IsDebug || UmbracoContext.Current.InPreviewMode) - { - var text = value.ToString().ToLowerInvariant(); - int pos = text.IndexOf(""); - if (pos > -1) - { - if (UmbracoContext.Current.InPreviewMode) - { - var htmlBadge = - String.Format(UmbracoSettings.PreviewBadge, - IOHelper.ResolveUrl(SystemDirectories.Umbraco), - IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), - Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); - - text = text.Substring(0, pos) + htmlBadge + text.Substring(pos, text.Length - pos); - } - else - { - var profilerMarkup = this.Html.RenderProfiler(); - text = text.Substring(0, pos) + profilerMarkup + text.Substring(pos, text.Length - pos); - } - base.WriteLiteral(text); - return; - } - } - } - - base.WriteLiteral(value); - } - } } \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs index ba936ee9ee..7343dabb73 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs @@ -1,5 +1,8 @@ +using System; using System.Web.Mvc; using Umbraco.Core; +using Umbraco.Core.Configuration; +using Umbraco.Core.IO; using Umbraco.Web.Routing; namespace Umbraco.Web.Mvc @@ -112,5 +115,43 @@ namespace Umbraco.Web.Mvc } + /// + /// This will detect the end /body tag and insert the preview badge if in preview mode + /// + /// + public override void WriteLiteral(object value) + { + // filter / add preview banner + if (Response.ContentType.InvariantEquals("text/html")) // ASP.NET default value + { + if (UmbracoContext.Current.IsDebug || UmbracoContext.Current.InPreviewMode) + { + var text = value.ToString().ToLowerInvariant(); + var pos = text.IndexOf("", StringComparison.InvariantCultureIgnoreCase); + if (pos > -1) + { + if (UmbracoContext.Current.InPreviewMode) + { + var htmlBadge = + String.Format(UmbracoSettings.PreviewBadge, + IOHelper.ResolveUrl(SystemDirectories.Umbraco), + IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), + Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); + + text = text.Substring(0, pos) + htmlBadge + text.Substring(pos, text.Length - pos); + } + else + { + var profilerMarkup = this.Html.RenderProfiler(); + text = text.Substring(0, pos) + profilerMarkup + text.Substring(pos, text.Length - pos); + } + base.WriteLiteral(text); + return; + } + } + } + + base.WriteLiteral(value); + } } } \ No newline at end of file From 973b4667984c0e6f9b74312f7beeeea93e0f4a07 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 16 Aug 2013 12:25:38 +1000 Subject: [PATCH 05/14] Fixes: U4-2627 Ensure that the plugins cache files are named with the machine name --- src/Umbraco.Core/NetworkHelper.cs | 50 ++++++++++++++++++++++++++++ src/Umbraco.Core/PluginManager.cs | 7 ++-- src/Umbraco.Core/StringExtensions.cs | 11 ++++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 src/Umbraco.Core/NetworkHelper.cs diff --git a/src/Umbraco.Core/NetworkHelper.cs b/src/Umbraco.Core/NetworkHelper.cs new file mode 100644 index 0000000000..d69c4a963c --- /dev/null +++ b/src/Umbraco.Core/NetworkHelper.cs @@ -0,0 +1,50 @@ +using System; + +namespace Umbraco.Core +{ + /// + /// Currently just used to get the machine name in med trust and to format a machine name for use with file names + /// + internal class NetworkHelper + { + /// + /// Returns the machine name that is safe to use in file paths. + /// + /// + /// see: https://github.com/Shandem/ClientDependency/issues/4 + /// + public static string FileSafeMachineName + { + get { return MachineName.ReplaceNonAlphanumericChars('-'); } + } + + /// + /// Returns the current machine name + /// + /// + /// Tries to resolve the machine name, if it cannot it uses the config section. + /// + public static string MachineName + { + get + { + try + { + return Environment.MachineName; + } + catch + { + try + { + return System.Net.Dns.GetHostName(); + } + catch + { + //if we get here it means we cannot access the machine name + throw new ApplicationException("Cannot resolve the current machine name eithe by Environment.MachineName or by Dns.GetHostname()"); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/PluginManager.cs b/src/Umbraco.Core/PluginManager.cs index 24c7070498..a12add664b 100644 --- a/src/Umbraco.Core/PluginManager.cs +++ b/src/Umbraco.Core/PluginManager.cs @@ -20,7 +20,6 @@ using File = System.IO.File; namespace Umbraco.Core { - /// /// Used to resolve all plugin types and cache them and is also used to instantiate plugin types /// @@ -307,15 +306,15 @@ namespace Umbraco.Core _appContext.ApplicationCache.ClearCacheItem("umbraco-plugins.list"); } } - + private string GetPluginListFilePath() { - return Path.Combine(_tempFolder, "umbraco-plugins.list"); + return Path.Combine(_tempFolder, string.Format("umbraco-plugins.{0}.list", NetworkHelper.FileSafeMachineName)); } private string GetPluginHashFilePath() { - return Path.Combine(_tempFolder, "umbraco-plugins.hash"); + return Path.Combine(_tempFolder, string.Format("umbraco-plugins.{0}.hash", NetworkHelper.FileSafeMachineName)); } /// diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs index df7c0d07b0..87b4c676b5 100644 --- a/src/Umbraco.Core/StringExtensions.cs +++ b/src/Umbraco.Core/StringExtensions.cs @@ -28,6 +28,17 @@ namespace Umbraco.Core [UmbracoWillObsolete("Do not use this constants. See IShortStringHelper.CleanStringForSafeAliasJavaScriptCode.")] public const string UmbracoInvalidFirstCharacters = "01234567890"; + internal static string ReplaceNonAlphanumericChars(this string input, char replacement) + { + //any character that is not alphanumeric, convert to a hyphen + var mName = input; + foreach (var c in mName.ToCharArray().Where(c => !char.IsLetterOrDigit(c))) + { + mName = mName.Replace(c, replacement); + } + return mName; + } + public static string ExceptChars(this string str, HashSet toExclude) { var sb = new StringBuilder(str.Length); diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 405cf23025..4d5bd09932 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -238,6 +238,7 @@ + From 66c6b5b524c9521f2a8d09a30b2204135825b39a Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 16 Aug 2013 12:46:40 +1000 Subject: [PATCH 06/14] Fixes: U4-2632 Remove the recursive permissions check on the move/copy dialog --- .../umbraco/dialogs/moveOrCopy.aspx.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs index e27fd53785..ccd6c6481d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs @@ -108,6 +108,7 @@ namespace umbraco.dialogs if (validAction == false) { + panel_buttons.Visible = false; ScriptManager.RegisterStartupScript(this, GetType(), "notvalid", "notValid();", true); } } @@ -121,21 +122,22 @@ namespace umbraco.dialogs return CheckPermissions(cmsNode, currentAction); } + /// + /// Checks if the current user has permissions to execute this action against this node + /// + /// + /// + /// + /// + /// This used to do a recursive check for all descendent nodes but this is not required and is a massive CPU hog. + /// See: http://issues.umbraco.org/issue/U4-2632, https://groups.google.com/forum/?fromgroups=#!topic/umbraco-dev/L1D4LwVSP2Y + /// private bool CheckPermissions(IContentBase node, IAction currentAction) { var currUserPermissions = new UserPermissions(CurrentUser); var lstCurrUserActions = currUserPermissions.GetExistingNodePermission(node.Id); - if (lstCurrUserActions.Contains(currentAction) == false) - return false; - - - if (Umbraco.Core.Models.ContentExtensions.HasChildren(node, Services)) - { - return Umbraco.Core.Models.ContentExtensions.Children(node, Services) - .All(child => CheckPermissions(child, currentAction)); - } - return true; + return lstCurrUserActions.Contains(currentAction); } private void HandleDocumentTypeCopy() From 4a481b05d40370cd45d37bcf3deaae88d50eaddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Skyldahl=20S=C3=B8rensen?= Date: Fri, 16 Aug 2013 10:09:09 +0200 Subject: [PATCH 07/14] Optimized WriteLiteral --- src/Umbraco.Web/Mvc/UmbracoViewPage.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs index 7343dabb73..2ba6faff13 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs @@ -1,4 +1,5 @@ using System; +using Sytem.Text; using System.Web.Mvc; using Umbraco.Core; using Umbraco.Core.Configuration; @@ -128,24 +129,30 @@ namespace Umbraco.Web.Mvc { var text = value.ToString().ToLowerInvariant(); var pos = text.IndexOf("", StringComparison.InvariantCultureIgnoreCase); + if (pos > -1) { + string markupToInject; + if (UmbracoContext.Current.InPreviewMode) { - var htmlBadge = + // creating previewBadge markup + markupToInject = String.Format(UmbracoSettings.PreviewBadge, IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); - - text = text.Substring(0, pos) + htmlBadge + text.Substring(pos, text.Length - pos); } else { - var profilerMarkup = this.Html.RenderProfiler(); - text = text.Substring(0, pos) + profilerMarkup + text.Substring(pos, text.Length - pos); + // creating mini-profiler markup + markupToInject = Html.RenderProfiler().ToHtmlString(); } - base.WriteLiteral(text); + + var sb = new StringBuilder(text); + sb.Insert(pos, markupToInject); + + base.WriteLiteral(sb.ToString()); return; } } From f41d96786497551a5fffcb05f6e66563a8e93168 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 19 Aug 2013 10:41:49 +0200 Subject: [PATCH 08/14] Fixes: U4-2637 Error adding a User using AD Membership Provider when no Email Address Defined --- src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs index e1847f22a4..36ce464a63 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs @@ -161,14 +161,15 @@ namespace umbraco.cms.presentation /// Maps active directory account to umbraco user account /// /// Name of the login. + /// Email address of the user private void ActiveDirectoryMapping(string loginName, string email) { // Password is not copied over because it is stored in active directory for security! // The user is create with default access to content and as a writer user type if (BusinessLogic.User.getUserId(loginName) == -1) { - BusinessLogic.User.MakeNew(loginName, loginName, string.Empty, email, BusinessLogic.UserType.GetUserType(2)); - BusinessLogic.User u = new BusinessLogic.User(loginName); + BusinessLogic.User.MakeNew(loginName, loginName, string.Empty, email ?? "", UserType.GetUserType(2)); + var u = new User(loginName); u.addApplication(Constants.Applications.Content); } } From 23c6a91e9cad6d4a6ca164cbdb98ca74ec7e579a Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 19 Aug 2013 11:47:53 +0200 Subject: [PATCH 09/14] Fixes merge issue --- src/Umbraco.Web/Mvc/UmbracoViewPage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs index 2ba6faff13..fa22cf419b 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs @@ -1,5 +1,5 @@ using System; -using Sytem.Text; +using System.Text; using System.Web.Mvc; using Umbraco.Core; using Umbraco.Core.Configuration; From 65db0e69a97e74c1a0b8fb9aa45742ea961f53a5 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 19 Aug 2013 12:26:01 +0200 Subject: [PATCH 10/14] Fixes: U4-2642 Make SQL CE more resilient to server crashes --- src/Umbraco.Core/DatabaseContext.cs | 2 +- src/Umbraco.Tests/App.config | 2 +- src/Umbraco.Tests/BusinessLogic/BaseTest.cs | 2 +- src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs | 2 +- src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs | 2 +- .../Migrations/Upgrades/ValidateOlderSchemaTest.cs | 2 +- src/Umbraco.Tests/Persistence/DatabaseContextTests.cs | 2 +- src/Umbraco.Tests/Persistence/SqlCeTableByTableTest.cs | 4 ++-- src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs | 2 +- src/Umbraco.Tests/TestHelpers/TestHelper.cs | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index ed9b7c5a9d..2f0efcbfc0 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -112,7 +112,7 @@ namespace Umbraco.Core public void ConfigureEmbeddedDatabaseConnection() { const string providerName = "System.Data.SqlServerCe.4.0"; - const string connectionString = @"Data Source=|DataDirectory|\Umbraco.sdf"; + const string connectionString = @"Data Source=|DataDirectory|\Umbraco.sdf;Flush Interval=1;File Access Retry Timeout=10"; SaveConnectionString(connectionString, providerName); diff --git a/src/Umbraco.Tests/App.config b/src/Umbraco.Tests/App.config index 20f0ce5aae..78ddfe8dcb 100644 --- a/src/Umbraco.Tests/App.config +++ b/src/Umbraco.Tests/App.config @@ -26,7 +26,7 @@ - + diff --git a/src/Umbraco.Tests/BusinessLogic/BaseTest.cs b/src/Umbraco.Tests/BusinessLogic/BaseTest.cs index 9f48cd29d1..73d51e7816 100644 --- a/src/Umbraco.Tests/BusinessLogic/BaseTest.cs +++ b/src/Umbraco.Tests/BusinessLogic/BaseTest.cs @@ -53,7 +53,7 @@ namespace Umbraco.Tests.BusinessLogic private void InitializeDatabase() { - ConfigurationManager.AppSettings.Set(Core.Configuration.GlobalSettings.UmbracoConnectionName, @"datalayer=SQLCE4Umbraco.SqlCEHelper,SQLCE4Umbraco;data source=|DataDirectory|\UmbracoPetaPocoTests.sdf"); + ConfigurationManager.AppSettings.Set(Core.Configuration.GlobalSettings.UmbracoConnectionName, @"datalayer=SQLCE4Umbraco.SqlCEHelper,SQLCE4Umbraco;data source=|DataDirectory|\UmbracoPetaPocoTests.sdf;Flush Interval=1;File Access Retry Timeout=10"); ClearDatabase(); diff --git a/src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs index a9b80f9b17..9f8a3be793 100644 --- a/src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs +++ b/src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs @@ -57,7 +57,7 @@ namespace Umbraco.Tests.Migrations.Upgrades public override UmbracoDatabase GetConfiguredDatabase() { - return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf", "System.Data.SqlServerCe.4.0"); + return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;File Access Retry Timeout=10", "System.Data.SqlServerCe.4.0"); } public override DatabaseProviders GetDatabaseProvider() diff --git a/src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs index e8a3ef1939..3dfc059358 100644 --- a/src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs +++ b/src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs @@ -63,7 +63,7 @@ namespace Umbraco.Tests.Migrations.Upgrades public override UmbracoDatabase GetConfiguredDatabase() { - return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf", "System.Data.SqlServerCe.4.0"); + return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;File Access Retry Timeout=10", "System.Data.SqlServerCe.4.0"); } public override DatabaseProviders GetDatabaseProvider() diff --git a/src/Umbraco.Tests/Migrations/Upgrades/ValidateOlderSchemaTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/ValidateOlderSchemaTest.cs index 3dcc1a5308..1abb496fe9 100644 --- a/src/Umbraco.Tests/Migrations/Upgrades/ValidateOlderSchemaTest.cs +++ b/src/Umbraco.Tests/Migrations/Upgrades/ValidateOlderSchemaTest.cs @@ -100,7 +100,7 @@ namespace Umbraco.Tests.Migrations.Upgrades public UmbracoDatabase GetConfiguredDatabase() { - return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf", "System.Data.SqlServerCe.4.0"); + return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;File Access Retry Timeout=10", "System.Data.SqlServerCe.4.0"); } public string GetDatabaseSpecificSqlScript() diff --git a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs index 420905536d..9132db95c2 100644 --- a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs +++ b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs @@ -69,7 +69,7 @@ namespace Umbraco.Tests.Persistence //Get the connectionstring settings from config var settings = ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName]; - //by default the conn string is: Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf + //by default the conn string is: Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;File Access Retry Timeout=10 //we'll just replace the sdf file with our custom one: //Create the Sql CE database var engine = new SqlCeEngine(settings.ConnectionString.Replace("UmbracoPetaPocoTests", "DatabaseContextTests")); diff --git a/src/Umbraco.Tests/Persistence/SqlCeTableByTableTest.cs b/src/Umbraco.Tests/Persistence/SqlCeTableByTableTest.cs index d47b5cac75..7147dea975 100644 --- a/src/Umbraco.Tests/Persistence/SqlCeTableByTableTest.cs +++ b/src/Umbraco.Tests/Persistence/SqlCeTableByTableTest.cs @@ -35,12 +35,12 @@ namespace Umbraco.Tests.Persistence } //Create the Sql CE database - var engine = new SqlCeEngine("Datasource=|DataDirectory|test.sdf"); + var engine = new SqlCeEngine("Datasource=|DataDirectory|test.sdf;Flush Interval=1;File Access Retry Timeout=10"); engine.CreateDatabase(); SqlSyntaxContext.SqlSyntaxProvider = SqlCeSyntax.Provider; - _database = new Database("Datasource=|DataDirectory|test.sdf", + _database = new Database("Datasource=|DataDirectory|test.sdf;Flush Interval=1;File Access Retry Timeout=10", "System.Data.SqlServerCe.4.0"); } diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs index 6152898f92..d85d9813f5 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs @@ -105,7 +105,7 @@ namespace Umbraco.Tests.TestHelpers /// protected virtual string GetDbConnectionString() { - return @"Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf"; + return @"Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;File Access Retry Timeout=10"; } /// diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs index 6ab161a3b0..5c4eaad051 100644 --- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs +++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs @@ -47,7 +47,7 @@ namespace Umbraco.Tests.TestHelpers /// public static void InitializeDatabase() { - ConfigurationManager.AppSettings.Set(Core.Configuration.GlobalSettings.UmbracoConnectionName, @"datalayer=SQLCE4Umbraco.SqlCEHelper,SQLCE4Umbraco;data source=|DataDirectory|\UmbracoPetaPocoTests.sdf"); + ConfigurationManager.AppSettings.Set(Core.Configuration.GlobalSettings.UmbracoConnectionName, @"datalayer=SQLCE4Umbraco.SqlCEHelper,SQLCE4Umbraco;data source=|DataDirectory|\UmbracoPetaPocoTests.sdf;Flush Interval=1;File Access Retry Timeout=10"); ClearDatabase(); From dcb381770f998a41f8d460ce3edc5b64077fc8cc Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 19 Aug 2013 12:54:20 +0200 Subject: [PATCH 11/14] Fix unit test that was looking at the wrong filename --- src/Umbraco.Tests/PluginManagerTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Tests/PluginManagerTests.cs b/src/Umbraco.Tests/PluginManagerTests.cs index c38f6ac37c..4610839fcf 100644 --- a/src/Umbraco.Tests/PluginManagerTests.cs +++ b/src/Umbraco.Tests/PluginManagerTests.cs @@ -160,14 +160,15 @@ namespace Umbraco.Tests { var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/PluginCache"); var manager = new PluginManager(false); - var filePath = Path.Combine(tempFolder, "umbraco-plugins.list"); + var filePath= Path.Combine(tempFolder, string.Format("umbraco-plugins.{0}.list", NetworkHelper.FileSafeMachineName)); + File.WriteAllText(filePath, @" "); - + Assert.IsTrue(manager.DetectLegacyPluginListFile()); File.Delete(filePath); From 03a0a0a0e943a11dd03bfbe52716e7f247821907 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 20 Aug 2013 18:06:09 +0200 Subject: [PATCH 12/14] Fix a strange VS2012 build targets problem --- build/Build.proj | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build/Build.proj b/build/Build.proj index 5ceeadb141..1ef2f6915a 100644 --- a/build/Build.proj +++ b/build/Build.proj @@ -228,7 +228,7 @@ - + @@ -240,6 +240,17 @@ + + + + + + + + + + + From f51c4e332ed8aa82962d18b1966b2a10a24751d7 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 21 Aug 2013 11:14:37 +1000 Subject: [PATCH 13/14] Fixes: U4-2653 BeginUmbracoForm should use absolute path with query string URLs without the protocol --- src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 2 +- src/Umbraco.Web/Routing/PublishedContentNotFoundHandler.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index ecccd126a0..79d6ec3f7c 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -466,7 +466,7 @@ namespace Umbraco.Web Mandate.ParameterNotNullOrEmpty(action, "action"); Mandate.ParameterNotNullOrEmpty(controllerName, "controllerName"); - var formAction = UmbracoContext.Current.OriginalRequestUrl.ToString(); + var formAction = UmbracoContext.Current.OriginalRequestUrl.PathAndQuery; return html.RenderForm(formAction, FormMethod.Post, htmlAttributes, controllerName, action, area, additionalRouteVals); } diff --git a/src/Umbraco.Web/Routing/PublishedContentNotFoundHandler.cs b/src/Umbraco.Web/Routing/PublishedContentNotFoundHandler.cs index 83db913b44..df5584ce11 100644 --- a/src/Umbraco.Web/Routing/PublishedContentNotFoundHandler.cs +++ b/src/Umbraco.Web/Routing/PublishedContentNotFoundHandler.cs @@ -37,7 +37,7 @@ namespace Umbraco.Web.Routing response.Write("

Page not found

"); response.Write("

"); - response.Write(string.Format(reason, HttpUtility.HtmlEncode(UmbracoContext.Current.OriginalRequestUrl))); + response.Write(string.Format(reason, HttpUtility.HtmlEncode(UmbracoContext.Current.OriginalRequestUrl.PathAndQuery))); response.Write("

"); if (!string.IsNullOrWhiteSpace(_message)) response.Write("

" + _message + "

"); From e233cffb9d3f9469444ffe4c4bc124f50a48adba Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 21 Aug 2013 11:19:27 +1000 Subject: [PATCH 14/14] Changes the cache keys in PluginManager to reference a const to make it a bit more clear. --- src/Umbraco.Core/PluginManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/PluginManager.cs b/src/Umbraco.Core/PluginManager.cs index a12add664b..f798c2a454 100644 --- a/src/Umbraco.Core/PluginManager.cs +++ b/src/Umbraco.Core/PluginManager.cs @@ -36,6 +36,7 @@ namespace Umbraco.Core internal class PluginManager { private readonly ApplicationContext _appContext; + private const string CacheKey = "umbraco-plugins.list"; /// /// Creates a new PluginManager with an ApplicationContext instance which ensures that the plugin xml @@ -250,7 +251,7 @@ namespace Umbraco.Core XDocument xml; if (_appContext != null) { - xml = _appContext.ApplicationCache.GetCacheItem("umbraco-plugins.list", + xml = _appContext.ApplicationCache.GetCacheItem(CacheKey, new TimeSpan(0, 0, 5, 0), () => XDocument.Load(filePath)); } @@ -303,7 +304,7 @@ namespace Umbraco.Core if (_appContext != null) { - _appContext.ApplicationCache.ClearCacheItem("umbraco-plugins.list"); + _appContext.ApplicationCache.ClearCacheItem(CacheKey); } }