diff --git a/src/Umbraco.Core/ContentVariationExtensions.cs b/src/Umbraco.Core/ContentVariationExtensions.cs
index 03abbcbc9e..092de4d6d6 100644
--- a/src/Umbraco.Core/ContentVariationExtensions.cs
+++ b/src/Umbraco.Core/ContentVariationExtensions.cs
@@ -9,35 +9,87 @@ namespace Umbraco.Core
///
public static class ContentVariationExtensions
{
- // fixme document
+ ///
+ /// Determines whether the content type is invariant.
+ ///
public static bool VariesByNothing(this IContentTypeBase contentType) => contentType.Variations.VariesByNothing();
+
+ ///
+ /// Determines whether the content type varies by culture.
+ ///
+ /// And then it could also vary by segment.
public static bool VariesByCulture(this IContentTypeBase contentType) => contentType.Variations.VariesByCulture();
+
+ ///
+ /// Determines whether the content type varies by segment.
+ ///
+ /// And then it could also vary by culture.
public static bool VariesBySegment(this IContentTypeBase contentType) => contentType.Variations.VariesBySegment();
+
+ ///
+ /// Determines whether the content type varies by culture and segment.
+ ///
public static bool VariesByCultureAndSegment(this IContentTypeBase contentType) => contentType.Variations.VariesByCultureAndSegment();
+ ///
+ /// Determines whether the property type is invariant.
+ ///
public static bool VariesByNothing(this PropertyType propertyType) => propertyType.Variations.VariesByNothing();
+
+ ///
+ /// Determines whether the property type varies by culture.
+ ///
+ /// And then it could also vary by segment.
public static bool VariesByCulture(this PropertyType propertyType) => propertyType.Variations.VariesByCulture();
+
+ ///
+ /// Determines whether the property type varies by segment.
+ ///
+ /// And then it could also vary by culture.
public static bool VariesBySegment(this PropertyType propertyType) => propertyType.Variations.VariesBySegment();
+
+ ///
+ /// Determines whether the property type varies by culture and segment.
+ ///
public static bool VariesByCultureAndSegment(this PropertyType propertyType) => propertyType.Variations.VariesByCultureAndSegment();
+ ///
+ /// Determines whether the content type is invariant.
+ ///
public static bool VariesByNothing(this PublishedContentType contentType) => contentType.Variations.VariesByNothing();
+
+ ///
+ /// Determines whether the content type varies by culture.
+ ///
+ /// And then it could also vary by segment.
public static bool VariesByCulture(this PublishedContentType contentType) => contentType.Variations.VariesByCulture();
+
+ ///
+ /// Determines whether the content type varies by segment.
+ ///
+ /// And then it could also vary by culture.
public static bool VariesBySegment(this PublishedContentType contentType) => contentType.Variations.VariesBySegment();
+
+ ///
+ /// Determines whether the content type varies by culture and segment.
+ ///
public static bool VariesByCultureAndSegment(this PublishedContentType contentType) => contentType.Variations.VariesByCultureAndSegment();
///
- /// Determines whether a variation varies by nothing.
+ /// Determines whether a variation is invariant.
///
public static bool VariesByNothing(this ContentVariation variation) => variation == ContentVariation.Nothing;
///
/// Determines whether a variation varies by culture.
///
+ /// And then it could also vary by segment.
public static bool VariesByCulture(this ContentVariation variation) => (variation & ContentVariation.Culture) > 0;
///
/// Determines whether a variation varies by segment.
///
+ /// And then it could also vary by culture.
public static bool VariesBySegment(this ContentVariation variation) => (variation & ContentVariation.Segment) > 0;
///
diff --git a/src/Umbraco.Core/Models/Content.cs b/src/Umbraco.Core/Models/Content.cs
index 47358d39be..10869c62da 100644
--- a/src/Umbraco.Core/Models/Content.cs
+++ b/src/Umbraco.Core/Models/Content.cs
@@ -320,7 +320,7 @@ namespace Umbraco.Core.Models
// the values we want to publish should be valid
if (ValidateProperties(culture).Any())
- return false; // fixme - should return an attempt with error results
+ return false;
var alsoInvariant = false;
if (culture == "*") // all cultures
diff --git a/src/Umbraco.Core/Models/ContentVariation.cs b/src/Umbraco.Core/Models/ContentVariation.cs
index 2759f2e075..486f0e54f2 100644
--- a/src/Umbraco.Core/Models/ContentVariation.cs
+++ b/src/Umbraco.Core/Models/ContentVariation.cs
@@ -33,32 +33,5 @@ namespace Umbraco.Core.Models
/// Values vary by culture and segment.
///
CultureAndSegment = Culture | Segment
-
-
- // fixme - remove once we have a migration for DB values!
- /////
- ///// Unknown.
- /////
- //Unknown = 0,
-
- /////
- ///// Accepts values for the invariant culture and the neutral segment.
- /////
- //InvariantNeutral = 1,
-
- /////
- ///// Accepts values for a specified culture and the neutral segment.
- /////
- //CultureNeutral = 2,
-
- /////
- ///// Accepts values for the invariant culture and a specified segment.
- /////
- //InvariantSegment = 4,
-
- /////
- ///// Accepts values for a specified culture and a specified segment.
- /////
- //CultureSegment = 8
}
}
diff --git a/src/Umbraco.Core/Models/IContent.cs b/src/Umbraco.Core/Models/IContent.cs
index 8b63b7b9ab..9e79a75e25 100644
--- a/src/Umbraco.Core/Models/IContent.cs
+++ b/src/Umbraco.Core/Models/IContent.cs
@@ -170,8 +170,6 @@ namespace Umbraco.Core.Models
/// A value indicating whether the culture can be published.
///
/// Fails if values cannot be published, e.g. if some values are not valid.
- /// Sets the property values but not the published name for the specified culture,
- /// thus not explicitely publishing the culture. fixme uhuh?
/// Publishing must be finalized via the content service SavePublishing method.
///
// fixme - should return an attempt with error results
@@ -181,9 +179,7 @@ namespace Umbraco.Core.Models
/// Registers a culture to be unpublished.
///
///
- /// Clears the property values but not the published name for the specified culture,
- /// thus leaving the culture published. fixme wtf?
- /// Publishing must be finalized via the content service SavePublishing method.
+ /// Unpublishing must be finalized via the content service SavePublishing method.
///
void UnpublishCulture(string culture = "*");
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs
index 39a9e11a00..093723cea5 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs
@@ -515,7 +515,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
var deleteDocumentVariations = Sql().Delete().Where(x => x.NodeId == content.Id);
Database.Execute(deleteDocumentVariations);
- // fixme is we'd like to use the native NPoco InsertBulk here but it causes problems (not sure exaclty all scenarios)
+ // fixme NPoco InsertBulk issue?
+ // we should use the native NPoco InsertBulk here but it causes problems (not sure exaclty all scenarios)
// but by using SQL Server and updating a variants name will cause: Unable to cast object of type
// 'Umbraco.Core.Persistence.FaultHandling.RetryDbConnection' to type 'System.Data.SqlClient.SqlConnection'.
// (same in PersistNewItem above)
@@ -1104,13 +1105,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// ensure that that invariant name is unique
EnsureInvariantNameIsUnique(content);
- // now that we have an invariant name, which is unique,
- // if publishing, ensure that we have an invariant publish name
- // invariant content = must be there, else throw - then must follow the invariant name
- // variant content = update with invariant name
- // fixme wtf is this we never needed it, PublishName derives from Name when publishing!
- //if (publishing) EnsureInvariantPublishName(content);
-
// and finally,
// ensure that each culture has a unique node name
// no published name = not published
@@ -1147,24 +1141,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
content.Name = EnsureUniqueNodeName(content.ParentId, content.Name, content.Id);
}
- //private void EnsureInvariantPublishName(Content content)
- //{
- // if (content.ContentType.VariesByCulture())
- // {
- // // content varies by culture, reuse name as publish name
- // content.UpdatePublishName(null, content.Name);
- // }
- // else
- // {
- // // content is invariant, and invariant content must have an explicit invariant name
- // if (string.IsNullOrWhiteSpace(content.PublishName))
- // throw new InvalidOperationException("Cannot save content with an empty name.");
- // // and then, must follow the name itself
- // if (content.PublishName != content.Name)
- // content.UpdatePublishName(null, content.Name);
- // }
- //}
-
protected override string EnsureUniqueNodeName(int parentId, string nodeName, int id = 0)
{
return EnsureUniqueNaming == false ? nodeName : base.EnsureUniqueNodeName(parentId, nodeName, id);
@@ -1193,6 +1169,10 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (names.Count == 0) return;
+ // note: the code below means we are going to unique-ify every culture names, regardless
+ // of whether the name has changed (ie the culture has been updated) - some saving culture
+ // fr-FR could cause culture en-UK name to change - not sure that is clean
+
foreach(var (culture, name) in content.CultureNames)
{
var langId = LanguageRepository.GetIdByIsoCode(culture);
@@ -1207,7 +1187,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// update the name, and the publish name if published
content.SetCultureName(uniqueName, culture);
- if (publishing && content.PublishNames.ContainsKey(culture)) // fixme but what about those cultures we are NOT publishing NOW?! they shouldn't change their name!
+ if (publishing && content.PublishNames.ContainsKey(culture))
content.SetPublishInfo(culture, uniqueName, DateTime.Now);
}
}
diff --git a/src/Umbraco.Web/WebServices/BulkPublishController.cs b/src/Umbraco.Web/WebServices/BulkPublishController.cs
index fbe0d3554f..e6810f2a78 100644
--- a/src/Umbraco.Web/WebServices/BulkPublishController.cs
+++ b/src/Umbraco.Web/WebServices/BulkPublishController.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
+using System.Linq;
using System.Text;
using System.Web.Mvc;
using Umbraco.Core;
@@ -29,7 +28,7 @@ namespace Umbraco.Web.WebServices
if (publishDescendants == false)
{
- content.PublishCulture(); // fixme variants? validation - when this returns null?
+ // fixme variants?
var result = Services.ContentService.SaveAndPublish(content, userId: Security.CurrentUser.Id);
return Json(new
{
@@ -40,12 +39,12 @@ namespace Umbraco.Web.WebServices
else
{
// fixme variants?
- var result = Services.ContentService.SaveAndPublishBranch(content, includeUnpublished);
+ var result = Services.ContentService.SaveAndPublishBranch(content, includeUnpublished).ToArray();
return Json(new
{
success = result.All(x => x.Success),
- message = GetMessageForStatuses(result.ToArray(), content)
+ message = GetMessageForStatuses(result, content)
});
}
}
@@ -79,19 +78,19 @@ namespace Umbraco.Web.WebServices
return Services.TextService.Localize("publish/nodePublish", new[] { status.Content.Name});
case PublishResultType.FailedPathNotPublished:
return Services.TextService.Localize("publish/contentPublishedFailedByParent",
- new [] { string.Format("{0} ({1})", status.Content.Name, status.Content.Id) });
+ new [] { $"{status.Content.Name} ({status.Content.Id})" });
case PublishResultType.FailedHasExpired:
case PublishResultType.FailedAwaitingRelease:
case PublishResultType.FailedIsTrashed:
return "Cannot publish document with a status of " + status.Result;
case PublishResultType.FailedCancelledByEvent:
return Services.TextService.Localize("publish/contentPublishedFailedByEvent",
- new [] { string.Format("'{0}' ({1})", status.Content.Name, status.Content.Id) });
+ new [] { $"'{status.Content.Name}' ({status.Content.Id})" });
case PublishResultType.FailedContentInvalid:
return Services.TextService.Localize("publish/contentPublishedFailedInvalid",
new []{
- string.Format("'{0}' ({1})", status.Content.Name, status.Content.Id),
- string.Format("'{0}'", string.Join(", ", status.InvalidProperties.Select(x => x.Alias)))
+ $"'{status.Content.Name}' ({status.Content.Id})",
+ $"'{string.Join(", ", status.InvalidProperties.Select(x => x.Alias))}'"
});
default:
return status.Result.ToString();