Merge branch 'dev-v7' into dev-v7-contenttypeeditor

This commit is contained in:
Shannon
2015-09-23 14:03:15 +02:00
12 changed files with 123 additions and 32 deletions

1
.gitignore vendored
View File

@@ -76,6 +76,7 @@ src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.dev.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js

View File

@@ -33,8 +33,8 @@
<dependency id="AutoMapper" version="[3.0.0, 3.1.0)" /> <dependency id="AutoMapper" version="[3.0.0, 3.1.0)" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 7.0.0)" /> <dependency id="Newtonsoft.Json" version="[6.0.8, 7.0.0)" />
<dependency id="Examine" version="[0.1.68, 1.0.0)" /> <dependency id="Examine" version="[0.1.68, 1.0.0)" />
<dependency id="ImageProcessor" version="[2.2.8, 3.0.0)" /> <dependency id="ImageProcessor" version="[2.3.0, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.3.6, 5.0.0)" /> <dependency id="ImageProcessor.Web" version="[4.4.0, 5.0.0)" />
<dependency id="semver" version="[1.1.2, 2.0.0)" /> <dependency id="semver" version="[1.1.2, 2.0.0)" />
<dependency id="Microsoft.AspNet.WebHelpers" version="[3.2.3, 4.0.0)" /> <dependency id="Microsoft.AspNet.WebHelpers" version="[3.2.3, 4.0.0)" />
<dependency id="Microsoft.AspNet.WebPages.Data" version="[3.2.3, 4.0.0)" /> <dependency id="Microsoft.AspNet.WebPages.Data" version="[3.2.3, 4.0.0)" />

7
src/NuGet.Config Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="umbracocore" value="http://www.myget.org/f/umbracocore/" />
</packageSources>
</configuration>

View File

@@ -80,9 +80,6 @@ namespace Umbraco.Core.Persistence
var creation = new DatabaseSchemaCreation(_db, _logger, _syntaxProvider); var creation = new DatabaseSchemaCreation(_db, _logger, _syntaxProvider);
creation.InitializeDatabaseSchema(); creation.InitializeDatabaseSchema();
//Now ensure to cretae the tag in the db for the current migration version
migrationEntryService.CreateEntry(GlobalSettings.UmbracoMigrationName, UmbracoVersion.GetSemanticVersion());
_logger.Info<Database>("Finalized database schema creation"); _logger.Info<Database>("Finalized database schema creation");
} }

View File

@@ -1,4 +1,5 @@
using System; using System;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging; using Umbraco.Core.Logging;
using Umbraco.Core.Models.Rdbms; using Umbraco.Core.Models.Rdbms;
@@ -86,11 +87,17 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
{ {
CreateUmbracoRelationTypeData(); CreateUmbracoRelationTypeData();
} }
if (tableName.Equals("cmsTaskType")) if (tableName.Equals("cmsTaskType"))
{ {
CreateCmsTaskTypeData(); CreateCmsTaskTypeData();
} }
if (tableName.Equals("umbracoMigration"))
{
CreateUmbracoMigrationData();
}
_logger.Info<BaseDataCreation>(string.Format("Done creating data in table {0}", tableName)); _logger.Info<BaseDataCreation>(string.Format("Done creating data in table {0}", tableName));
} }
@@ -274,5 +281,18 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
{ {
_database.Insert("cmsTaskType", "id", false, new TaskTypeDto { Id = 1, Alias = "toTranslate" }); _database.Insert("cmsTaskType", "id", false, new TaskTypeDto { Id = 1, Alias = "toTranslate" });
} }
private void CreateUmbracoMigrationData()
{
var dto = new MigrationDto
{
Id = 1,
Name = GlobalSettings.UmbracoMigrationName,
Version = UmbracoVersion.GetSemanticVersion().ToString(),
CreateDate = DateTime.Now
};
_database.Insert("umbracoMigration", "pk", false, dto);
}
} }
} }

View File

