diff --git a/appveyor.yml b/appveyor.yml index 253a0142a7..38495c0f0b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,6 @@ build_script: cd build SET "release=" - FOR /F "skip=1 delims=" %%i IN (UmbracoVersion.txt) DO IF NOT DEFINED release SET "release=%%i" SET nuGetFolder=C:\Users\appveyor\.nuget\packages @@ -13,29 +12,24 @@ build_script: ..\src\.nuget\NuGet.exe sources Add -Name MyGetUmbracoCore -Source https://www.myget.org/F/umbracocore/api/v2/ >NUL ..\src\.nuget\NuGet.exe restore ..\src\Umbraco.Core\project.json -OutputDirectory %nuGetFolder% -Verbosity quiet - ..\src\.nuget\NuGet.exe restore ..\src\umbraco.datalayer\packages.config -OutputDirectory %nuGetFolder% -Verbosity quiet - ..\src\.nuget\NuGet.exe restore ..\src\Umbraco.Web\project.json -OutputDirectory %nuGetFolder% -Verbosity quiet - ..\src\.nuget\NuGet.exe restore ..\src\Umbraco.Web.UI\packages.config -OutputDirectory %nuGetFolder% -Verbosity quiet - - SET nuGetFolder=%CD%\..\src\packages\ - ..\src\.nuget\NuGet.exe restore ..\src\Umbraco.Tests\packages.config -OutputDirectory %nuGetFolder% -Verbosity quiet - ..\src\.nuget\NuGet.exe restore ..\src\umbraco.datalayer\packages.config -OutputDirectory %nuGetFolder% -Verbosity quiet - ..\src\.nuget\NuGet.exe restore ..\src\umbraco.controls\packages.config -OutputDirectory %nuGetFolder% -Verbosity quiet - - ECHO Building Release %release% build%APPVEYOR_BUILD_NUMBER% + ECHO Building Release %release% build%APPVEYOR_BUILD_NUMBER% + + SET PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH% SET MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" + XCOPY "..\src\Umbraco.Tests\unit-test-log4net.CI.config" "..\src\Umbraco.Tests\unit-test-log4net.config" /Y + %MSBUILD% "../src/Umbraco.Tests/Umbraco.Tests.csproj" /consoleloggerparameters:Summary;ErrorsOnly;WarningsOnly - + build.bat nopause %release% build%APPVEYOR_BUILD_NUMBER% - + ECHO %PATH% test: assemblies: src\Umbraco.Tests\bin\Debug\Umbraco.Tests.dll diff --git a/build/Build.bat b/build/Build.bat index 75f471b5f2..99f50b0a4c 100644 --- a/build/Build.bat +++ b/build/Build.bat @@ -100,7 +100,7 @@ GOTO :EOF :error ECHO. -ECHO. Errors were detected! +ECHO Errors were detected! ECHO. REM don't pause if continuous integration else the build server waits forever diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index a358539fad..6177065595 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -36,8 +36,8 @@ - - + + diff --git a/build/NuSpecs/tools/install.ps1 b/build/NuSpecs/tools/install.ps1 index 5ebaa6d02a..0e62fb0749 100644 --- a/build/NuSpecs/tools/install.ps1 +++ b/build/NuSpecs/tools/install.ps1 @@ -97,7 +97,12 @@ if ($project) { $umbracoUIXMLSource = Join-Path $installPath "UmbracoFiles\Umbraco\Config\Create\UI.xml" $umbracoUIXMLDestination = Join-Path $projectPath "Umbraco\Config\Create\UI.xml" Copy-Item $umbracoUIXMLSource $umbracoUIXMLDestination -Force - } + } else { + $upgradeViewSource = Join-Path $umbracoFolderSource "Views\install\*" + $upgradeView = Join-Path $umbracoFolder "Views\install\" + Write-Host "Copying2 ${upgradeViewSource} to ${upgradeView}" + Copy-Item $upgradeViewSource $upgradeView -Force + } $installFolder = Join-Path $projectPath "Install" if(Test-Path $installFolder) { diff --git a/src/Umbraco.Core/Models/Rdbms/PropertyDataDto.cs b/src/Umbraco.Core/Models/Rdbms/PropertyDataDto.cs index 2dfcafcc7b..b385381e5b 100644 --- a/src/Umbraco.Core/Models/Rdbms/PropertyDataDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/PropertyDataDto.cs @@ -17,7 +17,7 @@ namespace Umbraco.Core.Models.Rdbms [Column("contentNodeId")] [ForeignKey(typeof(NodeDto))] - [Index(IndexTypes.NonClustered, Name = "IX_cmsPropertyData_1")] + [Index(IndexTypes.UniqueNonClustered, Name = "IX_cmsPropertyData_1", ForColumns = "contentNodeId,versionId,propertytypeid")] public int NodeId { get; set; } [Column("versionId")] diff --git a/src/Umbraco.Core/Models/Rdbms/StylesheetDto.cs b/src/Umbraco.Core/Models/Rdbms/StylesheetDto.cs index 91132d3a7e..6ff7c0bc00 100644 --- a/src/Umbraco.Core/Models/Rdbms/StylesheetDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/StylesheetDto.cs @@ -1,12 +1,11 @@ -using NPoco; +using System; +using NPoco; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.DatabaseAnnotations; namespace Umbraco.Core.Models.Rdbms { - [TableName("cmsStylesheet")] - [PrimaryKey("nodeId", AutoIncrement = false)] - [ExplicitColumns] + [Obsolete("This is no longer used and will be removed from Umbraco in future versions")] internal class StylesheetDto { [Column("nodeId")] diff --git a/src/Umbraco.Core/Models/Rdbms/StylesheetPropertyDto.cs b/src/Umbraco.Core/Models/Rdbms/StylesheetPropertyDto.cs index 8e249a8da2..0d4c2ec3fa 100644 --- a/src/Umbraco.Core/Models/Rdbms/StylesheetPropertyDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/StylesheetPropertyDto.cs @@ -1,12 +1,11 @@ -using NPoco; +using System; +using NPoco; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.DatabaseAnnotations; namespace Umbraco.Core.Models.Rdbms { - [TableName("cmsStylesheetProperty")] - [PrimaryKey("nodeId", AutoIncrement = false)] - [ExplicitColumns] + [Obsolete("This is no longer used and will be removed from Umbraco in future versions")] internal class StylesheetPropertyDto { [Column("nodeId")] diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs index d60a16b98f..5f2c17cfb9 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs @@ -63,8 +63,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial {23, typeof (PropertyDataDto)}, {24, typeof (RelationTypeDto)}, {25, typeof (RelationDto)}, - {26, typeof (StylesheetDto)}, - {27, typeof (StylesheetPropertyDto)}, + {28, typeof (TagDto)}, {29, typeof (TagRelationshipDto)}, {31, typeof (UserTypeDto)}, diff --git a/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs b/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs index d60b5adeb6..0bd4dc72f6 100644 --- a/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs +++ b/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs @@ -46,7 +46,7 @@ namespace Umbraco.Core.Persistence.Migrations _targetVersion = targetVersion; _productName = productName; //ensure this is null if there aren't any - _migrations = migrations.Length == 0 ? null : migrations; + _migrations = migrations == null || migrations.Length == 0 ? null : migrations; } /// diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Delete/Index/DeleteIndexBuilder.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Delete/Index/DeleteIndexBuilder.cs index 72250877db..93661c9ece 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Syntax/Delete/Index/DeleteIndexBuilder.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Delete/Index/DeleteIndexBuilder.cs @@ -1,4 +1,5 @@ -using Umbraco.Core.Persistence.DatabaseModelDefinitions; +using System; +using Umbraco.Core.Persistence.DatabaseModelDefinitions; using Umbraco.Core.Persistence.Migrations.Syntax.Delete.Expressions; namespace Umbraco.Core.Persistence.Migrations.Syntax.Delete.Index @@ -17,12 +18,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Delete.Index return this; } + [Obsolete("I don't think this would ever be used when dropping an index, see DeleteIndexExpression.ToString")] public void OnColumn(string columnName) { var column = new IndexColumnDefinition { Name = columnName }; Expression.Index.Columns.Add(column); } + [Obsolete("I don't think this would ever be used when dropping an index, see DeleteIndexExpression.ToString")] public void OnColumns(params string[] columnNames) { foreach (string columnName in columnNames) diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Delete/Index/IDeleteIndexOnColumnSyntax.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Delete/Index/IDeleteIndexOnColumnSyntax.cs index f2f4280f23..fcf5038a86 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Syntax/Delete/Index/IDeleteIndexOnColumnSyntax.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Delete/Index/IDeleteIndexOnColumnSyntax.cs @@ -1,8 +1,13 @@ -namespace Umbraco.Core.Persistence.Migrations.Syntax.Delete.Index +using System; + +namespace Umbraco.Core.Persistence.Migrations.Syntax.Delete.Index { public interface IDeleteIndexOnColumnSyntax : IFluentSyntax { + [Obsolete("I don't think this would ever be used when dropping an index, see DeleteIndexExpression.ToString")] void OnColumn(string columnName); + + [Obsolete("I don't think this would ever be used when dropping an index, see DeleteIndexExpression.ToString")] void OnColumns(params string[] columnNames); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/RemoveStylesheetDataAndTablesAgain.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/RemoveStylesheetDataAndTablesAgain.cs new file mode 100644 index 0000000000..48135f35d7 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/RemoveStylesheetDataAndTablesAgain.cs @@ -0,0 +1,44 @@ +using System; +using System.Linq; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Persistence.SqlSyntax; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZero +{ + /// + /// This is here to re-remove these tables, we dropped them in 7.3 but new installs created them again so we're going to re-drop them + /// + [Migration("7.5.0", 1, GlobalSettings.UmbracoMigrationName)] + public class RemoveStylesheetDataAndTablesAgain : MigrationBase + { + public RemoveStylesheetDataAndTablesAgain(ISqlSyntaxProvider sqlSyntax, ILogger logger) + : base(sqlSyntax, logger) + { + } + + public override void Up() + { + //Clear all stylesheet data if the tables exist + var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray(); + if (tables.InvariantContains("cmsStylesheetProperty")) + { + Delete.FromTable("cmsStylesheetProperty").AllRows(); + Delete.FromTable("umbracoNode").Row(new { nodeObjectType = new Guid(Constants.ObjectTypes.StylesheetProperty) }); + + Delete.Table("cmsStylesheetProperty"); + } + if (tables.InvariantContains("cmsStylesheet")) + { + Delete.FromTable("cmsStylesheet").AllRows(); + Delete.FromTable("umbracoNode").Row(new { nodeObjectType = new Guid(Constants.ObjectTypes.Stylesheet) }); + + Delete.Table("cmsStylesheet"); + } + } + + public override void Down() + { + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/UpdateUniqueIndexOnCmsPropertyData.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/UpdateUniqueIndexOnCmsPropertyData.cs new file mode 100644 index 0000000000..f8e6abe42e --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/UpdateUniqueIndexOnCmsPropertyData.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Models.Rdbms; +using Umbraco.Core.Persistence.SqlSyntax; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZero +{ + /// + /// See: http://issues.umbraco.org/issue/U4-8522 + /// + [Migration("7.5.0", 2, GlobalSettings.UmbracoMigrationName)] + public class UpdateUniqueIndexOnCmsPropertyData : MigrationBase + { + public UpdateUniqueIndexOnCmsPropertyData(ISqlSyntaxProvider sqlSyntax, ILogger logger) + : base(sqlSyntax, logger) + { + } + + public override void Up() + { + //Clear all stylesheet data if the tables exist + //tuple = tablename, indexname, columnname, unique + var indexes = SqlSyntax.GetDefinedIndexes(Context.Database).ToArray(); + var found = indexes.FirstOrDefault( + x => x.Item1.InvariantEquals("cmsPropertyData") + && x.Item2.InvariantEquals("IX_cmsPropertyData_1") + //we're searching for the old index which is not unique + && x.Item4 == false); + + if (found != null) + { + //Check for MySQL + if (Context.CurrentDatabaseProvider == DatabaseProviders.MySql) + { + //Use the special double nested sub query for MySQL since that is the only + //way delete sub queries works + var delPropQry = SqlSyntax.GetDeleteSubquery( + "cmsPropertyData", + "id", + new Sql("SELECT MIN(id) FROM cmsPropertyData GROUP BY contentNodeId, versionId, propertytypeid HAVING MIN(id) IS NOT NULL"), + WhereInType.NotIn); + Execute.Sql(delPropQry.SQL); + } + else + { + //NOTE: Even though the above will work for MSSQL, we are not going to execute the + // nested delete sub query logic since it will be slower and there could be a ton of property + // data here so needs to be as fast as possible. + Execute.Sql("DELETE FROM cmsPropertyData WHERE id NOT IN (SELECT MIN(id) FROM cmsPropertyData GROUP BY contentNodeId, versionId, propertytypeid HAVING MIN(id) IS NOT NULL)"); + } + + //we need to re create this index + Delete.Index("IX_cmsPropertyData_1").OnTable("cmsPropertyData"); + Create.Index("IX_cmsPropertyData_1").OnTable("cmsPropertyData") + .OnColumn("contentNodeId").Ascending() + .OnColumn("versionId").Ascending() + .OnColumn("propertytypeid").Ascending() + .WithOptions().NonClustered() + .WithOptions().Unique(); + } + } + + public override void Down() + { + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderExtensions.cs b/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderExtensions.cs index 90f0a56696..5cfca7cb3d 100644 --- a/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderExtensions.cs +++ b/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderExtensions.cs @@ -24,12 +24,23 @@ namespace Umbraco.Core.Persistence.SqlSyntax /// /// See: http://issues.umbraco.org/issue/U4-3876 /// - public static Sql GetDeleteSubquery(this ISqlSyntaxProvider sqlProvider, string tableName, string columnName, Sql subQuery) + public static Sql GetDeleteSubquery(this ISqlSyntaxProvider sqlProvider, string tableName, string columnName, Sql subQuery, WhereInType whereInType = WhereInType.In) { - return new Sql(string.Format(@"DELETE FROM {0} WHERE {1} IN (SELECT {1} FROM ({2}) x)", + + return + new Sql(string.Format( + whereInType == WhereInType.In + ? @"DELETE FROM {0} WHERE {1} IN (SELECT {1} FROM ({2}) x)" + : @"DELETE FROM {0} WHERE {1} NOT IN (SELECT {1} FROM ({2}) x)", sqlProvider.GetQuotedTableName(tableName), sqlProvider.GetQuotedColumnName(columnName), subQuery.SQL), subQuery.Arguments); } } + + internal enum WhereInType + { + In, + NotIn + } } \ No newline at end of file diff --git a/src/Umbraco.Core/Security/AuthenticationExtensions.cs b/src/Umbraco.Core/Security/AuthenticationExtensions.cs index 7bb54e6ef7..636d2c49a8 100644 --- a/src/Umbraco.Core/Security/AuthenticationExtensions.cs +++ b/src/Umbraco.Core/Security/AuthenticationExtensions.cs @@ -289,11 +289,9 @@ namespace Umbraco.Core.Security } catch (Exception) { - //TODO: Do we need to do more here?? need to make sure that the forms cookie is gone, but is that - // taken care of in our custom middleware somehow? ctx.Authentication.SignOut( - Core.Constants.Security.BackOfficeAuthenticationType, - Core.Constants.Security.BackOfficeExternalAuthenticationType); + Constants.Security.BackOfficeAuthenticationType, + Constants.Security.BackOfficeExternalAuthenticationType); return null; } } diff --git a/src/Umbraco.Core/Security/BackOfficeSignInManager.cs b/src/Umbraco.Core/Security/BackOfficeSignInManager.cs index f1d18b9d0f..1707813433 100644 --- a/src/Umbraco.Core/Security/BackOfficeSignInManager.cs +++ b/src/Umbraco.Core/Security/BackOfficeSignInManager.cs @@ -46,7 +46,7 @@ namespace Umbraco.Core.Security /// /// /// - public async override Task PasswordSignInAsync(string userName, string password, bool isPersistent, bool shouldLockout) + public override async Task PasswordSignInAsync(string userName, string password, bool isPersistent, bool shouldLockout) { var result = await base.PasswordSignInAsync(userName, password, isPersistent, shouldLockout); diff --git a/src/Umbraco.Core/Security/BackOfficeUserManager.cs b/src/Umbraco.Core/Security/BackOfficeUserManager.cs index 69be7b60c2..b786a7c93f 100644 --- a/src/Umbraco.Core/Security/BackOfficeUserManager.cs +++ b/src/Umbraco.Core/Security/BackOfficeUserManager.cs @@ -123,7 +123,7 @@ namespace Umbraco.Core.Security manager.ClaimsIdentityFactory = new BackOfficeClaimsIdentityFactory(); manager.EmailService = new EmailService(); - + //NOTE: Not implementing these, if people need custom 2 factor auth, they'll need to implement their own UserStore to suport it //// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user @@ -204,7 +204,7 @@ namespace Umbraco.Core.Security /// We've allowed this check to be overridden with a simple callback so that developers don't actually /// have to implement/override this class. /// - public async override Task CheckPasswordAsync(T user, string password) + public override async Task CheckPasswordAsync(T user, string password) { if (BackOfficeUserPasswordChecker != null) { diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs index b1e02f234f..85d40eef7f 100644 --- a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs +++ b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs @@ -35,6 +35,7 @@ namespace Umbraco.Core.Sync private readonly ILogger _logger; private int _lastId = -1; private DateTime _lastSync; + private DateTime _lastPruned; private bool _initialized; private bool _syncing; private bool _released; @@ -50,7 +51,7 @@ namespace Umbraco.Core.Sync _appContext = appContext; _options = options; - _lastSync = DateTime.UtcNow; + _lastPruned = _lastSync = DateTime.UtcNow; _syncIdle = new ManualResetEvent(true); _profilingLogger = appContext.ProfilingLogger; _logger = appContext.ProfilingLogger.Logger; @@ -213,6 +214,12 @@ namespace Umbraco.Core.Sync using (_profilingLogger.DebugDuration("Syncing from database...")) { ProcessDatabaseInstructions(); + + if ((DateTime.UtcNow - _lastPruned).TotalSeconds <= _options.PruneThrottleSeconds) + return; + + _lastPruned = _lastSync; + switch (_appContext.GetCurrentServerRole()) { case ServerRole.Single: @@ -235,6 +242,9 @@ namespace Umbraco.Core.Sync /// /// Thread safety: this is NOT thread safe. Because it is NOT meant to run multi-threaded. /// + /// + /// Returns the number of processed instructions + /// private void ProcessDatabaseInstructions() { // NOTE @@ -313,32 +323,15 @@ namespace Umbraco.Core.Sync private void PruneOldInstructions() { var pruneDate = DateTime.UtcNow.AddDays(-_options.DaysToRetainInstructions); - var sqlSyntax = _appContext.DatabaseContext.SqlSyntax; - //NOTE: this query could work on SQL server and MySQL: - /* - SELECT id - FROM umbracoCacheInstruction - WHERE utcStamp < getdate() - AND id <> (SELECT MAX(id) FROM umbracoCacheInstruction) - */ - // However, this will not work on SQLCE and in fact it will be slower than the query we are - // using if the SQL server doesn't perform it's own query optimizations (i.e. since the above - // query could actually execute a sub query for every row found). So we've had to go with an - // inner join which is faster and works on SQLCE but it's uglier to read. + // using 2 queries is faster than convoluted joins - var deleteQuery = new Sql().Select("cacheIns.id") - .From("umbracoCacheInstruction cacheIns") - .InnerJoin("(SELECT MAX(id) id FROM umbracoCacheInstruction) tMax") - .On("cacheIns.id <> tMax.id") - .Where("cacheIns.utcStamp < @pruneDate", new {pruneDate = pruneDate}); + var maxId = _appContext.DatabaseContext.Database.ExecuteScalar("SELECT MAX(id) FROM umbracoCacheInstruction;"); - var deleteSql = sqlSyntax.GetDeleteSubquery( - "umbracoCacheInstruction", - "id", - deleteQuery); + var delete = new Sql().Append(@"DELETE FROM umbracoCacheInstruction WHERE utcStamp < @pruneDate AND id < @maxId", + new { pruneDate, maxId }); - _appContext.DatabaseContext.Database.Execute(deleteSql); + _appContext.DatabaseContext.Database.Execute(delete); } /// @@ -419,7 +412,7 @@ namespace Umbraco.Core.Sync /// Practically, all we really need is the guid, the other infos are here for information /// and debugging purposes. /// - protected readonly static string LocalIdentity = NetworkHelper.MachineName // eg DOMAIN\SERVER + protected static readonly string LocalIdentity = NetworkHelper.MachineName // eg DOMAIN\SERVER + "/" + HttpRuntime.AppDomainAppId // eg /LM/S3SVC/11/ROOT + " [P" + Process.GetCurrentProcess().Id // eg 1234 + "/D" + AppDomain.CurrentDomain.Id // eg 22 diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessengerOptions.cs b/src/Umbraco.Core/Sync/DatabaseServerMessengerOptions.cs index 7559c37813..c38a0c2568 100644 --- a/src/Umbraco.Core/Sync/DatabaseServerMessengerOptions.cs +++ b/src/Umbraco.Core/Sync/DatabaseServerMessengerOptions.cs @@ -16,6 +16,7 @@ namespace Umbraco.Core.Sync DaysToRetainInstructions = 2; // 2 days ThrottleSeconds = 5; // 5 second MaxProcessingInstructionCount = 1000; + PruneThrottleSeconds = 60; // 1 minute } /// @@ -41,5 +42,10 @@ namespace Umbraco.Core.Sync /// The number of seconds to wait between each sync operations. /// public int ThrottleSeconds { get; set; } + + /// + /// The number of seconds to wait between each prune operations. + /// + public int PruneThrottleSeconds { get; set; } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index ae8c53358f..5341867909 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -355,6 +355,8 @@ + + diff --git a/src/Umbraco.Tests/Cache/DeepCloneRuntimeCacheProviderTests.cs b/src/Umbraco.Tests/Cache/DeepCloneRuntimeCacheProviderTests.cs index d28a8c44e9..bea89dea0f 100644 --- a/src/Umbraco.Tests/Cache/DeepCloneRuntimeCacheProviderTests.cs +++ b/src/Umbraco.Tests/Cache/DeepCloneRuntimeCacheProviderTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Reflection; using System.Web; using NUnit.Framework; @@ -88,7 +89,7 @@ namespace Umbraco.Tests.Cache private static string GetValue(int i) { - Console.WriteLine("get" + i); + Debug.Print("get" + i); if (i < 3) throw new Exception("fail"); return "succ" + i; diff --git a/src/Umbraco.Tests/Cache/HttpRuntimeCacheProviderTests.cs b/src/Umbraco.Tests/Cache/HttpRuntimeCacheProviderTests.cs index 87e6d4366e..d1196b7d66 100644 --- a/src/Umbraco.Tests/Cache/HttpRuntimeCacheProviderTests.cs +++ b/src/Umbraco.Tests/Cache/HttpRuntimeCacheProviderTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Web; using NUnit.Framework; using Umbraco.Core.Cache; @@ -49,7 +50,7 @@ namespace Umbraco.Tests.Cache private static string GetValue(int i) { - Console.WriteLine("get" + i); + Debug.Print("get" + i); if (i < 3) throw new Exception("fail"); return "succ" + i; diff --git a/src/Umbraco.Tests/CoreXml/NavigableNavigatorTests.cs b/src/Umbraco.Tests/CoreXml/NavigableNavigatorTests.cs index f5175b2476..ea43a7426b 100644 --- a/src/Umbraco.Tests/CoreXml/NavigableNavigatorTests.cs +++ b/src/Umbraco.Tests/CoreXml/NavigableNavigatorTests.cs @@ -726,8 +726,8 @@ namespace Umbraco.Tests.CoreXml // but was NOT working (changing the order of nodes) with macro nav, debug // was due to an issue with macro nav IsSamePosition, fixed - //Console.WriteLine("--------"); - //Console.WriteLine(writer.ToString()); + //Debug.Print("--------"); + //Debug.Print(writer.ToString()); Assert.AreEqual(expected.Lf(), writer.ToString().Lf()); } diff --git a/src/Umbraco.Tests/DynamicsAndReflection/ExtensionMethodFinderTests.cs b/src/Umbraco.Tests/DynamicsAndReflection/ExtensionMethodFinderTests.cs index 33965c40c5..550310d164 100644 --- a/src/Umbraco.Tests/DynamicsAndReflection/ExtensionMethodFinderTests.cs +++ b/src/Umbraco.Tests/DynamicsAndReflection/ExtensionMethodFinderTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; using System.Text; @@ -305,7 +306,7 @@ namespace Umbraco.Tests.DynamicsAndReflection var parameterType = parameters[i].ParameterType; var argumentType = arguments[i].GetType(); - Console.WriteLine("{0} / {1}", parameterType, argumentType); + Debug.Print("{0} / {1}", parameterType, argumentType); if (parameterType == argumentType) continue; // match if (parameterType.IsGenericParameter) // eg T @@ -334,7 +335,7 @@ namespace Umbraco.Tests.DynamicsAndReflection // then what ?! // should _variance_ be of some importance? - Console.WriteLine("generic {0}", argumentType.IsGenericType); + Debug.Print("generic {0}", argumentType.IsGenericType); } else { diff --git a/src/Umbraco.Tests/LibraryTests.cs b/src/Umbraco.Tests/LibraryTests.cs index 2039192d7d..f068a29340 100644 --- a/src/Umbraco.Tests/LibraryTests.cs +++ b/src/Umbraco.Tests/LibraryTests.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; - +using System.Diagnostics; using System.IO; using System.Linq; using System.Text; @@ -42,7 +42,7 @@ namespace Umbraco.Tests }; var type = new AutoPublishedContentType(0, "anything", propertyTypes); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; - Console.WriteLine("INIT LIB {0}", + Debug.Print("INIT LIB {0}", PublishedContentType.Get(PublishedItemType.Content, "anything") .PropertyTypes.Count()); diff --git a/src/Umbraco.Tests/Logging/AsyncRollingFileAppenderTest.cs b/src/Umbraco.Tests/Logging/AsyncRollingFileAppenderTest.cs index ddd1c19095..c5e37f424a 100644 --- a/src/Umbraco.Tests/Logging/AsyncRollingFileAppenderTest.cs +++ b/src/Umbraco.Tests/Logging/AsyncRollingFileAppenderTest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; @@ -160,7 +161,7 @@ namespace Umbraco.Tests.Logging // Assert var logsPerSecond = logCount / testDuration.TotalSeconds; - Console.WriteLine("{0} messages logged in {1}s => {2}/s", logCount, testDuration.TotalSeconds, logsPerSecond); + Debug.Print("{0} messages logged in {1}s => {2}/s", logCount, testDuration.TotalSeconds, logsPerSecond); Assert.That(logsPerSecond, Is.GreaterThan(1000), "Must log at least 1000 messages per second"); } } diff --git a/src/Umbraco.Tests/Logging/ParallelForwarderTest.cs b/src/Umbraco.Tests/Logging/ParallelForwarderTest.cs index da5c58c0a9..88471ab650 100644 --- a/src/Umbraco.Tests/Logging/ParallelForwarderTest.cs +++ b/src/Umbraco.Tests/Logging/ParallelForwarderTest.cs @@ -120,7 +120,7 @@ namespace Umbraco.Tests.Logging // Assert Assert.That(debugAppender.LoggedEventCount, Is.EqualTo(0)); Assert.That(watch.ElapsedMilliseconds, Is.LessThan(testSize)); - Console.WriteLine("Logged {0} errors in {1}ms", testSize, watch.ElapsedMilliseconds); + Debug.Print("Logged {0} errors in {1}ms", testSize, watch.ElapsedMilliseconds); } [Test] @@ -171,7 +171,7 @@ namespace Umbraco.Tests.Logging //On some systems, we may not be able to flush all events prior to close, but it is reasonable to assume in this test case //that some events should be logged after close. Assert.That(numberLoggedAfterClose, Is.GreaterThan(numberLoggedBeforeClose), "Some number of LoggingEvents should be logged after close."); - Console.WriteLine("Flushed {0} events during shutdown", numberLoggedAfterClose - numberLoggedBeforeClose); + Debug.Print("Flushed {0} events during shutdown", numberLoggedAfterClose - numberLoggedBeforeClose); } [Test, Explicit("Long-running")] @@ -206,7 +206,7 @@ namespace Umbraco.Tests.Logging var events = debugAppender.GetEvents(); var evnt = events[events.Length - 1]; Assert.That(evnt.MessageObject, Is.EqualTo("The buffer was not able to be flushed before timeout occurred.")); - Console.WriteLine("Flushed {0} events during shutdown which lasted {1}ms", numberLoggedAfterClose - numberLoggedBeforeClose, watch.ElapsedMilliseconds); + Debug.Print("Flushed {0} events during shutdown which lasted {1}ms", numberLoggedAfterClose - numberLoggedBeforeClose, watch.ElapsedMilliseconds); } [Test] diff --git a/src/Umbraco.Tests/Migrations/AlterMigrationTests.cs b/src/Umbraco.Tests/Migrations/AlterMigrationTests.cs index 92ad73aeab..9f185d26be 100644 --- a/src/Umbraco.Tests/Migrations/AlterMigrationTests.cs +++ b/src/Umbraco.Tests/Migrations/AlterMigrationTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Data.Common; using System.Linq; using Moq; @@ -61,11 +62,11 @@ namespace Umbraco.Tests.Migrations Assert.That(context.Expressions.Any(), Is.True); //Console output - Console.WriteLine("Number of expressions in context: {0}", context.Expressions.Count); - Console.WriteLine(""); + Debug.Print("Number of expressions in context: {0}", context.Expressions.Count); + Debug.Print(""); foreach (var expression in context.Expressions) { - Console.WriteLine(expression.ToString()); + Debug.Print(expression.ToString()); } } } diff --git a/src/Umbraco.Tests/Migrations/FindingMigrationsTest.cs b/src/Umbraco.Tests/Migrations/FindingMigrationsTest.cs index c49015f93a..961f52c992 100644 --- a/src/Umbraco.Tests/Migrations/FindingMigrationsTest.cs +++ b/src/Umbraco.Tests/Migrations/FindingMigrationsTest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Data; using System.Linq; using LightInject; @@ -72,7 +73,7 @@ namespace Umbraco.Tests.Migrations //Console output foreach (var expression in context.Expressions) { - Console.WriteLine(expression.ToString()); + Debug.Print(expression.ToString()); } } } diff --git a/src/Umbraco.Tests/Migrations/MigrationIssuesTests.cs b/src/Umbraco.Tests/Migrations/MigrationIssuesTests.cs index 8df9b8e142..9c3446be9b 100644 --- a/src/Umbraco.Tests/Migrations/MigrationIssuesTests.cs +++ b/src/Umbraco.Tests/Migrations/MigrationIssuesTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using Moq; using NUnit.Framework; @@ -77,14 +78,16 @@ namespace Umbraco.Tests.Migrations { NodeId = n.NodeId, PropertyTypeId = pt.Id, - Text = "text" + Text = "text", + VersionId = Guid.NewGuid() }; DatabaseContext.Database.Insert(data); data = new PropertyDataDto { NodeId = n.NodeId, PropertyTypeId = pt.Id, - Text = "" + Text = "", + VersionId = Guid.NewGuid() }; DatabaseContext.Database.Insert(data); var migrationContext = new MigrationContext(DatabaseContext.Database, Logger); @@ -94,7 +97,7 @@ namespace Umbraco.Tests.Migrations data = DatabaseContext.Database.Fetch("SELECT * FROM cmsPropertyData WHERE id=" + data.Id).FirstOrDefault(); Assert.IsNotNull(data); - Console.WriteLine(data.Text); + Debug.Print(data.Text); Assert.AreEqual("[{\"title\":\"\",\"caption\":\"\",\"link\":\"\",\"newWindow\":false,\"type\":\"external\",\"internal\":null,\"edit\":false,\"isInternal\":false}]", data.Text); } diff --git a/src/Umbraco.Tests/Models/ContentTests.cs b/src/Umbraco.Tests/Models/ContentTests.cs index 6f54e8624b..7b2863d583 100644 --- a/src/Umbraco.Tests/Models/ContentTests.cs +++ b/src/Umbraco.Tests/Models/ContentTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -412,7 +413,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(content); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } /*[Test] diff --git a/src/Umbraco.Tests/Models/ContentTypeTests.cs b/src/Umbraco.Tests/Models/ContentTypeTests.cs index 70208c3424..3ae6a62ee6 100644 --- a/src/Umbraco.Tests/Models/ContentTypeTests.cs +++ b/src/Umbraco.Tests/Models/ContentTypeTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using Umbraco.Core; @@ -285,7 +286,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(contentType); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } [Test] @@ -390,7 +391,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(contentType); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } [Test] @@ -498,7 +499,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(contentType); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/DataTypeDefinitionTests.cs b/src/Umbraco.Tests/Models/DataTypeDefinitionTests.cs index aebde47553..2a5ad55e1b 100644 --- a/src/Umbraco.Tests/Models/DataTypeDefinitionTests.cs +++ b/src/Umbraco.Tests/Models/DataTypeDefinitionTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -75,7 +76,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(dtd); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } diff --git a/src/Umbraco.Tests/Models/DictionaryItemTests.cs b/src/Umbraco.Tests/Models/DictionaryItemTests.cs index ff57b5eec6..ab60ccd709 100644 --- a/src/Umbraco.Tests/Models/DictionaryItemTests.cs +++ b/src/Umbraco.Tests/Models/DictionaryItemTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using Umbraco.Core.Models; @@ -130,7 +131,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/DictionaryTranslationTests.cs b/src/Umbraco.Tests/Models/DictionaryTranslationTests.cs index 46d6ea1022..c69047d94e 100644 --- a/src/Umbraco.Tests/Models/DictionaryTranslationTests.cs +++ b/src/Umbraco.Tests/Models/DictionaryTranslationTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using Umbraco.Core.Models; @@ -74,7 +75,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/LanguageTests.cs b/src/Umbraco.Tests/Models/LanguageTests.cs index 5d79364fb5..dc6b7bf989 100644 --- a/src/Umbraco.Tests/Models/LanguageTests.cs +++ b/src/Umbraco.Tests/Models/LanguageTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -56,7 +57,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/MemberGroupTests.cs b/src/Umbraco.Tests/Models/MemberGroupTests.cs index d39ddc93f3..ed208540ff 100644 --- a/src/Umbraco.Tests/Models/MemberGroupTests.cs +++ b/src/Umbraco.Tests/Models/MemberGroupTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -66,7 +67,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(group); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } diff --git a/src/Umbraco.Tests/Models/MemberTests.cs b/src/Umbraco.Tests/Models/MemberTests.cs index 62e3602232..ff1847d8ea 100644 --- a/src/Umbraco.Tests/Models/MemberTests.cs +++ b/src/Umbraco.Tests/Models/MemberTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using Umbraco.Core.Models; @@ -150,7 +151,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(member); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/PropertyGroupTests.cs b/src/Umbraco.Tests/Models/PropertyGroupTests.cs index ec345051ec..683b9b2adf 100644 --- a/src/Umbraco.Tests/Models/PropertyGroupTests.cs +++ b/src/Umbraco.Tests/Models/PropertyGroupTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -136,7 +137,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(pg); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/PropertyTypeTests.cs b/src/Umbraco.Tests/Models/PropertyTypeTests.cs index 96f28980ab..82c7521554 100644 --- a/src/Umbraco.Tests/Models/PropertyTypeTests.cs +++ b/src/Umbraco.Tests/Models/PropertyTypeTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -80,7 +81,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(pt); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } diff --git a/src/Umbraco.Tests/Models/RelationTests.cs b/src/Umbraco.Tests/Models/RelationTests.cs index fdc3ae874b..e1d218ef6e 100644 --- a/src/Umbraco.Tests/Models/RelationTests.cs +++ b/src/Umbraco.Tests/Models/RelationTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -65,7 +66,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/RelationTypeTests.cs b/src/Umbraco.Tests/Models/RelationTypeTests.cs index 2022ab912d..526dfdb3f6 100644 --- a/src/Umbraco.Tests/Models/RelationTypeTests.cs +++ b/src/Umbraco.Tests/Models/RelationTypeTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -59,7 +60,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/StylesheetTests.cs b/src/Umbraco.Tests/Models/StylesheetTests.cs index 24c0b64c88..ec6761e0e2 100644 --- a/src/Umbraco.Tests/Models/StylesheetTests.cs +++ b/src/Umbraco.Tests/Models/StylesheetTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using Umbraco.Core.Models; @@ -112,7 +113,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(stylesheet); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/TaskTests.cs b/src/Umbraco.Tests/Models/TaskTests.cs index 377746cbaf..54b62fcfa9 100644 --- a/src/Umbraco.Tests/Models/TaskTests.cs +++ b/src/Umbraco.Tests/Models/TaskTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -70,7 +71,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } diff --git a/src/Umbraco.Tests/Models/TaskTypeTests.cs b/src/Umbraco.Tests/Models/TaskTypeTests.cs index e83f8dc3cf..26d3a5d3dd 100644 --- a/src/Umbraco.Tests/Models/TaskTypeTests.cs +++ b/src/Umbraco.Tests/Models/TaskTypeTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -55,7 +56,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/TemplateTests.cs b/src/Umbraco.Tests/Models/TemplateTests.cs index a810d9420f..e279851b77 100644 --- a/src/Umbraco.Tests/Models/TemplateTests.cs +++ b/src/Umbraco.Tests/Models/TemplateTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using System.Reflection; using NUnit.Framework; @@ -75,7 +76,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } diff --git a/src/Umbraco.Tests/Models/UmbracoEntityTests.cs b/src/Umbraco.Tests/Models/UmbracoEntityTests.cs index 52513d551d..651e955f33 100644 --- a/src/Umbraco.Tests/Models/UmbracoEntityTests.cs +++ b/src/Umbraco.Tests/Models/UmbracoEntityTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Serialization; @@ -133,7 +134,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/UserTests.cs b/src/Umbraco.Tests/Models/UserTests.cs index c686a78dc8..189a4a17a8 100644 --- a/src/Umbraco.Tests/Models/UserTests.cs +++ b/src/Umbraco.Tests/Models/UserTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using Umbraco.Core.Models.Membership; @@ -108,7 +109,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/UserTypeTests.cs b/src/Umbraco.Tests/Models/UserTypeTests.cs index 01e4d6fd89..72aa0b2efc 100644 --- a/src/Umbraco.Tests/Models/UserTypeTests.cs +++ b/src/Umbraco.Tests/Models/UserTypeTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using NUnit.Framework; using Umbraco.Core.Models.Membership; @@ -54,7 +55,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Console.WriteLine(json); + Debug.Print(json); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Querying/ContentRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/ContentRepositorySqlClausesTest.cs index d926d3ce43..87cab2acf0 100644 --- a/src/Umbraco.Tests/Persistence/Querying/ContentRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/ContentRepositorySqlClausesTest.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NPoco; using NUnit.Framework; using Umbraco.Core; @@ -43,7 +44,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -80,7 +81,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -121,7 +122,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -152,7 +153,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Querying/ContentTypeRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/ContentTypeRepositorySqlClausesTest.cs index 6c16ce927a..f6001c50f8 100644 --- a/src/Umbraco.Tests/Persistence/Querying/ContentTypeRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/ContentTypeRepositorySqlClausesTest.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NPoco; using NUnit.Framework; using Umbraco.Core; @@ -45,7 +46,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -83,7 +84,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -105,7 +106,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.That(sql.SQL, Is.EqualTo(expected.SQL)); - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -129,7 +130,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -159,7 +160,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs index 5ba86af69d..c8c30b09c6 100644 --- a/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NPoco; using NUnit.Framework; using Umbraco.Core; @@ -37,7 +38,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Querying/ExpressionTests.cs b/src/Umbraco.Tests/Persistence/Querying/ExpressionTests.cs index eec1bd754f..a8dd0b3707 100644 --- a/src/Umbraco.Tests/Persistence/Querying/ExpressionTests.cs +++ b/src/Umbraco.Tests/Persistence/Querying/ExpressionTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq.Expressions; using Moq; using NPoco; @@ -26,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Querying // var modelToSqlExpressionHelper = new ModelToSqlExpressionHelper(); // var result = modelToSqlExpressionHelper.Visit(predicate); - // Console.WriteLine("Model to Sql ExpressionHelper: \n" + result); + // Debug.Print("Model to Sql ExpressionHelper: \n" + result); // Assert.AreEqual("[cmsContentType].[alias] = @0", result); // Assert.AreEqual("Test", modelToSqlExpressionHelper.GetSqlParameters()[0]); @@ -40,7 +41,7 @@ namespace Umbraco.Tests.Persistence.Querying var modelToSqlExpressionHelper = new ModelToSqlExpressionHelper(SqlContext.SqlSyntax, new ContentMapper()); var result = modelToSqlExpressionHelper.Visit(predicate); - Console.WriteLine("Model to Sql ExpressionHelper: \n" + result); + Debug.Print("Model to Sql ExpressionHelper: \n" + result); Assert.AreEqual("upper([umbracoNode].[path]) LIKE upper(@0)", result); Assert.AreEqual("-1%", modelToSqlExpressionHelper.GetSqlParameters()[0]); @@ -54,7 +55,7 @@ namespace Umbraco.Tests.Persistence.Querying var modelToSqlExpressionHelper = new ModelToSqlExpressionHelper(SqlContext.SqlSyntax, new ContentMapper()); var result = modelToSqlExpressionHelper.Visit(predicate); - Console.WriteLine("Model to Sql ExpressionHelper: \n" + result); + Debug.Print("Model to Sql ExpressionHelper: \n" + result); Assert.AreEqual("([umbracoNode].[parentID] = @0)", result); Assert.AreEqual(-1, modelToSqlExpressionHelper.GetSqlParameters()[0]); @@ -67,7 +68,7 @@ namespace Umbraco.Tests.Persistence.Querying var modelToSqlExpressionHelper = new ModelToSqlExpressionHelper(SqlContext.SqlSyntax, new UserMapper()); var result = modelToSqlExpressionHelper.Visit(predicate); - Console.WriteLine("Model to Sql ExpressionHelper: \n" + result); + Debug.Print("Model to Sql ExpressionHelper: \n" + result); Assert.AreEqual("([umbracoUser].[userLogin] = @0)", result); Assert.AreEqual("hello@world.com", modelToSqlExpressionHelper.GetSqlParameters()[0]); @@ -81,7 +82,7 @@ namespace Umbraco.Tests.Persistence.Querying var modelToSqlExpressionHelper = new ModelToSqlExpressionHelper(SqlContext.SqlSyntax, new UserMapper()); var result = modelToSqlExpressionHelper.Visit(predicate); - Console.WriteLine("Model to Sql ExpressionHelper: \n" + result); + Debug.Print("Model to Sql ExpressionHelper: \n" + result); Assert.AreEqual("upper([umbracoUser].[userLogin]) = upper(@0)", result); Assert.AreEqual("hello@world.com", modelToSqlExpressionHelper.GetSqlParameters()[0]); @@ -98,7 +99,7 @@ namespace Umbraco.Tests.Persistence.Querying var modelToSqlExpressionHelper = new ModelToSqlExpressionHelper(sqlContext.SqlSyntax, new UserMapper()); var result = modelToSqlExpressionHelper.Visit(predicate); - Console.WriteLine("Model to Sql ExpressionHelper: \n" + result); + Debug.Print("Model to Sql ExpressionHelper: \n" + result); Assert.AreEqual("upper(`umbracoUser`.`userLogin`) = upper(@0)", result); Assert.AreEqual("mydomain\\myuser", modelToSqlExpressionHelper.GetSqlParameters()[0]); @@ -116,7 +117,7 @@ namespace Umbraco.Tests.Persistence.Querying var modelToSqlExpressionHelper = new PocoToSqlExpressionHelper(sqlContext); var result = modelToSqlExpressionHelper.Visit(predicate); - Console.WriteLine("Poco to Sql ExpressionHelper: \n" + result); + Debug.Print("Poco to Sql ExpressionHelper: \n" + result); Assert.AreEqual("upper(`umbracoUser`.`userLogin`) LIKE upper(@0)", result); Assert.AreEqual("mydomain\\myuser%", modelToSqlExpressionHelper.GetSqlParameters()[0]); diff --git a/src/Umbraco.Tests/Persistence/Querying/MediaRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/MediaRepositorySqlClausesTest.cs index 6fcbd6643e..33214cc3a1 100644 --- a/src/Umbraco.Tests/Persistence/Querying/MediaRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/MediaRepositorySqlClausesTest.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NPoco; using NUnit.Framework; using Umbraco.Core; @@ -40,7 +41,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Querying/MediaTypeRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/MediaTypeRepositorySqlClausesTest.cs index f1893f6ee5..fbf38327b5 100644 --- a/src/Umbraco.Tests/Persistence/Querying/MediaTypeRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/MediaTypeRepositorySqlClausesTest.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NPoco; using NUnit.Framework; using Umbraco.Core; @@ -37,7 +38,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(expected.Arguments[i], sql.Arguments[i]); } - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Querying/NPocoSqlTests.cs b/src/Umbraco.Tests/Persistence/Querying/NPocoSqlTests.cs index de0081be23..461f934bb2 100644 --- a/src/Umbraco.Tests/Persistence/Querying/NPocoSqlTests.cs +++ b/src/Umbraco.Tests/Persistence/Querying/NPocoSqlTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NPoco; using NUnit.Framework; using Umbraco.Core.Models.Rdbms; @@ -186,7 +187,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.That(sql.SQL, Is.EqualTo(expected.SQL)); - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -205,7 +206,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.That(sql.SQL, Is.EqualTo(expected.SQL)); - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -219,7 +220,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.That(sql.SQL, Is.EqualTo(expected.SQL)); - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -233,7 +234,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.That(sql.SQL, Is.EqualTo(expected.SQL)); - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -247,7 +248,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.That(sql.SQL, Is.EqualTo(expected.SQL)); - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } [Test] @@ -267,7 +268,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.That(sql.SQL, Is.EqualTo(expected.SQL)); - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Querying/QueryBuilderTests.cs b/src/Umbraco.Tests/Persistence/Querying/QueryBuilderTests.cs index 9844e6fb26..489c13fcf9 100644 --- a/src/Umbraco.Tests/Persistence/Querying/QueryBuilderTests.cs +++ b/src/Umbraco.Tests/Persistence/Querying/QueryBuilderTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using NPoco; using NUnit.Framework; using Umbraco.Core; @@ -39,7 +40,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(1, result.Arguments.Length); Assert.AreEqual("-1%", sql.Arguments[0]); - Console.WriteLine(strResult); + Debug.Print(strResult); } [Test] @@ -66,7 +67,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(1, result.Arguments.Length); Assert.AreEqual(-1, sql.Arguments[0]); - Console.WriteLine(strResult); + Debug.Print(strResult); } [Test] @@ -92,7 +93,7 @@ namespace Umbraco.Tests.Persistence.Querying Assert.AreEqual(1, result.Arguments.Length); Assert.AreEqual("umbTextpage", sql.Arguments[0]); - Console.WriteLine(strResult); + Debug.Print(strResult); } [Test] @@ -122,7 +123,7 @@ namespace Umbraco.Tests.Persistence.Querying var strResult = result.SQL; // Assert - Console.WriteLine(strResult); + Debug.Print(strResult); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs index 6aef69999f..218ac61253 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using System.Xml.Linq; using Moq; @@ -343,7 +344,7 @@ namespace Umbraco.Tests.Persistence.Repositories .OrderByDescending(x => x.VersionDate) .OrderBy(x => x.SortOrder); - Console.WriteLine(sql.SQL); + Debug.Print(sql.SQL); Assert.That(sql.SQL, Is.Not.Empty); } diff --git a/src/Umbraco.Tests/Persistence/SyntaxProvider/SqlCeSyntaxProviderTests.cs b/src/Umbraco.Tests/Persistence/SyntaxProvider/SqlCeSyntaxProviderTests.cs index 72e58295a6..767069da8c 100644 --- a/src/Umbraco.Tests/Persistence/SyntaxProvider/SqlCeSyntaxProviderTests.cs +++ b/src/Umbraco.Tests/Persistence/SyntaxProvider/SqlCeSyntaxProviderTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Data.Common; using Moq; using NPoco; @@ -58,16 +59,16 @@ WHERE (([umbracoNode].[nodeObjectType] = @0))) x)".Replace(Environment.NewLine, var indexes = SqlContext.SqlSyntax.Format(definition.Indexes); var keys = SqlContext.SqlSyntax.Format(definition.ForeignKeys); - Console.WriteLine(create); - Console.WriteLine(primaryKey); + Debug.Print(create); + Debug.Print(primaryKey); foreach (var sql in keys) { - Console.WriteLine(sql); + Debug.Print(sql); } foreach (var sql in indexes) { - Console.WriteLine(sql); + Debug.Print(sql); } } diff --git a/src/Umbraco.Tests/Services/ContentServicePerformanceTest.cs b/src/Umbraco.Tests/Services/ContentServicePerformanceTest.cs index 81f9cc8fa8..486cff70f5 100644 --- a/src/Umbraco.Tests/Services/ContentServicePerformanceTest.cs +++ b/src/Umbraco.Tests/Services/ContentServicePerformanceTest.cs @@ -112,7 +112,7 @@ namespace Umbraco.Tests.Services watch.Stop(); var elapsed = watch.ElapsedMilliseconds; - Console.WriteLine("100 content items saved in {0} ms", elapsed); + Debug.Print("100 content items saved in {0} ms", elapsed); // Assert Assert.That(pages.Any(x => x.HasIdentity == false), Is.False); @@ -131,7 +131,7 @@ namespace Umbraco.Tests.Services watch.Stop(); var elapsed = watch.ElapsedMilliseconds; - Console.WriteLine("100 content items saved in {0} ms", elapsed); + Debug.Print("100 content items saved in {0} ms", elapsed); // Assert Assert.That(pages.Any(x => x.HasIdentity == false), Is.False); @@ -159,7 +159,7 @@ namespace Umbraco.Tests.Services watch.Stop(); var elapsed = watch.ElapsedMilliseconds; - Console.WriteLine("100 content items retrieved in {0} ms without caching", elapsed); + Debug.Print("100 content items retrieved in {0} ms without caching", elapsed); // Assert Assert.That(contents.Any(x => x.HasIdentity == false), Is.False); @@ -191,7 +191,7 @@ namespace Umbraco.Tests.Services watch.Stop(); var elapsed = watch.ElapsedMilliseconds; - Console.WriteLine("1000 content items retrieved in {0} ms without caching", elapsed); + Debug.Print("1000 content items retrieved in {0} ms without caching", elapsed); // Assert //Assert.That(contents.Any(x => x.HasIdentity == false), Is.False); @@ -223,7 +223,7 @@ namespace Umbraco.Tests.Services watch.Stop(); var elapsed = watch.ElapsedMilliseconds; - Console.WriteLine("100 content items retrieved in {0} ms with caching", elapsed); + Debug.Print("100 content items retrieved in {0} ms with caching", elapsed); // Assert Assert.That(contentsCached.Any(x => x.HasIdentity == false), Is.False); @@ -256,7 +256,7 @@ namespace Umbraco.Tests.Services watch.Stop(); var elapsed = watch.ElapsedMilliseconds; - Console.WriteLine("1000 content items retrieved in {0} ms with caching", elapsed); + Debug.Print("1000 content items retrieved in {0} ms with caching", elapsed); // Assert //Assert.That(contentsCached.Any(x => x.HasIdentity == false), Is.False); diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index 0405e3c3dc..20017625a5 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading; using Moq; @@ -1742,7 +1743,7 @@ namespace Umbraco.Tests.Services list.Add(content); list.AddRange(CreateChildrenOf(contentType, content, 4)); - Console.WriteLine("Created: 'Hierarchy Simple Text Page {0}'", i); + Debug.Print("Created: 'Hierarchy Simple Text Page {0}'", i); } return list; @@ -1756,7 +1757,7 @@ namespace Umbraco.Tests.Services var c = MockedContent.CreateSimpleContent(contentType, "Hierarchy Simple Text Subpage " + i, content); list.Add(c); - Console.WriteLine("Created: 'Hierarchy Simple Text Subpage {0}' - Depth: {1}", i, depth); + Debug.Print("Created: 'Hierarchy Simple Text Subpage {0}' - Depth: {1}", i, depth); } return list; } diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs index d31304004f..2fbaf75476 100644 --- a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs @@ -13,7 +13,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Services { - + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture, RequiresSTA] public class ContentTypeServiceTests : BaseServiceTest @@ -633,7 +633,7 @@ namespace Umbraco.Tests.Services * -- Content Page * ---- Advanced Page -> Content Meta * Content Meta :: Composition, has 'Title' - * + * * Content Meta has 'Title' PropertyType * Adding 'Title' to BasePage should fail */ @@ -664,7 +664,7 @@ namespace Umbraco.Tests.Services }; var authorAdded = contentPage.AddPropertyType(authorPropertyType, "Content"); service.Save(contentPage); - + var compositionAdded = advancedPage.AddContentType(contentMetaComposition); service.Save(advancedPage); @@ -823,7 +823,7 @@ namespace Umbraco.Tests.Services }; var titleAdded = seoComposition.AddPropertyType(titlePropertyType, "Content"); service.Save(seoComposition); - + var seoCompositionAdded = advancedPage.AddContentType(seoComposition); var metaCompositionAdded = moreAdvancedPage.AddContentType(metaComposition); service.Save(advancedPage); @@ -930,7 +930,7 @@ namespace Umbraco.Tests.Services var subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "Content"); var authorPropertyType = new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext, "author") { - Name = "Author", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 + Name = "Author", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }; var authorAdded = advancedPage.AddPropertyType(authorPropertyType, "Content"); service.Save(basePage); @@ -1004,7 +1004,7 @@ namespace Umbraco.Tests.Services public void Can_Rename_PropertyGroup_With_Inherited_PropertyGroups() { //Related the first issue in screencast from this post http://issues.umbraco.org/issue/U4-5986 - + // Arrange var service = ServiceContext.ContentTypeService; @@ -1277,8 +1277,8 @@ namespace Umbraco.Tests.Services * - Content Page * -- Advanced Page * Content Meta :: Composition - */ - + */ + // Arrange var service = ServiceContext.ContentTypeService; var basePage = MockedContentTypes.CreateBasicContentType(); diff --git a/src/Umbraco.Tests/Services/PackagingServiceTests.cs b/src/Umbraco.Tests/Services/PackagingServiceTests.cs index 02bfa1293e..5b3db6c05e 100644 --- a/src/Umbraco.Tests/Services/PackagingServiceTests.cs +++ b/src/Umbraco.Tests/Services/PackagingServiceTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Xml.Linq; @@ -42,7 +43,7 @@ namespace Umbraco.Tests.Services Assert.That(element, Is.Not.Null); Assert.That(element.Element("name").Value, Is.EqualTo("Test")); Assert.That(element.Element("alias").Value, Is.EqualTo("test1")); - Console.Write(element.ToString()); + Debug.Print(element.ToString()); } [Test] diff --git a/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs b/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs index 68e28d7cff..7925ac0d1e 100644 --- a/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs +++ b/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.Linq; using System.Text; @@ -353,9 +354,9 @@ namespace Umbraco.Tests.Strings // then next string element is one char and 3 bytes, 16 bits of code point Assert.AreEqual('t', bytes[9]); //foreach (var b in bytes) - // Console.WriteLine("{0:X}", b); + // Debug.Print("{0:X}", b); - Console.WriteLine("\U00010B70"); + Debug.Print("\U00010B70"); } [Test] diff --git a/src/Umbraco.Tests/Strings/StringExtensionsTests.cs b/src/Umbraco.Tests/Strings/StringExtensionsTests.cs index 07ac002a48..199bd9254d 100644 --- a/src/Umbraco.Tests/Strings/StringExtensionsTests.cs +++ b/src/Umbraco.Tests/Strings/StringExtensionsTests.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Globalization; using NUnit.Framework; using Umbraco.Core; @@ -31,8 +32,8 @@ namespace Umbraco.Tests.Strings [TestCase("hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello", "hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello", true)] public void String_To_Guid(string first, string second, bool result) { - Console.WriteLine("First: " + first.ToGuid()); - Console.WriteLine("Second: " + second.ToGuid()); + Debug.Print("First: " + first.ToGuid()); + Debug.Print("Second: " + second.ToGuid()); Assert.AreEqual(result, first.ToGuid() == second.ToGuid()); } diff --git a/src/Umbraco.Tests/unit-test-log4net.CI.config b/src/Umbraco.Tests/unit-test-log4net.CI.config new file mode 100644 index 0000000000..d7035032ef --- /dev/null +++ b/src/Umbraco.Tests/unit-test-log4net.CI.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js index c9a45fd316..ba34a752ed 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js @@ -13,8 +13,8 @@ Use this directive to render an avatar. + img-src="{{vm.avatar[0].value}}" + img-srcset="{{vm.avatar[1].value}} 2x, {{vm.avatar[2].value}} 3x"> @@ -43,8 +43,8 @@ Use this directive to render an avatar. @param {string} size (attribute): The size of the avatar (xs, s, m, l, xl). -@param {string} src (attribute): The image source to the avatar. -@param {string} srcset (atribute): Reponsive support for the image source. +@param {string} img-src (attribute): The image source to the avatar. +@param {string} img-srcset (atribute): Reponsive support for the image source. **/ (function() { @@ -58,8 +58,8 @@ Use this directive to render an avatar. templateUrl: 'views/components/umb-avatar.html', scope: { size: "@", - src: "@", - srcset: "@" + imgSrc: "@", + imgSrcset: "@" } }; diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/package.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/package.resource.js index dffa116515..9dae2008e2 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/package.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/package.resource.js @@ -24,13 +24,22 @@ function packageResource($q, $http, umbDataFormatter, umbRequestHelper) { 'Failed to get installed packages'); }, + validateInstalled: function (name, version) { + return umbRequestHelper.resourcePromise( + $http.post( + umbRequestHelper.getApiUrl( + "packageInstallApiBaseUrl", + "ValidateInstalled", { name: name, version: version })), + 'Failed to validate package ' + name); + }, + deleteCreatedPackage: function (packageId) { return umbRequestHelper.resourcePromise( $http.post( umbRequestHelper.getApiUrl( "packageInstallApiBaseUrl", "DeleteCreatedPackage", { packageId: packageId })), - 'Failed to get installed packages'); + 'Failed to delete package ' + packageId); }, uninstall: function(packageId) { diff --git a/src/Umbraco.Web.UI.Client/src/installer/steps/upgrade.html b/src/Umbraco.Web.UI.Client/src/installer/steps/upgrade.html index 374772451b..5242fa8554 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/steps/upgrade.html +++ b/src/Umbraco.Web.UI.Client/src/installer/steps/upgrade.html @@ -3,10 +3,17 @@

