Cleanup - fix broken stuff after cleanup

This commit is contained in:
Stephan
2016-06-09 13:02:52 +02:00
parent 74b8e5ba36
commit c0b9b050e9
4 changed files with 17 additions and 18 deletions

View File

@@ -212,10 +212,9 @@ namespace Umbraco.Core.Persistence
private static bool IncludeColumn(PocoData pocoData, string columnKey, PocoColumn column)
{
return
column.ResultColumn == false
&& pocoData.TableInfo.AutoIncrement == false
&& columnKey != pocoData.TableInfo.PrimaryKey;
// exclude result columns,
// exclude primary key column if auto-increment
return column.ResultColumn == false && (pocoData.TableInfo.AutoIncrement == false || columnKey != pocoData.TableInfo.PrimaryKey);
}
/// <summary>
@@ -256,7 +255,7 @@ namespace Umbraco.Core.Persistence
// 4168 / 262 = 15.908... = there will be 16 trans in total
// if we have disabled db parameters, then all items will be included, in only one transaction
var rowsPerCommand = Convert.ToInt32(Math.Floor(2000.00 / paramsPerRow));
var rowsPerCommand = paramsPerRow == 0 ? int.MaxValue : Convert.ToInt32(Math.Floor(2000.00 / paramsPerRow));
var commandsCount = Convert.ToInt32(Math.Ceiling((double) records.Length / rowsPerCommand));
sql = new string[commandsCount];

View File

@@ -24,7 +24,7 @@ namespace Umbraco.Core.PropertyEditors
public virtual object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview)
{
return source.ToString();
return source?.ToString() ?? string.Empty;
}
}
}

View File

@@ -1663,25 +1663,25 @@ namespace Umbraco.Core.Services
// if parent has not been copied, skip, else gets its copy id
if (idmap.TryGetValue(descendant.ParentId, out parentId) == false) continue;
copy = descendant.DeepCloneWithResetIdentities();
copy.ParentId = parentId;
var descendantCopy = descendant.DeepCloneWithResetIdentities();
descendantCopy.ParentId = parentId;
if (Copying.IsRaisedEventCancelled(new CopyEventArgs<IContent>(descendant, copy, parentId), this))
if (Copying.IsRaisedEventCancelled(new CopyEventArgs<IContent>(descendant, descendantCopy, parentId), this))
continue;
// a copy is .Saving and will be .Unpublished
// update the create author and last edit author
if (copy.Published)
copy.ChangePublishedState(PublishedState.Saving);
copy.CreatorId = userId;
copy.WriterId = userId;
if (descendantCopy.Published)
descendantCopy.ChangePublishedState(PublishedState.Saving);
descendantCopy.CreatorId = userId;
descendantCopy.WriterId = userId;
// save and flush (see above)
repository.AddOrUpdate(copy);
repository.AddOrUpdate(descendantCopy);
uow.Flush();
copies.Add(Tuple.Create(descendant, copy));
idmap[descendant.Id] = copy.Id;
copies.Add(Tuple.Create(descendant, descendantCopy));
idmap[descendant.Id] = descendantCopy.Id;
}
}

View File

@@ -76,7 +76,7 @@ namespace Umbraco.Tests.Membership
Assert.AreEqual(date.AddMinutes(1), d.LastActivityDate);
Assert.AreEqual(date.AddMinutes(2), d.LastLockoutDate);
Assert.AreEqual(date.AddMinutes(1), d.LastLoginDate);
Assert.AreEqual(date.AddMinutes(4), d.LastPasswordChangedDate);
Assert.AreEqual(date.AddMinutes(4), d.LastPasswordChangeDate);
Assert.AreEqual("test name", d.Name);
Assert.AreEqual("test question", d.PasswordQuestion);
Assert.AreEqual("test username", d.UserName);
@@ -114,7 +114,7 @@ namespace Umbraco.Tests.Membership
Assert.AreEqual(date.AddMinutes(1), d.lastActivityDate);
Assert.AreEqual(date.AddMinutes(2), d.lastLockoutDate);
Assert.AreEqual(date.AddMinutes(1), d.lastLoginDate);
Assert.AreEqual(date.AddMinutes(4), d.lastPasswordChangedDate);
Assert.AreEqual(date.AddMinutes(4), d.lastPasswordChangeDate);
Assert.AreEqual("test name", d.name);
Assert.AreEqual("test question", d.passwordQuestion);
Assert.AreEqual("test username", d.userName);