@@ -6,6 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero
{ {
[Migration("7.3.0", 13, GlobalSettings.UmbracoMigrationName)] [Migration("7.3.0", 13, GlobalSettings.UmbracoMigrationName)]
public class AddUniqueIdPropertyTypeColumn : MigrationBase public class AddUniqueIdPropertyTypeColumn : MigrationBase
{ {
@@ -35,13 +36,17 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe
// the already existing data, see: http://issues.umbraco.org/issue/U4-6942 // the already existing data, see: http://issues.umbraco.org/issue/U4-6942
foreach (var data in Context.Database.Query<dynamic>(@" foreach (var data in Context.Database.Query<dynamic>(@"
SELECT cmsPropertyType.id ptId, cmsPropertyType.Alias ptAlias, cmsContentType.alias ctAlias SELECT cmsPropertyType.id ptId, cmsPropertyType.Alias ptAlias, cmsContentType.alias ctAlias, umbracoNode.nodeObjectType nObjType
FROM cmsPropertyType FROM cmsPropertyType
INNER JOIN cmsContentType INNER JOIN cmsContentType
ON cmsPropertyType.contentTypeId = cmsContentType.nodeId")) ON cmsPropertyType.contentTypeId = cmsContentType.nodeId
INNER JOIN umbracoNode
ON cmsContentType.nodeId = umbracoNode.id"))
{ {
//create a guid from the concatenation of the property type alias + the doc type alias //create a guid from the concatenation of the:
string concatAlias = data.ptAlias + data.ctAlias; // property type alias + the doc type alias + the content type node object type
// - the latter is required because there can be a content type and media type with the same alias!!
string concatAlias = data.ptAlias + data.ctAlias + data.nObjType;
var ptGuid = concatAlias.ToGuid(); var ptGuid = concatAlias.ToGuid();
//set the Unique Id to the one we've generated //set the Unique Id to the one we've generated

View File

@@ -307,7 +307,7 @@ namespace Umbraco.Core.Persistence.Repositories
.Append(new Sql(") tmpTbl LEFT JOIN (")) .Append(new Sql(") tmpTbl LEFT JOIN ("))
.Append(joinSql) .Append(joinSql)
.Append(new Sql(") as property ON id = property.contentNodeId")) .Append(new Sql(") as property ON id = property.contentNodeId"))
.OrderBy("sortOrder"); .OrderBy("sortOrder, id");
return wrappedSql; return wrappedSql;
} }

View File

@@ -1,5 +1,7 @@
using System; using System;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Web; using System.Web;
using System.Web.Hosting; using System.Web.Hosting;
using log4net; using log4net;
@@ -180,7 +182,47 @@ namespace Umbraco.Core
{ {
if (SystemUtilities.GetCurrentTrustLevel() == AspNetHostingPermissionLevel.Unrestricted) if (SystemUtilities.GetCurrentTrustLevel() == AspNetHostingPermissionLevel.Unrestricted)
{ {
Logger.Info<UmbracoApplicationBase>("Application shutdown. Reason: " + HostingEnvironment.ShutdownReason); //Try to log the detailed shutdown message (typical asp.net hack: http://weblogs.asp.net/scottgu/433194)
try
{
var runtime = (HttpRuntime)typeof(HttpRuntime).InvokeMember("_theRuntime",
BindingFlags.NonPublic
| BindingFlags.Static
| BindingFlags.GetField,
null,
null,
null);
if (runtime == null)
return;
var shutDownMessage = (string)runtime.GetType().InvokeMember("_shutDownMessage",
BindingFlags.NonPublic
| BindingFlags.Instance
| BindingFlags.GetField,
null,
runtime,
null);
var shutDownStack = (string)runtime.GetType().InvokeMember("_shutDownStack",
BindingFlags.NonPublic
| BindingFlags.Instance
| BindingFlags.GetField,
null,
runtime,
null);
var shutdownMsg = string.Format("{0}\r\n\r\n_shutDownMessage={1}\r\n\r\n_shutDownStack={2}",
HostingEnvironment.ShutdownReason,
shutDownMessage,
shutDownStack);
Logger.Info<UmbracoApplicationBase>("Application shutdown. Details: " + shutdownMsg);
}
catch (Exception)
{
//if for some reason that fails, then log the normal output
Logger.Info<UmbracoApplicationBase>("Application shutdown. Reason: " + HostingEnvironment.ShutdownReason);
}
} }
OnApplicationEnd(sender, e); OnApplicationEnd(sender, e);

View File

@@ -135,12 +135,12 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath> <HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference> </Reference>
<Reference Include="ImageProcessor, Version=2.2.8.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ImageProcessor, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ImageProcessor.2.2.8.0\lib\net45\ImageProcessor.dll</HintPath> <HintPath>..\packages\ImageProcessor.2.3.0.0\lib\net45\ImageProcessor.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="ImageProcessor.Web, Version=4.3.6.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="ImageProcessor.Web, Version=4.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ImageProcessor.Web.4.3.6.0\lib\net45\ImageProcessor.Web.dll</HintPath> <HintPath>..\packages\ImageProcessor.Web.4.4.0.0\lib\net45\ImageProcessor.Web.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="log4net, Version=1.2.11.0, Culture=neutral, processorArchitecture=MSIL">

View File

@@ -5,8 +5,8 @@
<package id="ClientDependency-Mvc5" version="1.8.0.0" targetFramework="net45" /> <package id="ClientDependency-Mvc5" version="1.8.0.0" targetFramework="net45" />
<package id="dotless" version="1.4.1.0" targetFramework="net45" /> <package id="dotless" version="1.4.1.0" targetFramework="net45" />
<package id="Examine" version="0.1.68.0" targetFramework="net45" /> <package id="Examine" version="0.1.68.0" targetFramework="net45" />
<package id="ImageProcessor" version="2.2.8.0" targetFramework="net45" /> <package id="ImageProcessor" version="2.3.0.0" targetFramework="net45" />
<package id="ImageProcessor.Web" version="4.3.6.0" targetFramework="net45" /> <package id="ImageProcessor.Web" version="4.4.0.0" targetFramework="net45" />
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net45" /> <package id="log4net-mediumtrust" version="2.0.0" targetFramework="net45" />
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" /> <package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" /> <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />

View File

@@ -85,7 +85,11 @@ namespace Umbraco.Web
var instructions = batch.SelectMany(x => x.Instructions).ToArray(); var instructions = batch.SelectMany(x => x.Instructions).ToArray();
batch.Clear(); batch.Clear();
if (instructions.Length == 0) return; if (instructions.Length == 0) return;
WriteInstructions(instructions);
}
private void WriteInstructions(RefreshInstruction[] instructions)
{
var dto = new CacheInstructionDto var dto = new CacheInstructionDto
{ {
UtcStamp = DateTime.UtcNow, UtcStamp = DateTime.UtcNow,
@@ -96,21 +100,25 @@ namespace Umbraco.Web
ApplicationContext.DatabaseContext.Database.Insert(dto); ApplicationContext.DatabaseContext.Database.Insert(dto);
} }
protected ICollection<RefreshInstructionEnvelope> GetBatch(bool ensureHttpContext) protected ICollection<RefreshInstructionEnvelope> GetBatch(bool create)
{ {
var httpContext = UmbracoContext.Current == null ? null : UmbracoContext.Current.HttpContext; // try get the http context from the UmbracoContext, we do this because in the case we are launching an async
if (httpContext == null) // thread and we know that the cache refreshers will execute, we will ensure the UmbracoContext and therefore we
{ // can get the http context from it
if (ensureHttpContext) var httpContext = (UmbracoContext.Current == null ? null : UmbracoContext.Current.HttpContext)
throw new NotSupportedException("Cannot execute without a valid/current UmbracoContext with an HttpContext assigned."); // if this is null, it could be that an async thread is calling this method that we weren't aware of and the UmbracoContext
return null; // wasn't ensured at the beginning of the thread. We can try to see if the HttpContext.Current is available which might be
} // the case if the asp.net synchronization context has kicked in
?? (HttpContext.Current == null ? null : new HttpContextWrapper(HttpContext.Current));
// if no context was found, return null - we cannot not batch
if (httpContext == null) return null;
var key = typeof (BatchedDatabaseServerMessenger).Name; var key = typeof (BatchedDatabaseServerMessenger).Name;
// no thread-safety here because it'll run in only 1 thread (request) at a time // no thread-safety here because it'll run in only 1 thread (request) at a time
var batch = (ICollection<RefreshInstructionEnvelope>)httpContext.Items[key]; var batch = (ICollection<RefreshInstructionEnvelope>)httpContext.Items[key];
if (batch == null && ensureHttpContext) if (batch == null && create)
httpContext.Items[key] = batch = new List<RefreshInstructionEnvelope>(); httpContext.Items[key] = batch = new List<RefreshInstructionEnvelope>();
return batch; return batch;
} }
@@ -124,11 +132,13 @@ namespace Umbraco.Web
string json = null) string json = null)
{ {
var batch = GetBatch(true); var batch = GetBatch(true);
if (batch == null) var instructions = RefreshInstruction.GetInstructions(refresher, messageType, ids, idType, json);
throw new Exception("Failed to get a batch.");
batch.Add(new RefreshInstructionEnvelope(servers, refresher, // batch if we can, else write to DB immediately
RefreshInstruction.GetInstructions(refresher, messageType, ids, idType, json))); if (batch == null)
WriteInstructions(instructions.ToArray());
else
batch.Add(new RefreshInstructionEnvelope(servers, refresher, instructions));
} }
} }
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Web;
using Umbraco.Core.Sync; using Umbraco.Core.Sync;
namespace Umbraco.Web namespace Umbraco.Web
@@ -38,11 +39,19 @@ namespace Umbraco.Web
protected override ICollection<RefreshInstructionEnvelope> GetBatch(bool ensureHttpContext) protected override ICollection<RefreshInstructionEnvelope> GetBatch(bool ensureHttpContext)
{ {
var httpContext = UmbracoContext.Current == null ? null : UmbracoContext.Current.HttpContext; //try get the http context from the UmbracoContext, we do this because in the case we are launching an async
// thread and we know that the cache refreshers will execute, we will ensure the UmbracoContext and therefore we
// can get the http context from it
var httpContext = (UmbracoContext.Current == null ? null : UmbracoContext.Current.HttpContext)
//if this is null, it could be that an async thread is calling this method that we weren't aware of and the UmbracoContext
// wasn't ensured at the beginning of the thread. We can try to see if the HttpContext.Current is available which might be
// the case if the asp.net synchronization context has kicked in
?? (HttpContext.Current == null ? null : new HttpContextWrapper(HttpContext.Current));
if (httpContext == null) if (httpContext == null)
{ {
if (ensureHttpContext) if (ensureHttpContext)
throw new NotSupportedException("Cannot execute without a valid/current UmbracoContext with an HttpContext assigned."); throw new NotSupportedException("Cannot execute without a valid/current HttpContext assigned.");
return null; return null;
} }