Welcome to the Umbraco installer. You see this screen because your Umbraco installation needs a quick upgrade of its database and files, which will ensure your website is kept as fast, secure and up to date as possible.

+ +

+ To read a report of changes between your current version {{installer.current.model.currentVersion}} and this version your upgrading to {{installer.current.model.newVersion}} +

+

+ View Report +

+

Simply click continue below to be guided through the rest of the upgrade

-

diff --git a/src/Umbraco.Web.UI.Client/src/less/belle.less b/src/Umbraco.Web.UI.Client/src/less/belle.less index 8700bb8f36..3a55e87382 100644 --- a/src/Umbraco.Web.UI.Client/src/less/belle.less +++ b/src/Umbraco.Web.UI.Client/src/less/belle.less @@ -120,6 +120,12 @@ @import "components/notifications/umb-notifications.less"; @import "components/umb-file-dropzone.less"; +// Utilities +@import "utilities/_flexbox.less"; +@import "utilities/_spacing.less"; +@import "utilities/_text-align.less"; +@import "utilities/_width.less"; + //page specific styles @import "pages/document-type-editor.less"; @import "pages/login.less"; diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-package-local-install.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-package-local-install.less index a272a40c90..2a624b1c56 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-package-local-install.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-package-local-install.less @@ -1,42 +1,15 @@ -// -// Install local package -// +/* + + Install local package + +*/ // Helpers .faded { color: @grayMed; } -.inline-flex { - display: inline-flex; -} -.mt-3 { - margin-top: 30px; -} - -// Upload state - -.umb-upload-local, -.umb-info-local { - display: flex; - justify-content: center; - align-items: center; - text-align: center; -} - -.umb-upload-local form, -.umb-info-local-items { - display: flex; - flex-direction: column; - - justify-content: center; - align-items: center; - - margin: 0; - - max-width: 640px; -} .umb-upload-local__dropzone { position: relative; @@ -75,9 +48,14 @@ font-weight: bold; color: @blue; cursor: pointer; + + &:hover { + text-decoration: underline; + } } + // Accept terms .umb-accept-terms { display: flex; @@ -104,6 +82,7 @@ } + // Info state .umb-info-local-items { border: 2px solid @grayLight; @@ -116,6 +95,8 @@ align-items: center; margin: 0 20px; + + width: 100%; max-width: 540px; } @@ -127,9 +108,6 @@ } } -.umb-info-local-item { - margin-bottom: 20px; -} .umb-info-local-items .umb-package-icon { width: 100%; @@ -148,6 +126,10 @@ padding: 20px 40px; } -.umb-info-local-items .umb-package-installer-label { - margin-left: 10px; +.umb-info-local-item { + margin-bottom: 20px; +} + +.umb-upload-local__dropzone .umb-info-local-item { + margin:20px; } diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-packages.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-packages.less index 6c8a7156bc..d3af5164f1 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-packages.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-packages.less @@ -52,11 +52,55 @@ .umb-package { padding: 10px; box-sizing: border-box; - width: 25%; + flex: 0 0 100%; + max-width: 100%; +} + +@media (min-width: 768px) { + .umb-package { + flex: 0 0 50%; + max-width: 50%; + } +} + +@media (min-width: 1200px) { + .umb-package { + flex: 0 0 33.33%; + max-width: 33.33%; + } +} + +@media (min-width: 1400px) { + .umb-package { + flex: 0 0 25%; + max-width: 25%; + } +} + +@media (min-width: 1700px) { + .umb-package { + flex: 0 0 20%; + max-width: 20%; + } +} + + +@media (min-width: 1900px) { + .umb-package { + flex: 0 0 16.66%; + max-width: 16.66%; + } +} + +@media (min-width: 2200px) { + .umb-package { + flex: 0 0 14.28%; + max-width: 14.28%; + } } .umb-package-link { - display: flex; + display: block; flex-wrap: wrap; flex-direction: column; justify-content: center; @@ -104,6 +148,7 @@ .umb-package-icon img { max-width: 70px; + width: 70px; height: auto; } @@ -304,6 +349,48 @@ padding: 10px 0; } + +@media (max-width: 768px) { + .umb-packages-category { + width: 100%; + margin-top: 0; + margin-bottom: 15px !important; + margin-left: 0 !important; + margin-right: 0 !important; + } +} + +@media (max-width: 992px) { + .umb-packages-category { + border: 1px solid @grayLight; + margin: 5px; + flex: 0 0 auto; + + text-align: center; + padding: 10px; + + max-width: 100%; + + border-radius: 3px; + } +} + +@media (min-width: 1100px) and (max-width: 1300px) { + .umb-packages-category { + border: 1px solid @grayLight; + margin: 5px; + flex: 0 0 auto; + + text-align: center; + padding: 10px; + + max-width: 100%; + + border-radius: 3px; + } +} + + .umb-packages-category:hover, .umb-packages-category.-active { text-decoration: none; @@ -312,12 +399,14 @@ .umb-packages-category.-first { border-left: 1px solid @grayLight; - border-radius: 3px 0 0 3px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; } .umb-packages-category.-last { border-right: 1px solid @grayLight; - border-radius: 0 3px 3px 0; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; } /* PACKAGE DETAILS */ @@ -326,19 +415,24 @@ display: flex; } -.umb-package-details__back-link { +a.umb-package-details__back-link { font-weight: bold; - color: @grayMed; + color: @black; } .umb-package-details__back-link:hover { - color: @black; + color: @grayMed; text-decoration: none; } + +@sidebarwidthFlax: 350px; // Width of sidebar. Ugly hack because of old version of Less + .umb-package-details__main-content { flex: 1 1 auto; margin-right: 40px; + + width: ~"calc(100% - @{sidebarwidthFlax})"; // Make sure that the main content area doesn't gets affected by inline styling } .umb-package-details__sidebar { @@ -367,15 +461,17 @@ } .umb-package-details__information-item { - display: flex; - margin-bottom: 5px; + margin-bottom: 10px; font-size: 13px; } .umb-package-details__information-item-label { color: black; font-weight: bold; - margin-right: 3px; +} + +.umb-package-details__information-item-content { + word-break: break-word; } .umb-package-details__information-item-label-2 { @@ -440,12 +536,13 @@ } .umb-gallery__thumbnail { - flex: 1 1 100px; + flex: 0 1 100px; border: 1px solid @grayLight; border-radius: 3px; margin: 5px; padding: 10px; box-sizing: border-box; + max-width: 100px; } .umb-gallery__thumbnail:hover { diff --git a/src/Umbraco.Web.UI.Client/src/less/utilities/_flexbox.less b/src/Umbraco.Web.UI.Client/src/less/utilities/_flexbox.less new file mode 100644 index 0000000000..829aba08f7 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/less/utilities/_flexbox.less @@ -0,0 +1,43 @@ +/* + Flexbox +*/ + + +.flex { display: flex } + +.flex-column { flex-direction: column } +.flex-wrap { flex-wrap: wrap } + +.items-start { align-items: flex-start } +.items-end { align-items: flex-end } +.items-center { align-items: center } +.items-baseline { align-items: baseline } +.items-stretch { align-items: stretch } + +.self-start { align-self: flex-start } +.self-end { align-self: flex-end } +.self-center { align-self: center } +.self-baseline { align-self: baseline } +.self-stretch { align-self: stretch } + +.justify-start { justify-content: flex-start } +.justify-end { justify-content: flex-end } +.justify-center { justify-content: center } +.justify-between { justify-content: space-between } +.justify-around { justify-content: space-around } + +.content-start { align-content: flex-start } +.content-end { align-content: flex-end } +.content-center { align-content: center } +.content-between { align-content: space-between } +.content-around { align-content: space-around } +.content-stretch { align-content: stretch } + +/* 1. Fix for Chrome 44 bug. https://code.google.com/p/chromium/issues/detail?id=506893 */ +.flex-auto { + flex: 1 1 auto; + min-width: 0; /* 1 */ + min-height: 0; /* 1 */ +} + +.flex-none { flex: none } diff --git a/src/Umbraco.Web.UI.Client/src/less/utilities/_spacing.less b/src/Umbraco.Web.UI.Client/src/less/utilities/_spacing.less new file mode 100644 index 0000000000..64d86d7b6f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/less/utilities/_spacing.less @@ -0,0 +1,54 @@ +/* + + Spacing + +*/ + +@spacing-none: 0; +@spacing-extra-small: .25rem; +@spacing-small: .5rem; +@spacing-medium: 1rem; +@spacing-large: 2rem; +@spacing-extra-large: 4rem; +@spacing-extra-extra-large: 8rem; +@spacing-extra-extra-extra-large: 16rem; + +/* + SPACING + An eight step powers of two scale ranging from 0 to 16rem. + Namespaces are composable and thus highly grockable - check the legend below + Legend: + p = padding + m = margin + a = all + h = horizontal + v = vertical + t = top + r = right + b = bottom + l = left + 0 = none + 1 = 1st step in spacing scale + 2 = 2nd step in spacing scale + 3 = 3rd step in spacing scale + 4 = 4th step in spacing scale + 5 = 5th step in spacing scale + 6 = 6th step in spacing scale + 7 = 7th step in spacing scale +*/ + + +.m-center { + margin-left: auto; + margin-right: auto; +} + + +.mt0 { margin-top: @spacing-none; } +.mt1 { margin-top: @spacing-extra-small; } +.mt2 { margin-top: @spacing-small; } +.mt3 { margin-top: @spacing-medium; } +.mt4 { margin-top: @spacing-large; } +.mt5 { margin-top: @spacing-extra-large; } +.mt6 { margin-top: @spacing-extra-extra-large; } +.mt7 { margin-top: @spacing-extra-extra-extra-large; } diff --git a/src/Umbraco.Web.UI.Client/src/less/utilities/_text-align.less b/src/Umbraco.Web.UI.Client/src/less/utilities/_text-align.less new file mode 100644 index 0000000000..beff81d80c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/less/utilities/_text-align.less @@ -0,0 +1,7 @@ +/* + TEXT ALIGN +*/ + +.tl { text-align: left; } +.tr { text-align: right; } +.tc { text-align: center; } diff --git a/src/Umbraco.Web.UI.Client/src/less/utilities/_width.less b/src/Umbraco.Web.UI.Client/src/less/utilities/_width.less new file mode 100644 index 0000000000..a9f2fd3362 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/less/utilities/_width.less @@ -0,0 +1,26 @@ +/* + Width +*/ + + +/* Width Scale */ + +.w1 { width: 1rem; } +.w2 { width: 2rem; } +.w3 { width: 4rem; } +.w4 { width: 8rem; } +.w5 { width: 16rem; } + +.w-10 { width: 10%; } +.w-20 { width: 20%; } +.w-25 { width: 25%; } +.w-33 { width: 33%; } +.w-34 { width: 34%; } +.w-40 { width: 40%; } +.w-50 { width: 50%; } +.w-60 { width: 60%; } +.w-75 { width: 75%; } +.w-80 { width: 80%; } +.w-100 { width: 100%; } + +.w-auto { width: auto; } diff --git a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-sections.html b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-sections.html index 43af692d3a..e4fde787da 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-sections.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-sections.html @@ -5,8 +5,8 @@ + img-src="{{avatar[0].value}}" + img-srcset="{{avatar[1].value}} 2x, {{avatar[2].value}} 3x"> diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-avatar.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-avatar.html index 4fc0085988..1d23769db2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/umb-avatar.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-avatar.html @@ -1 +1 @@ - + diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js index 42ceb86964..53c0e0419d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js @@ -17,28 +17,28 @@ function startUpVideosDashboardController($scope, xmlhelper, $log, $http) { angular.module("umbraco").controller("Umbraco.Dashboard.StartupVideosController", startUpVideosDashboardController); -function FormsController($scope, $route, $cookieStore, packageResource) { +function FormsController($scope, $route, $cookieStore, packageResource, localizationService) { $scope.installForms = function(){ - $scope.state = "Installng package"; + $scope.state = localizationService.localize("packager_installStateDownloading"); packageResource .fetch("CD44CF39-3D71-4C19-B6EE-948E1FAF0525") .then(function(pack) { - $scope.state = "importing"; + $scope.state = localizationService.localize("packager_installStateImporting"); return packageResource.import(pack); }, $scope.error) .then(function(pack) { - $scope.state = "Installing"; + $scope.state = localizationService.localize("packager_installStateInstalling"); return packageResource.installFiles(pack); }, $scope.error) .then(function(pack) { - $scope.state = "Restarting, please wait..."; + $scope.state = localizationService.localize("packager_installStateRestarting"); return packageResource.installData(pack); }, $scope.error) .then(function(pack) { - $scope.state = "All done, your browser will now refresh"; + $scope.state = localizationService.localize("packager_installStateComplete"); return packageResource.cleanUp(pack); }, $scope.error) diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js index e335ddd365..d9c0d0774b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js @@ -19,22 +19,38 @@ vm.checkAllInGroup = checkAllInGroup; vm.openGroup = openGroup; vm.setViewState = setViewState; + vm.triggerChecks = triggerChecks; + vm.checksRunning = false; - // Get a (grouped) list of all health checks - healthCheckResource.getAllChecks().then( - function(response) { + vm.totalGroups = 0; + vm.totalGroupsChecked = 0; - // set number of checks which has been executed - for (var i = 0; i < response.length; i++) { - var group = response[i]; - group.checkCounter = 0; - checkAllInGroup(group, group.checks); + function triggerChecks(){ + + //Reset counter - inczse + + //Checks running - hide button that triggers check + //So we can't invoke multiple times & make further blocking requests + vm.checksRunning = true; + + // Get a (grouped) list of all health checks + healthCheckResource.getAllChecks().then( + function(response) { + + //Total number of groups + vm.totalGroups = response.length; + + // set number of checks which has been executed + for (var i = 0; i < response.length; i++) { + var group = response[i]; + group.checkCounter = 0; + checkAllInGroup(group, group.checks); + } + + vm.groups = response; } - - vm.groups = response; - - } - ); + ); + } function setGroupGlobalResultType(group) { @@ -104,6 +120,15 @@ if (group.checkCounter === checks.length) { setGroupGlobalResultType(group); group.loading = false; + + //This group of checks run - increment counter by one + vm.totalGroupsChecked++; + + //Once we have all done all checks for this group + //Verify if this was last group or not with counters & reset button + if(vm.totalGroups === vm.totalGroupsChecked){ + vm.checksRunning = false; + } } }); diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html b/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html index 2c60fa6868..1135d14c73 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html @@ -3,6 +3,8 @@

