Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
using System;
|
||||
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.TargetVersionSevenThreeZero
|
||||
{
|
||||
[Migration("7.3.0", 17, GlobalSettings.UmbracoMigrationName)]
|
||||
public class AddServerRegistrationColumnsAndLock : MigrationBase
|
||||
{
|
||||
public AddServerRegistrationColumnsAndLock(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
: base(sqlSyntax, logger)
|
||||
{ }
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
// don't execute if the column is already there
|
||||
var columns = SqlSyntax.GetColumnsInSchema(Context.Database).ToArray();
|
||||
if (columns.Any(x => x.TableName.InvariantEquals("umbracoServer") && x.ColumnName.InvariantEquals("isMaster")) == false)
|
||||
{
|
||||
Create.Column("isMaster").OnTable("umbracoServer").AsBoolean().NotNullable().WithDefaultValue(0);
|
||||
}
|
||||
|
||||
// wrap in a transaction so that everything runs on the same connection
|
||||
// and the IDENTITY_INSERT stuff is effective for all inserts.
|
||||
using (var tr = Context.Database.GetTransaction())
|
||||
{
|
||||
// turn on identity insert if db provider is not mysql
|
||||
if (SqlSyntax.SupportsIdentityInsert())
|
||||
Context.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON", SqlSyntax.GetQuotedTableName("umbracoNode"))));
|
||||
|
||||
InsertLockObject(Constants.System.ServersLock, "0AF5E610-A310-4B6F-925F-E928D5416AF7", "LOCK: Servers");
|
||||
|
||||
// turn off identity insert if db provider is not mysql
|
||||
if (SqlSyntax.SupportsIdentityInsert())
|
||||
Context.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF", SqlSyntax.GetQuotedTableName("umbracoNode"))));
|
||||
|
||||
tr.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
private void InsertLockObject(int id, string uniqueId, string text)
|
||||
{
|
||||
var exists = Context.Database.Exists<NodeDto>(id);
|
||||
if (exists) return;
|
||||
|
||||
Context.Database.Insert("umbracoNode", "id", false, new NodeDto
|
||||
{
|
||||
NodeId = id,
|
||||
Trashed = false,
|
||||
ParentId = -1,
|
||||
UserId = 0,
|
||||
Level = 1,
|
||||
Path = "-1," + id,
|
||||
SortOrder = 0,
|
||||
UniqueId = new Guid(uniqueId),
|
||||
Text = text,
|
||||
NodeObjectType = new Guid(Constants.ObjectTypes.LockObject),
|
||||
CreateDate = DateTime.Now
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero
|
||||
{
|
||||
[Migration("7.3.0", 17, GlobalSettings.UmbracoMigrationName)]
|
||||
public class AddServerRegistrationIsMasterColumn : MigrationBase
|
||||
{
|
||||
public AddServerRegistrationIsMasterColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
: base(sqlSyntax, logger)
|
||||
{ }
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
// don't execute if the column is already there
|
||||
var columns = SqlSyntax.GetColumnsInSchema(Context.Database).ToArray();
|
||||
if (columns.Any(x => x.TableName.InvariantEquals("umbracoServer") && x.ColumnName.InvariantEquals("isMaster")) == false)
|
||||
{
|
||||
Create.Column("isMaster").OnTable("umbracoServer").AsBoolean().NotNullable().WithDefaultValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Web;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
|
||||
namespace Umbraco.Core.Sync
|
||||
{
|
||||
@@ -14,14 +15,32 @@ namespace Umbraco.Core.Sync
|
||||
// because we cannot logger.Info<ApplicationUrlHelper> because type is static
|
||||
private static readonly Type TypeOfApplicationUrlHelper = typeof(ApplicationUrlHelper);
|
||||
|
||||
private static Func<HttpRequestBase, string> _applicationUrlProvider;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a custom provider for the umbraco application url.
|
||||
/// </summary>
|
||||
/// <remarks>Receives the current request as a parameter, and it may be null. Must return a properly
|
||||
/// <remarks>
|
||||
/// <para>Receives the current request as a parameter, and it may be null. Must return a properly
|
||||
/// formatted url with scheme and umbraco dir and no trailing slash eg "http://www.mysite.com/umbraco",
|
||||
/// or <c>null</c>. To be used in auto-load-balancing scenarios where the application url is not
|
||||
/// in config files but is determined programmatically.</remarks>
|
||||
public static Func<HttpRequestBase, string> ApplicationUrlProvider { get; set; }
|
||||
/// in config files but is determined programmatically.</para>
|
||||
/// <para>Must be assigned before resolution is frozen.</para>
|
||||
/// </remarks>
|
||||
public static Func<HttpRequestBase, string> ApplicationUrlProvider
|
||||
{
|
||||
get
|
||||
{
|
||||
return _applicationUrlProvider;
|
||||
}
|
||||
set
|
||||
{
|
||||
using (Resolution.Configuration)
|
||||
{
|
||||
_applicationUrlProvider = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// request: will be null if called from ApplicationContext
|
||||
// settings: for unit tests only
|
||||
@@ -37,9 +56,9 @@ namespace Umbraco.Core.Sync
|
||||
return;
|
||||
|
||||
// try custom provider
|
||||
if (ApplicationUrlProvider != null)
|
||||
if (_applicationUrlProvider != null)
|
||||
{
|
||||
var url = ApplicationUrlProvider(request);
|
||||
var url = _applicationUrlProvider(request);
|
||||
if (url.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
appContext._umbracoApplicationUrl = url.TrimEnd('/');
|
||||
|
||||
@@ -401,7 +401,7 @@
|
||||
<Compile Include="Persistence\Mappers\MigrationEntryMapper.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddExternalLoginsTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddForeignKeysForLanguageAndDictionaryTables.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddServerRegistrationColumnsAndLock.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddServerRegistrationIsMasterColumn.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddMigrationTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddPublicAccessTables.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeZero\AddUniqueIdPropertyTypeColumn.cs" />
|
||||
|
||||
@@ -308,11 +308,9 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
|
||||
|
||||
serial(selected, fn, getStatusMsg, 0).then(function (result) {
|
||||
// executes once the whole selection has been processed
|
||||
// in case of an error, result will be the error
|
||||
// in case of an error (caught by serial), result will be the error
|
||||
if (!(result.data && angular.isArray(result.data.notifications)))
|
||||
showNotificationsAndReset(result, true, getSuccessMsg(selected.length));
|
||||
}, function (err) {
|
||||
// never executes, err is caught by serial()
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Semver;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Events;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.Migrations;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Web.Strategies.Migrations
|
||||
{
|
||||
public class EnsureServerLockNodeExists : MigrationStartupHander
|
||||
{
|
||||
protected override void AfterMigration(MigrationRunner sender, MigrationEventArgs e)
|
||||
{
|
||||
var target = new SemVersion(7, 3);
|
||||
|
||||
if (e.ConfiguredSemVersion > target)
|
||||
return;
|
||||
|
||||
var context = e.MigrationContext;
|
||||
var sqlSyntax = SqlSyntaxContext.SqlSyntaxProvider;
|
||||
|
||||
// wrap in a transaction so that everything runs on the same connection
|
||||
// and the IDENTITY_INSERT stuff is effective for all inserts.
|
||||
using (var tr = context.Database.GetTransaction())
|
||||
{
|
||||
// turn on identity insert if db provider is not mysql
|
||||
if (sqlSyntax.SupportsIdentityInsert())
|
||||
context.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON", sqlSyntax.GetQuotedTableName("umbracoNode"))));
|
||||
|
||||
EnsureLockNode(context, Constants.System.ServersLock, "0AF5E610-A310-4B6F-925F-E928D5416AF7", "LOCK: Servers");
|
||||
|
||||
// turn off identity insert if db provider is not mysql
|
||||
if (sqlSyntax.SupportsIdentityInsert())
|
||||
context.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF", sqlSyntax.GetQuotedTableName("umbracoNode"))));
|
||||
|
||||
tr.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
private static void EnsureLockNode(IMigrationContext context, int id, string uniqueId, string text)
|
||||
{
|
||||
var exists = context.Database.Exists<NodeDto>(id);
|
||||
if (exists) return;
|
||||
|
||||
context.Database.Insert("umbracoNode", "id", false, new NodeDto
|
||||
{
|
||||
NodeId = id,
|
||||
Trashed = false,
|
||||
ParentId = -1,
|
||||
UserId = 0,
|
||||
Level = 1,
|
||||
Path = "-1," + id,
|
||||
SortOrder = 0,
|
||||
UniqueId = new Guid(uniqueId),
|
||||
Text = text,
|
||||
NodeObjectType = new Guid(Constants.ObjectTypes.LockObject),
|
||||
CreateDate = DateTime.Now
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,6 +312,7 @@
|
||||
<Compile Include="Media\EmbedProviders\OEmbedResponse.cs" />
|
||||
<Compile Include="Media\EmbedProviders\OEmbedPhoto.cs" />
|
||||
<Compile Include="Security\Identity\IUmbracoBackOfficeTwoFactorOptions.cs" />
|
||||
<Compile Include="Strategies\Migrations\EnsureServerLockNodeExists.cs" />
|
||||
<Compile Include="UmbracoDefaultOwinStartup.cs" />
|
||||
<Compile Include="IUmbracoContextAccessor.cs" />
|
||||
<Compile Include="Models\ContentEditing\Relation.cs" />
|
||||
|
||||
Reference in New Issue
Block a user