The health checker evaluates various areas of your site for best practice settings, configuration, potential problems, etc. You can easily fix problems by pressing a button.
You can add your own health checks, have a look at the documentation for more information about custom health checks.

+ +
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/category.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/category.controller.js deleted file mode 100644 index 61332e850f..0000000000 --- a/src/Umbraco.Web.UI.Client/src/views/packager/category.controller.js +++ /dev/null @@ -1,100 +0,0 @@ -(function () { - "use strict"; - - function PackagesCategoryController($scope, $routeParams) { - - var vm = this; - - vm.page = {}; - vm.page.name = "Category"; - - vm.selectCategory = selectCategory; - - vm.categories = [ - { - "icon": "icon-male-and-female", - "name": "All", - "active": false - }, - { - "icon": "icon-male-and-female", - "name": "Collaboration", - "active": true - }, - { - "icon": "icon-molecular-network", - "name": "Backoffice extensions" - }, - { - "icon": "icon-brackets", - "name": "Developer tools" - }, - { - "icon": "icon-wand", - "name": "Starter kits" - }, - { - "icon": "icon-medal", - "name": "Umbraco Pro" - }, - { - "icon": "icon-wrench", - "name": "Website utilities" - } - ]; - - vm.packages = [ - { - "name": "uSightly", - "description": "An HTML5 audio player based on jPlayer", - "karma": "1", - "downloads": "1672", - "icon":"https://our.umbraco.org/media/wiki/150283/635768313097111400_usightlylogopng.png?bgcolor=fff&height=154&width=281&format=png" - }, - { - "name": "Kill IE6", - "description": "A simple port of the IE6 warning script (http://code.google.com/p/ie6-upgrade-warning/) to use in your Umbraco websites.", - "karma": "11", - "downloads": "688", - "icon":"https://our.umbraco.org/media/wiki/9138/634697622367666000_offroadcode-100x100.png?bgcolor=fff&height=154&width=281&format=png" - }, - { - "name": "Examine Media Indexer", - "description": "CogUmbracoExamineMediaIndexer", - "karma": "3", - "downloads": "1329", - "icon":"https://our.umbraco.org/media/wiki/50703/634782902373558000_cogworks.jpg?bgcolor=fff&height=154&width=281&format=png" - }, - { - "name": "SVG Icon Picker", - "description": "A picker, for picking icons from an SVG spritesheet.", - "karma": "5", - "downloads": "8", - "icon":"https://our.umbraco.org/media/wiki/154472/635997115126742822_logopng.png?bgcolor=fff&height=154&width=281&format=png" - }, - { - "name": "Pipeline CRM", - "description": "Pipeline is a social CRM that lives in Umbraco back-office. It tracks opportunities and helps teams collaborate with timelines and tasks. It stores information about your customers and your interactions with them. It integrates with your website, capturing opportunities from forms and powering personal portals.", - "karma": "3", - "downloads": "105", - "icon":"https://our.umbraco.org/media/wiki/152476/635917291068518788_pipeline-crm-logopng.png?bgcolor=fff&height=154&width=281&format=png" - }, - { - "name": "CodeMirror", - "description": "CodeMirror Editor for Umbraco", - "karma": "1", - "downloads": "70", - "icon":"https://our.umbraco.org/media/wiki/151028/635810233171153461_logopng.png?bgcolor=fff&height=154&width=281&format=png" - } - ]; - - function selectCategory(category) { - - } - - - } - - angular.module("umbraco").controller("Umbraco.Editors.Packages.CategoryController", PackagesCategoryController); - -})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/category.html b/src/Umbraco.Web.UI.Client/src/views/packager/category.html deleted file mode 100644 index d408b21cd9..0000000000 --- a/src/Umbraco.Web.UI.Client/src/views/packager/category.html +++ /dev/null @@ -1,109 +0,0 @@ - diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/delete.controller.js index a0539464cf..134336afce 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packager/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/packager/delete.controller.js @@ -18,7 +18,6 @@ function PackageDeleteController($scope, packageResource, treeService, navigatio //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/details.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/details.controller.js deleted file mode 100644 index 7f4a48ebb9..0000000000 --- a/src/Umbraco.Web.UI.Client/src/views/packager/details.controller.js +++ /dev/null @@ -1,100 +0,0 @@ -(function () { - "use strict"; - - function PackageDetailsController($scope, $routeParams) { - - var vm = this; - - vm.page = {}; - - vm.package = { - "name": "Merchello", - "description": "<p>Merchello is a high performance, designer friendly, open source Umbraco ecommerce package built for the store owner.</p> <p><strong>What Merchello does for you</strong></p> <p>In version 1, Merchello supports a large variety of products with options that can be attached to a single warehouse, processes orders, manages taxes and shipping, and sends out email notifications to your customers. The beauty of Merchello is that while it oversees all of your products, orders, and store settings, it allows Umbraco to maintain your content. This seamless integration gives you the flexibility to build your store in any way imagineable on a robust platform capable of handling a wide variety of store sizes.</p> <p><strong>Find out more on our website</strong></p> <p><strong><a href="https://merchello.com">https://merchello.com</a></strong></p> <p><strong>Contribute</strong></p> <p>We would love and need your help. If you want to contribute to Merchello's core, the easiest way to get started is to fork the project on https://github.com/merchello/Merchello and open src/Merchello.sln in Visual Studio. We're excited to see what you do!</p> <p><strong>Starter Kit</strong></p> <p>We have built a simple starter kit for Merchello called Bazaar, and you can download it below in the package files tab.</p>", - "compatibility": [ - { - "version": "7.4.x", - "percentage": "100" - }, - { - "version": "7.3.x", - "percentage": "86" - }, - { - "version": "7.2.x", - "percentage": "93" - }, - { - "version": "7.1.x", - "percentage": "100" - } - ], - "information": { - "owner": "Rusty Swayne", - "ownerAvatar": "https://our.umbraco.org/media/upload/d476d257-a494-46d9-9a00-56c2f94a55c8/our-profile.jpg?width=200&height=200&mode=crop", - "ownerKarma": "2673", - "contributors": [ - { - "name": "Lee" - }, - { - "name": "Jason Prothero" - } - ], - "created": "18/12/2013", - "currentVersion": "2.0.0", - "netVersion": "4.5", - "license": "MIT", - "downloads": "4198", - "karma": "53" - }, - "externalSources": [ - { - "name": "Source code", - "url": "https://github.com/merchello/Merchello" - }, - { - "name": "Issue tracker", - "url": "http://issues.merchello.com/youtrack/oauth?state=%2Fyoutrack%2FrootGo" - } - ], - "images": [ - { - "thumbnail": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png?bgcolor=fff&height=154&width=281&format=png", - "source": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png" - }, - { - "thumbnail": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png?bgcolor=fff&height=154&width=281&format=png", - "source": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png" - }, - { - "thumbnail": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png?bgcolor=fff&height=154&width=281&format=png", - "source": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png" - }, - { - "thumbnail": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png?bgcolor=fff&height=154&width=281&format=png", - "source": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png" - }, - { - "thumbnail": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png?bgcolor=fff&height=154&width=281&format=png", - "source": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png" - }, - { - "thumbnail": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png?bgcolor=fff&height=154&width=281&format=png", - "source": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png" - }, - { - "thumbnail": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png?bgcolor=fff&height=154&width=281&format=png", - "source": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png" - }, - { - "thumbnail": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png?bgcolor=fff&height=154&width=281&format=png", - "source": "https://our.umbraco.org/media/wiki/104946/635591947547374885_Product-Listpng.png" - } - ] - }; - - } - - angular.module("umbraco").controller("Umbraco.Editors.Packages.DetailsController", PackageDetailsController); - -})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/details.html b/src/Umbraco.Web.UI.Client/src/views/packager/details.html deleted file mode 100644 index fa69f55407..0000000000 --- a/src/Umbraco.Web.UI.Client/src/views/packager/details.html +++ /dev/null @@ -1,141 +0,0 @@ -
- - - -
- - - - - - - - -
- -
- -
- - - -
- -
- -
- -
- -
-
-
- -
-
-
{{ vm.package.information.owner }}
-
- {{ vm.package.information.owner }} has {{ vm.package.information.ownerKarma }} karma points -
-
-
-
- -
-
Information
-
- -
-
Owner:
-
{{vm.package.information.owner}}
-
- -
-
Contributors:
- -
- -
-
Created:
-
{{vm.package.information.created}}
-
- -
-
Current version:
-
{{vm.package.information.created}}
-
- -
-
.Net Version:
-
{{vm.package.information.netVersion}}
-
- -
-
License:
-
{{vm.package.information.license}}
-
- -
-
Downloads:
-
{{vm.package.information.downloads}}
-
- -
-
Karma:
-
{{vm.package.information.karma}}
-
- -
-
- -
-
Compatibility
-
This project is compatible with the following versions as reported by community members who have downloaded this package:
-
-
- {{compatibility.version}} - ({{compatibility.percentage}}%) -
-
- -
-
-
- -
-
External sources
- - -
- -
- -
- -
- -
- -
- -
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/overview.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/overview.controller.js index c03b6cd230..369d919b7d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packager/overview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/packager/overview.controller.js @@ -1,17 +1,21 @@ (function () { "use strict"; - function PackagesOverviewController($scope, $route, $location, navigationService, $timeout, $cookieStore) { + function PackagesOverviewController($scope, $route, $location, navigationService, $timeout, localStorageService) { //Hack! // if there is a cookie value for packageInstallUri then we need to redirect there, - // the issue is that we still have webforms and we cannot go to a hash location and then window.reload + // the issue is that we still have webforms and we cannot go to a hash location and then window.reload // because it will double load it. // we will refresh and then navigate there. - - var installPackageUri = window.localStorage.getItem("packageInstallUri"); + + var installPackageUri = localStorageService.get("packageInstallUri"); if (installPackageUri) { - window.localStorage.removeItem("packageInstallUri"); + localStorageService.remove("packageInstallUri"); + } + if (installPackageUri && installPackageUri !== "installed") { + //navigate to the custom installer screen, if it is just "installed", then we'll + //show the installed view $location.path(installPackageUri).search(""); } else { @@ -24,17 +28,19 @@ "name": "Packages", "icon": "icon-cloud", "view": "views/packager/views/repo.html", - "active": true + "active": !installPackageUri || installPackageUri === "navigation" }, { "name": "Installed", "icon": "icon-box", - "view": "views/packager/views/installed.html" + "view": "views/packager/views/installed.html", + "active": installPackageUri === "installed" }, { "name": "Install local", "icon": "icon-add", - "view": "views/packager/views/install-local.html" + "view": "views/packager/views/install-local.html", + "active": installPackageUri === "local" } ]; diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js index 4d9f97718c..e29df0b9ae 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js @@ -1,7 +1,7 @@ (function () { "use strict"; - function PackagesInstallLocalController($scope, $route, $location, Upload, umbRequestHelper, packageResource, $cookieStore, $timeout, $q) { + function PackagesInstallLocalController($scope, $route, $location, Upload, umbRequestHelper, packageResource, localStorageService, $timeout, $window, localizationService) { var vm = this; vm.state = "upload"; @@ -9,7 +9,8 @@ vm.localPackage = {}; vm.installPackage = installPackage; vm.installState = { - status: "" + status: "", + progress:0 }; vm.zipFile = { uploadStatus: "idle", @@ -18,8 +19,10 @@ }; $scope.handleFiles = function (files, event) { - for (var i = 0; i < files.length; i++) { - upload(files[i]); + if (files) { + for (var i = 0; i < files.length; i++) { + upload(files[i]); + } } }; @@ -50,8 +53,6 @@ // Throw message back to user with the cause of the error vm.zipFile.serverErrorMessage = data.notifications[0].message; - //TODO: Handle the error in UI - } else { // set done status on file @@ -62,29 +63,32 @@ }).error(function (evt, status, headers, config) { - //TODO: Handle the error in UI - // set status done vm.zipFile.uploadStatus = "error"; - //if the service returns a detailed error - if (evt.InnerException) { - vm.zipFile.serverErrorMessage = evt.InnerException.ExceptionMessage; - - //Check if its the common "too large file" exception - if (evt.InnerException.StackTrace && evt.InnerException.StackTrace.indexOf("ValidateRequestEntityLength") > 0) { - vm.zipFile.serverErrorMessage = "File too large to upload"; - } - - } else if (evt.Message) { - file.serverErrorMessage = evt.Message; - } - // If file not found, server will return a 404 and display this message if (status === 404) { vm.zipFile.serverErrorMessage = "File not found"; } + else if (status == 400) { + //it's a validation error + vm.zipFile.serverErrorMessage = evt.message; + } + else { + //it's an unhandled error + //if the service returns a detailed error + if (evt.InnerException) { + vm.zipFile.serverErrorMessage = evt.InnerException.ExceptionMessage; + //Check if its the common "too large file" exception + if (evt.InnerException.StackTrace && evt.InnerException.StackTrace.indexOf("ValidateRequestEntityLength") > 0) { + vm.zipFile.serverErrorMessage = "File too large to upload"; + } + + } else if (evt.Message) { + file.serverErrorMessage = evt.Message; + } + } }); } @@ -95,23 +99,27 @@ } function installPackage() { - vm.installState.status = "Importing"; + vm.installState.status = localizationService.localize("packager_installStateImporting"); + vm.installState.progress = "0"; - //TODO: If any of these fail, will they keep calling the next one? packageResource .import(vm.localPackage) .then(function(pack) { - vm.installState.status = "Installing..."; + vm.installState.progress = "25"; + vm.installState.status = localizationService.localize("packager_installStateInstalling"); + vm.installState.progress = "50"; return packageResource.installFiles(pack); }, installError) .then(function(pack) { - vm.installState.status = "Restarting, please wait..."; + vm.installState.status = localizationService.localize("packager_installStateRestarting"); + vm.installState.progress = "75"; return packageResource.installData(pack); }, installError) .then(function(pack) { - vm.installState.status = "All done, your browser will now refresh, please wait..."; + vm.installState.status = localizationService.localize("packager_installStateComplete"); + vm.installState.progress = "100"; return packageResource.cleanUp(pack); }, installError) @@ -119,13 +127,17 @@ if (result.postInstallationPath) { //Put the redirect Uri in a cookie so we can use after reloading - window.localStorage.setItem("packageInstallUri", result.postInstallationPath); + localStorageService.set("packageInstallUri", result.postInstallationPath); + } + else { + //set to a constant value so it knows to just go to the installed view + localStorageService.set("packageInstallUri", "installed"); } - //reload on next digest (after cookie) - $timeout(function() { - window.location.reload(true); - }); + //reload on next digest (after cookie) + $timeout(function () { + $window.location.reload(true); + }); }, installError); diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.html b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.html index 97601d5438..ec8c1e5476 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.html +++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.html @@ -1,112 +1,137 @@ -
+
- -
-
+
- -
+ +
+ + + +
-
+
- - - Drop to upload + + + Drop to upload - -
- - or click here to choose files + +
+ - or click here to choose files +
+ +
+ {{vm.zipFile.serverErrorMessage}} +
-
-

Upload package

-

- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam -

+

Upload package

+

+ Install a local package by selecting it from your machine. Only install packages from sources you know and trust. +

- -
- - - -
-
- -
-
- - -
- - -
-

{{ vm.localPackage.name }}

- - - -
- Version - {{ vm.localPackage.version }} -
- - - -
- Read me -
- -
- -
- - -
-
- This package cannot be installed, it requires a minimum Umbraco version of {{vm.localPackage.umbracoVersion}} -
-
-

{{vm.installState.status}}

-
- -
-
+
+ + + + ← Cancel and upload another package + + + +
+ + +
+
+ +
+
+ + +
+ + +
+

{{ vm.localPackage.name }}

+ + + +
+ Version + {{ vm.localPackage.version }} +
+ + + +
+ Read me +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ This package cannot be installed, it requires a minimum Umbraco version of {{vm.localPackage.umbracoVersion}} +
+
+

{{vm.installState.status}}

+
+ +
+
+ +
+
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.controller.js index e2b5fb4de8..ce1d2cca0f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.controller.js @@ -1,7 +1,7 @@ (function () { "use strict"; - function PackagesInstalledController($scope, $route, $location, packageResource) { + function PackagesInstalledController($scope, $route, $location, packageResource, $timeout, $window, localStorageService, localizationService) { var vm = this; @@ -28,17 +28,27 @@ } function uninstallPackage(installedPackage) { - vm.installState.status = "Uninstalling package..."; + vm.installState.status = localizationService.localize("packager_installStateUninstalling"); + vm.installState.progress = "0"; + packageResource.uninstall(installedPackage.id) .then(function () { - if (installedPackage.files.length > 0) { - vm.installState.status = "All done, your browser will now refresh"; - var url = window.location.href + "?uninstalled=" + vm.package.packageGuid; - window.location.reload(true); + if (installedPackage.files.length > 0) { + vm.installState.status = localizationService.localize("packager_installStateComplete"); + vm.installState.progress = "100"; + + //set this flag so that on refresh it shows the installed packages list + localStorageService.set("packageInstallUri", "installed"); + + //reload on next digest (after cookie) + $timeout(function () { + $window.location.reload(true); + }); + } else { - init(); + init(); } }); } diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.html b/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.html index 7a445458f3..5da3c33a76 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.html +++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.html @@ -3,31 +3,43 @@
-
Installed packages
+
-
+
Installed packages
-
+
-
- - -
+
-
-
{{ installedPackage.name }}
-
- {{ installedPackage.version }} | {{ installedPackage.url }}| {{ installedPackage.author }} +
+ + +
+ +
+
{{ installedPackage.name }}
+
+ {{ installedPackage.version }} | {{ installedPackage.url }}| {{ installedPackage.author }} +
+
+ +
+
-
-
-
+ + +

You don’t have any packages installed.

+

You don’t have any packages installed. Either install a local package by selecting it from your machine, or browse through available packages using the "Package" icon in the top right of your screen."

+
+
@@ -39,11 +51,11 @@ -
+
-
+
@@ -65,7 +77,7 @@
@@ -74,19 +86,27 @@ {{ vm.package.readme }}
-
- +
+
+ +
+ + +
+

{{vm.installState.status}}

diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.controller.js index a28f1a761b..dc6dfe7da4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.controller.js @@ -1,7 +1,7 @@ (function () { "use strict"; - function PackagesRepoController($scope, $route, $location, $timeout, ourPackageRepositoryResource, $q, packageResource, $cookieStore) { + function PackagesRepoController($scope, $route, $location, $timeout, ourPackageRepositoryResource, $q, packageResource, localStorageService, localizationService) { var vm = this; @@ -11,11 +11,13 @@ vm.pagination = { pageNumber: 1, totalPages: 10, - pageSize: 8 + pageSize: 24 }; vm.searchQuery = ""; vm.installState = { - status: "" + status: "", + progress: 0, + type: "ok" }; vm.selectCategory = selectCategory; vm.showPackageDetails = showPackageDetails; @@ -27,10 +29,11 @@ vm.downloadPackage = downloadPackage; vm.openLightbox = openLightbox; vm.closeLightbox = closeLightbox; + vm.search = search; //used to cancel any request in progress if another one needs to take it's place var canceler = null; - + function getActiveCategory() { if (vm.searchQuery !== "") { return ""; @@ -38,7 +41,7 @@ for (var i = 0; i < vm.categories.length; i++) { if (vm.categories[i].active === true) { return vm.categories[i].name; - } + } } return ""; } @@ -66,41 +69,6 @@ vm.loading = false; }); - $scope.$watch(function() { - return vm.searchQuery; - }, _.debounce(function (newVal, oldVal) { - $scope.$apply(function () { - if (vm.searchQuery) { - if (newVal !== null && newVal !== undefined && newVal !== oldVal) { - vm.loading = true; - - //a canceler exists, so perform the cancelation operation and reset - if (canceler) { - canceler.resolve(); - canceler = $q.defer(); - } - else { - canceler = $q.defer(); - } - - ourPackageRepositoryResource.search(vm.pagination.pageNumber - 1, - vm.pagination.pageSize, - "", - vm.searchQuery, - canceler) - .then(function(pack) { - vm.packages = pack.packages; - vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); - vm.pagination.pageNumber = 1; - vm.loading = false; - //set back to null so it can be re-created - canceler = null; - }); - } - } - }); - }, 200)); - } function selectCategory(selectedCategory, categories) { @@ -121,7 +89,7 @@ searchCategory = ""; } - $q.all([ + $q.all([ ourPackageRepositoryResource.getPopular(8, searchCategory) .then(function(pack) { vm.popular = pack.packages; @@ -141,11 +109,20 @@ function showPackageDetails(selectedPackage) { ourPackageRepositoryResource.getDetails(selectedPackage.id) - .then(function(pack) { - vm.package = pack; - vm.packageViewState = "packageDetails"; + .then(function (pack) { + packageResource.validateInstalled(pack.name, pack.latestVersion) + .then(function() { + //ok, can install + vm.package = pack; + vm.package.isValid = true; + vm.packageViewState = "packageDetails"; + }, function() { + //nope, cannot install + vm.package = pack; + vm.package.isValid = false; + vm.packageViewState = "packageDetails"; + }) }); - } function setPackageViewState(state) { @@ -187,33 +164,44 @@ vm.packageViewState = "packageInstall"; vm.loading = false; vm.localPackage = pack; - vm.localPackage.allowed = true; - }, - error); + vm.localPackage.allowed = true; + }, function (evt, status, headers, config) { + + if (status == 400) { + //it's a validation error + vm.installState.type = "error"; + vm.zipFile.serverErrorMessage = evt.message; + } + }); } function error(e, args) { - + //This will return a rejection meaning that the promise change above will stop + return $q.reject(); } function installPackage(selectedPackage) { - - vm.installState.status = "importing..."; + + vm.installState.status = localizationService.localize("packager_installStateImporting"); + vm.installState.progress = "0"; packageResource - .import(selectedPackage) + .import(selectedPackage) .then(function(pack) { - vm.installState.status = "Installing..."; + vm.installState.status = localizationService.localize("packager_installStateInstalling"); + vm.installState.progress = "33"; return packageResource.installFiles(pack); }, error) .then(function(pack) { - vm.installState.status = "Restarting, please wait..."; + vm.installState.status = localizationService.localize("packager_installStateRestarting"); + vm.installState.progress = "66"; return packageResource.installData(pack); }, error) .then(function(pack) { - vm.installState.status = "All done, your browser will now refresh"; + vm.installState.status = localizationService.localize("packager_installStateComplete"); + vm.installState.progress = "100"; return packageResource.cleanUp(pack); }, error) @@ -221,11 +209,11 @@ if (result.postInstallationPath) { //Put the redirect Uri in a cookie so we can use after reloading - window.localStorage.setItem("packageInstallUri", result.postInstallationPath); + localStorageService.set("packageInstallUri", result.postInstallationPath); } - + //reload on next digest (after cookie) - $timeout(function () { + $timeout(function() { window.location.reload(true); }); @@ -246,6 +234,43 @@ vm.lightbox = null; } + + var searchDebounced = _.debounce(function(e) { + + $scope.$apply(function () { + + //a canceler exists, so perform the cancelation operation and reset + if (canceler) { + canceler.resolve(); + canceler = $q.defer(); + } + else { + canceler = $q.defer(); + } + + ourPackageRepositoryResource.search(vm.pagination.pageNumber - 1, + vm.pagination.pageSize, + "", + vm.searchQuery, + canceler) + .then(function(pack) { + vm.packages = pack.packages; + vm.pagination.totalPages = Math.ceil(pack.total / vm.pagination.pageSize); + vm.pagination.pageNumber = 1; + vm.loading = false; + //set back to null so it can be re-created + canceler = null; + }); + + }); + + }, 200); + + function search(searchQuery) { + vm.loading = true; + searchDebounced(); + } + init(); } diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.html b/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.html index 1849b3694f..973fa8c440 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.html +++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.html @@ -4,14 +4,15 @@
- +
- -
+
@@ -110,21 +123,23 @@ -
+
-
+
-
{{ vm.package.name }}
+
-
+
{{ vm.package.name }}
-
- -
- -
-
-
-
+
-
+
+ +
+ The package and version chosen is already installed +
+
+ +
+
+ +
+ img-src="{{ 'https://our.umbraco.org' + vm.package.ownerInfo.ownerAvatar }}"> -
+
+
+
{{ vm.package.ownerInfo.owner }}
+
+ {{ vm.package.ownerInfo.owner }} has {{ vm.package.ownerInfo.karma }} karma points +
+
+
+
+ +
+
Information
-
{{ vm.package.ownerInfo.owner }}
-
- {{ vm.package.ownerInfo.owner }} has {{ vm.package.ownerInfo.karma }} karma points + +
+
Owner:
+
{{vm.package.ownerInfo.owner}}
+ +
+
Contributors:
+
+ {{ contributor }} +
+
+ +
+
Created:
+
{{vm.package.created}}
+
+ +
+
Current version:
+
{{vm.package.latestVersion}}
+
+ +
+
.Net Version:
+
{{vm.package.information.netVersion}}
+
+ +
+
License:
+
{{vm.package.licenseName}}
+
+ +
+
Downloads:
+
{{vm.package.downloads}}
+
+ +
+
Likes:
+
{{vm.package.likes}}
+
+
-
-
-
Information
-
- -
-
Owner:
-
{{vm.package.ownerInfo.owner}}
-
- -
-
Contributors:
-
- {{ contributor.name }},   +
+
Compatibility
+
This package is compatible with the following versions of Umbraco, as reported by community members. Full compatability cannot be gauranteed for versions reported below 100%
+
+
+ {{compatibility.version}} + ({{compatibility.percentage}}%)
-
- -
-
Created:
-
{{vm.package.created}}
-
- -
-
Current version:
-
{{vm.package.latestVersion}}
-
- -
-
.Net Version:
-
{{vm.package.information.netVersion}}
-
- -
-
License:
-
{{vm.package.licenseName}}
-
- -
-
Downloads:
-
{{vm.package.downloads}}
-
- -
-
Karma:
-
{{vm.package.ownerInfo.karma}}
-
- -
-
- -
-
Compatibility
-
This project is compatible with the following versions as reported by community members who have downloaded this package:
-
-
- {{compatibility.version}} - ({{compatibility.percentage}}%) -
-
-
- -
-
External sources
- +
+
External sources
+ + +
+
-
- + -
-
+
+ + + ← Take me back + + - -
- - -
+
+ +
+ +
+ + +
+ + +
-
-

{{ vm.localPackage.name }}

+
+

{{ vm.localPackage.name }}

- + -
- Version - {{ vm.localPackage.version }} -
+
+ Version + {{ vm.localPackage.version }} +
- + -
- Read me -
- -
+
+ Read me +
+ +
-
- - -
-
- This package cannot be installed, it requires a minimum Umbraco version of {{vm.localPackage.umbracoVersion}} -
-
-

{{vm.installState.status}}

-
+
+ + +
+ +
+ + +
+ +
+ This package cannot be installed, it requires a minimum Umbraco version of {{vm.localPackage.umbracoVersion}} +
+ +
+

{{vm.installState.status}}

+
+ +
+
- - +
diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 2e5448418b..2cc63ae3db 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -116,8 +116,8 @@ ..\packages\AutoMapper.4.2.1\lib\net45\AutoMapper.dll True - - ..\packages\ClientDependency.1.8.4\lib\net45\ClientDependency.Core.dll + + ..\packages\ClientDependency.1.9.0-beta4\lib\net45\ClientDependency.Core.dll True diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config index 294096212a..974d9f50c9 100644 --- a/src/Umbraco.Web.UI/packages.config +++ b/src/Umbraco.Web.UI/packages.config @@ -1,7 +1,7 @@  - + diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 33f44beac5..7ed001cb33 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -782,6 +782,15 @@ To manage your website, simply open the Umbraco back office and start adding con Package version Package version history View package website + The package and version chosen is already installed + This package cannot be installed, it requires a minimum Umbraco version of %0% + Uninstalling... + Downloading... + Importing... + Installing... + Restarting, please wait... + All done, your browser will now refresh, please wait... + Paste with full formatting (Not recommended) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 2eecd3d21e..86d90f73d0 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -781,6 +781,14 @@ To manage your website, simply open the Umbraco back office and start adding con Package version Package version history View package website + The package and version chosen is already installed + This package cannot be installed, it requires a minimum Umbraco version of %0% + Uninstalling... + Downloading... + Importing... + Installing... + Restarting, please wait... + All done, your browser will now refresh, please wait... Paste with full formatting (Not recommended) diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 2dcb6fe26d..997767ab4c 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -53,7 +53,7 @@ namespace Umbraco.Web.Editors /// /// A controller to render out the default back office view and JS results /// - [UmbracoUseHttps] + [UmbracoRequireHttps] [DisableClientCache] public class BackOfficeController : UmbracoController { diff --git a/src/Umbraco.Web/Editors/PackageInstallController.cs b/src/Umbraco.Web/Editors/PackageInstallController.cs index 4cda29a893..5fb8e8a683 100644 --- a/src/Umbraco.Web/Editors/PackageInstallController.cs +++ b/src/Umbraco.Web/Editors/PackageInstallController.cs @@ -35,6 +35,7 @@ using Umbraco.Web.WebApi.Filters; using File = System.IO.File; using Notification = Umbraco.Web.Models.ContentEditing.Notification; using Settings = umbraco.cms.businesslogic.packager.Settings; +using Version = System.Version; namespace Umbraco.Web.Editors { @@ -45,6 +46,21 @@ namespace Umbraco.Web.Editors [UmbracoApplicationAuthorize(Core.Constants.Applications.Developer)] public class PackageInstallController : UmbracoAuthorizedJsonController { + /// + /// This checks if this package & version is alraedy installed + /// + /// + /// + /// + [HttpPost] + public IHttpActionResult ValidateInstalled(string name, string version) + { + var validate = ValidateInstalledInternal(name, version); + if (validate == false) + return BadRequest(); + return Ok(); + } + [HttpPost] public IHttpActionResult Uninstall(int packageId) { @@ -53,6 +69,14 @@ namespace Umbraco.Web.Editors PerformUninstall(pack); + //now get all other packages by this name since we'll uninstall all versions + foreach (var installed in InstalledPackage.GetAllInstalledPackages() + .Where(x => x.Data.Name == pack.Data.Name && x.Data.Id != pack.Data.Id)) + { + //remove from teh xml + installed.Delete(Security.GetUserId()); + } + return Ok(); } @@ -207,21 +231,44 @@ namespace Umbraco.Web.Editors _Legacy.Actions.Action.ReRegisterActionsAndHandlers(); } + /// + /// Returns all installed packages - only shows their latest versions + /// + /// public IEnumerable GetInstalled() { - return data.GetAllPackages(IOHelper.MapPath(Settings.InstalledPackagesSettings)) + return InstalledPackage.GetAllInstalledPackages() + .GroupBy( + //group by name + x => x.Data.Name, + //select the package with a parsed version + pck => + { + Version pckVersion; + return Version.TryParse(pck.Data.Version, out pckVersion) + ? new {package = pck, version = pckVersion} + : new {package = pck, version = new Version(0, 0, 0)}; + }) + .Select(grouping => + { + //get the max version for the package + var maxVersion = grouping.Max(x => x.version); + //only return the first package with this version + return grouping.First(x => x.version == maxVersion).package; + }) .Select(pack => new InstalledPackageModel { - Name = pack.Name, - Id = pack.Id, - Author = pack.Author, - Version = pack.Version, - Url = pack.Url, - License = pack.License, - LicenseUrl = pack.LicenseUrl, - Files = pack.Files, - IconUrl = pack.IconUrl - }).ToList(); + Name = pack.Data.Name, + Id = pack.Data.Id, + Author = pack.Data.Author, + Version = pack.Data.Version, + Url = pack.Data.Url, + License = pack.Data.License, + LicenseUrl = pack.Data.LicenseUrl, + Files = pack.Data.Files, + IconUrl = pack.Data.IconUrl + }) + .ToList(); } /// @@ -283,6 +330,34 @@ namespace Umbraco.Web.Editors } } + private bool ValidateInstalledInternal(string name, string version) + { + var allInstalled = InstalledPackage.GetAllInstalledPackages(); + var found = allInstalled.FirstOrDefault(x => + { + if (x.Data.Name != name) return false; + //match the exact version + if (x.Data.Version == version) + { + return true; + } + //now try to compare the versions + Version installed; + Version selected; + if (Version.TryParse(x.Data.Version, out installed) && Version.TryParse(version, out selected)) + { + if (installed >= selected) return true; + } + return false; + }); + if (found != null) + { + //this package is already installed + return false; + } + return true; + } + [HttpPost] [FileUploadCleanupFilter(false)] public async Task UploadLocalPackage() @@ -335,9 +410,17 @@ namespace Umbraco.Web.Editors File.Copy(file.LocalFileName, packageTempFileLocation, true); //Populate the model from the metadata in the package file (zip file) - PopulateFromPackageData(model); + PopulateFromPackageData(model); - //TODO: We need to add the 'strict' requirement to the installer + var validate = ValidateInstalledInternal(model.Name, model.Version); + + if (validate == false) + { + //this package is already installed + throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse( + Services.TextService.Localize("packager/packageAlreadyInstalled"))); + } + } else { @@ -382,6 +465,15 @@ namespace Umbraco.Web.Editors //Populate the model from the metadata in the package file (zip file) PopulateFromPackageData(model); + var validate = ValidateInstalledInternal(model.Name, model.Version); + + if (validate == false) + { + //this package is already installed + throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse( + Services.TextService.Localize("packager/packageAlreadyInstalled"))); + } + return model; } @@ -402,7 +494,8 @@ namespace Umbraco.Web.Editors var packageMinVersion = new System.Version(ins.RequirementsMajor, ins.RequirementsMinor, ins.RequirementsPatch); if (UmbracoVersion.Current < packageMinVersion) { - throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("This package cannot be installed, it requires a minimum Umbraco version of " + packageMinVersion)); + throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse( + Services.TextService.Localize("packager/targetVersionMismatch", new[] {packageMinVersion.ToString()}))); } } @@ -463,17 +556,11 @@ namespace Umbraco.Web.Editors var redirectUrl = ""; - if (ins.Control.IsNullOrWhiteSpace()) + if (ins.Control.IsNullOrWhiteSpace() == false) { redirectUrl = string.Format("/developer/framed/{0}", Uri.EscapeDataString( - string.Format("/umbraco/developer/Packages/installer.aspx?installing=custominstaller&dir={0}&pId={1}&customUrl={2}", tempDir, model.Id, ins.Url))); - } - else - { - redirectUrl = string.Format("/developer/framed/{0}", - Uri.EscapeDataString( - string.Format("/umbraco/developer/Packages/installer.aspx?installing=custominstaller&dir={0}&pId={1}&customControl={2}&customUrl={3}", tempDir, model.Id, ins.Control, ins.Url))); + string.Format("/umbraco/developer/Packages/installer.aspx?installing=custominstaller&dir={0}&pId={1}&customControl={2}&customUrl={3}", tempDir, model.Id, ins.Control, ins.Url))); } return new PackageInstallResult diff --git a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs b/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs index 2e303f7018..42bca03498 100644 --- a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs @@ -1,3 +1,6 @@ +using Semver; +using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Web.Install.Models; namespace Umbraco.Web.Install.InstallSteps @@ -18,5 +21,43 @@ namespace Umbraco.Web.Install.InstallSteps { return null; } + + public override object ViewModel + { + get + { + var currentVersion = CurrentVersion().GetVersion(3).ToString(); + var newVersion = UmbracoVersion.Current.ToString(); + var reportUrl = string.Format("https://our.umbraco.org/contribute/releases/compare?from={0}&to={1}¬es=1", currentVersion, newVersion); + + return new + { + currentVersion = currentVersion, + newVersion = newVersion, + reportUrl = reportUrl + }; + + } + } + + /// + /// Gets the Current Version of the Umbraco Site before an upgrade + /// by using the last/most recent Umbraco Migration that has been run + /// + /// A SemVersion of the latest Umbraco DB Migration run + private SemVersion CurrentVersion() + { + //Set a default version of 0.0.0 + var version = new SemVersion(0); + + //If we have a db context available, if we don't then we are not installed anyways + if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured && ApplicationContext.Current.DatabaseContext.CanConnect) + { + version = ApplicationContext.Current.DatabaseContext.ValidateDatabaseSchema().DetermineInstalledVersionByMigrations(ApplicationContext.Current.Services.MigrationEntryService); + } + + return version; + } + } } \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/UmbracoRequireHttpsAttribute.cs b/src/Umbraco.Web/Mvc/UmbracoRequireHttpsAttribute.cs new file mode 100644 index 0000000000..129e3a6596 --- /dev/null +++ b/src/Umbraco.Web/Mvc/UmbracoRequireHttpsAttribute.cs @@ -0,0 +1,39 @@ +using System.Web.Mvc; +using GlobalSettings = Umbraco.Core.Configuration.GlobalSettings; + +namespace Umbraco.Web.Mvc +{ + /// + /// If umbracoUseSSL property in web.config is set to true, this filter will redirect any http access to https. + /// + public class UmbracoRequireHttpsAttribute : RequireHttpsAttribute + { + /// + /// If umbracoUseSSL is true and we have a non-HTTPS request, handle redirect. + /// + /// Filter context + protected override void HandleNonHttpsRequest(AuthorizationContext filterContext) + { + // If umbracoUseSSL is set, let base method handle redirect. Otherwise, we don't care. + if (GlobalSettings.UseSSL) + { + base.HandleNonHttpsRequest(filterContext); + } + } + + /// + /// Check to see if HTTPS is currently being used if umbracoUseSSL is true. + /// + /// Filter context + public override void OnAuthorization(AuthorizationContext filterContext) + { + // If umbracoSSL is set, let base method handle checking for HTTPS. Otherwise, we don't care. + if (GlobalSettings.UseSSL) + { + base.OnAuthorization(filterContext); + } + } + + + } +} diff --git a/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs b/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs index 4e65d35ecc..bfb8c11a64 100644 --- a/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs +++ b/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs @@ -154,10 +154,10 @@ namespace Umbraco.Web.Security.Identity /// public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, ApplicationContext appContext, PipelineStage stage) { - if (app == null) throw new ArgumentNullException("app"); - if (appContext == null) throw new ArgumentNullException("appContext"); + //Create the default options and provider + var authOptions = app.CreateUmbracoCookieAuthOptions(); - var cookieAuthProvider = new BackOfficeCookieAuthenticationProvider + authOptions.Provider = new BackOfficeCookieAuthenticationProvider { // Enables the application to validate the security stamp when the user // logs in. This is a security feature which is used when you @@ -167,20 +167,39 @@ namespace Umbraco.Web.Security.Identity TimeSpan.FromMinutes(30), (manager, user) => user.GenerateUserIdentityAsync(manager), identity => identity.GetUserId()), + }; - var authOptions = CreateCookieAuthOptions(); - authOptions.Provider = cookieAuthProvider; + return app.UseUmbracoBackOfficeCookieAuthentication(appContext, authOptions, stage); + } - app.UseUmbracoBackOfficeCookieAuthentication(authOptions, appContext, stage); + /// + /// Ensures that the UmbracoBackOfficeAuthenticationMiddleware is assigned to the pipeline + /// + /// + /// + /// Custom auth cookie options can be specified to have more control over the cookie authentication logic + /// + /// Configurable pipeline stage + /// + /// + public static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, ApplicationContext appContext, CookieAuthenticationOptions cookieOptions, PipelineStage stage) + { + if (app == null) throw new ArgumentNullException("app"); + if (appContext == null) throw new ArgumentNullException("appContext"); + if (cookieOptions == null) throw new ArgumentNullException("cookieOptions"); + if (cookieOptions.Provider == null) throw new ArgumentNullException("cookieOptions.Provider"); + if ((cookieOptions.Provider is BackOfficeCookieAuthenticationProvider) == false) throw new ArgumentException("The cookieOptions.Provider must be of type " + typeof(BackOfficeCookieAuthenticationProvider)); + + app.UseUmbracoBackOfficeCookieAuthenticationInternal(cookieOptions, appContext, stage); - //don't apply if app isnot ready + //don't apply if app is not ready if (appContext.IsUpgrading || appContext.IsConfigured) { - var getSecondsOptions = CreateCookieAuthOptions( + var getSecondsOptions = app.CreateUmbracoCookieAuthOptions( //This defines the explicit path read cookies from for this middleware new[] {string.Format("{0}/backoffice/UmbracoApi/Authentication/GetRemainingTimeoutSeconds", GlobalSettings.Path)}); - getSecondsOptions.Provider = cookieAuthProvider; + getSecondsOptions.Provider = cookieOptions.Provider; //This is a custom middleware, we need to return the user's remaining logged in seconds app.Use( @@ -192,7 +211,7 @@ namespace Umbraco.Web.Security.Identity return app; } - internal static IAppBuilder UseUmbracoBackOfficeCookieAuthentication(this IAppBuilder app, CookieAuthenticationOptions options, ApplicationContext appContext, PipelineStage stage = PipelineStage.Authenticate) + private static void UseUmbracoBackOfficeCookieAuthenticationInternal(this IAppBuilder app, CookieAuthenticationOptions options, ApplicationContext appContext, PipelineStage stage) { if (app == null) { @@ -210,9 +229,7 @@ namespace Umbraco.Web.Security.Identity } //Marks all of the above middlewares to execute on Authenticate - app.UseStageMarker(stage); - - return app; + app.UseStageMarker(stage); } @@ -295,7 +312,7 @@ namespace Umbraco.Web.Security.Identity //don't apply if app isnot ready if (appContext.IsConfigured) { - var authOptions = CreateCookieAuthOptions(); + var authOptions = app.CreateUmbracoCookieAuthOptions(); app.Use(typeof(PreviewAuthenticationMiddleware), authOptions); //This middleware must execute at least on PostAuthentication, by default it is on Authorize @@ -322,9 +339,10 @@ namespace Umbraco.Web.Security.Identity /// /// Create the default umb cookie auth options /// + /// /// /// - private static UmbracoBackOfficeCookieAuthOptions CreateCookieAuthOptions(string[] explicitPaths = null) + public static UmbracoBackOfficeCookieAuthOptions CreateUmbracoCookieAuthOptions(this IAppBuilder app, string[] explicitPaths = null) { var authOptions = new UmbracoBackOfficeCookieAuthOptions( explicitPaths, diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 64b0865068..622e58da00 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -287,6 +287,7 @@ + @@ -636,6 +637,7 @@ + diff --git a/src/Umbraco.Web/WebApi/Filters/UmbracoUseHttps.cs b/src/Umbraco.Web/WebApi/Filters/UmbracoUseHttps.cs index 2cd674377b..2e6647ea06 100644 --- a/src/Umbraco.Web/WebApi/Filters/UmbracoUseHttps.cs +++ b/src/Umbraco.Web/WebApi/Filters/UmbracoUseHttps.cs @@ -1,4 +1,6 @@ -using System.Linq; +using System; +using System.ComponentModel; +using System.Linq; using System.Web.Http; using System.Web.Http.Controllers; using Umbraco.Core; @@ -7,37 +9,9 @@ using GlobalSettings = Umbraco.Core.Configuration.GlobalSettings; namespace Umbraco.Web.WebApi.Filters { - /// - /// If umbracoUseSSL property in web.config is set to true, this filter will redirect any http access to https. - /// - public class UmbracoUseHttps : RequireHttpsAttribute + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("Use the filter Umbraco.Web.Mvc.UmbracoRequireHttpsAttribute instead, this one is in the wrong namespace")] + public class UmbracoUseHttps : Umbraco.Web.Mvc.UmbracoRequireHttpsAttribute { - /// - /// If umbracoUseSSL is true and we have a non-HTTPS request, handle redirect. - /// - /// Filter context - protected override void HandleNonHttpsRequest(AuthorizationContext filterContext) - { - // If umbracoUseSSL is set, let base method handle redirect. Otherwise, we don't care. - if (GlobalSettings.UseSSL) - { - base.HandleNonHttpsRequest(filterContext); - } - } - - /// - /// Check to see if HTTPS is currently being used if umbracoUseSSL is true. - /// - /// Filter context - public override void OnAuthorization(AuthorizationContext filterContext) - { - // If umbracoSSL is set, let base method handle checking for HTTPS. Otherwise, we don't care. - if (GlobalSettings.UseSSL) - { - base.OnAuthorization(filterContext); - } - } - - } } diff --git a/src/Umbraco.Web/WebApi/Filters/UmbracoWebApiRequireHttpsAttribute.cs b/src/Umbraco.Web/WebApi/Filters/UmbracoWebApiRequireHttpsAttribute.cs new file mode 100644 index 0000000000..f292a63a20 --- /dev/null +++ b/src/Umbraco.Web/WebApi/Filters/UmbracoWebApiRequireHttpsAttribute.cs @@ -0,0 +1,55 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http.Controllers; +using System.Web.Http.Filters; +using Umbraco.Core.Configuration; + +namespace Umbraco.Web.WebApi.Filters +{ + /// + /// If umbracoUseSSL property in web.config is set to true, this filter will redirect any http access to https. + /// + /// + /// This will only redirect Head/Get requests, otherwise will respond with text + /// + /// References: + /// http://issues.umbraco.org/issue/U4-8542 + /// https://blogs.msdn.microsoft.com/carlosfigueira/2012/03/09/implementing-requirehttps-with-asp-net-web-api/ + /// + public class UmbracoWebApiRequireHttpsAttribute : AuthorizationFilterAttribute + { + public override void OnAuthorization(HttpActionContext actionContext) + { + var request = actionContext.Request; + if (GlobalSettings.UseSSL && request.RequestUri.Scheme != Uri.UriSchemeHttps) + { + HttpResponseMessage response; + var uri = new UriBuilder(request.RequestUri) + { + Scheme = Uri.UriSchemeHttps, + Port = 443 + }; + var body = string.Format("

The resource can be found at {0}.

", + uri.Uri.AbsoluteUri); + if (request.Method.Equals(HttpMethod.Get) || request.Method.Equals(HttpMethod.Head)) + { + response = request.CreateResponse(HttpStatusCode.Found); + response.Headers.Location = uri.Uri; + if (request.Method.Equals(HttpMethod.Get)) + { + response.Content = new StringContent(body, Encoding.UTF8, "text/html"); + } + } + else + { + response = request.CreateResponse(HttpStatusCode.NotFound); + response.Content = new StringContent(body, Encoding.UTF8, "text/html"); + } + + actionContext.Response = response; + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs b/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs index 66d8278ae7..6f9abcbdcb 100644 --- a/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs +++ b/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs @@ -19,6 +19,7 @@ namespace Umbraco.Web.WebApi [UmbracoUserTimeoutFilter] [UmbracoAuthorize] [DisableBrowserCache] + [UmbracoWebApiRequireHttps] public abstract class UmbracoAuthorizedApiController : UmbracoApiController { protected UmbracoAuthorizedApiController() diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs index 49fc01d1b7..ff8c65783c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs @@ -16,7 +16,8 @@ namespace umbraco.presentation.developer.packages /// /// Summary description for packager. /// - public partial class Installer : UmbracoEnsuredPage + [Obsolete("This should not be used and will be removed in v8, this is kept here only for backwards compat reasons, this page should never be rendered/used")] + public class Installer : UmbracoEnsuredPage { public Installer() { diff --git a/src/umbraco.cms/businesslogic/Packager/Installer.cs b/src/umbraco.cms/businesslogic/Packager/Installer.cs index 2abf1ec1f4..1cfa73ff3f 100644 --- a/src/umbraco.cms/businesslogic/Packager/Installer.cs +++ b/src/umbraco.cms/businesslogic/Packager/Installer.cs @@ -491,7 +491,7 @@ namespace umbraco.cms.businesslogic.packager ? Enum.Parse(reqNode.Attributes["type"].Value, true) : RequirementsType.Legacy; var iconNode = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/iconUrl"); - if (iconNode != null) + if (iconNode != null && iconNode.FirstChild != null) { IconUrl = iconNode.FirstChild.Value; } diff --git a/src/umbraco.cms/businesslogic/Packager/data.cs b/src/umbraco.cms/businesslogic/Packager/data.cs index 366b6bafd6..2fef992bed 100644 --- a/src/umbraco.cms/businesslogic/Packager/data.cs +++ b/src/umbraco.cms/businesslogic/Packager/data.cs @@ -2,6 +2,7 @@ using System; using System.Xml; using System.Xml.XPath; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using Umbraco.Core; using Umbraco.Core.Configuration; @@ -276,6 +277,8 @@ namespace umbraco.cms.businesslogic.packager } + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is no longer in use and will be removed in the future")] public static void UpdateValue(XmlNode n, string Value) { if (n.FirstChild != null) @@ -284,7 +287,6 @@ namespace umbraco.cms.businesslogic.packager { n.AppendChild(Source.CreateTextNode(Value)); } - //Save(); } public static void Save(PackageInstance package, string dataSource) diff --git a/src/umbraco.cms/packages.config b/src/umbraco.cms/packages.config index 85beb911fd..2414d6d3e2 100644 --- a/src/umbraco.cms/packages.config +++ b/src/umbraco.cms/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/umbraco.cms/umbraco.cms.csproj b/src/umbraco.cms/umbraco.cms.csproj index a7b8f48f01..36bf9eede7 100644 --- a/src/umbraco.cms/umbraco.cms.csproj +++ b/src/umbraco.cms/umbraco.cms.csproj @@ -106,8 +106,8 @@ false - - ..\packages\ClientDependency.1.8.4\lib\net45\ClientDependency.Core.dll + + ..\packages\ClientDependency.1.9.0-beta4\lib\net45\ClientDependency.Core.dll True diff --git a/src/umbraco.controls/packages.config b/src/umbraco.controls/packages.config index 1e49726191..d91fff67e2 100644 --- a/src/umbraco.controls/packages.config +++ b/src/umbraco.controls/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/umbraco.controls/umbraco.controls.csproj b/src/umbraco.controls/umbraco.controls.csproj index d58c95ce66..0c663b8b81 100644 --- a/src/umbraco.controls/umbraco.controls.csproj +++ b/src/umbraco.controls/umbraco.controls.csproj @@ -68,8 +68,8 @@ false - - ..\packages\ClientDependency.1.8.4\lib\net45\ClientDependency.Core.dll + + ..\packages\ClientDependency.1.9.0-beta4\lib\net45\ClientDependency.Core.dll True