Determine urls at save and publish time (#17033)

* Started work on service

* temp work

* temp commit

* Temp commit

* Added more routing logic

* Fixed tests

* Refactor and prepare for isdraft

* Work on drafts

* Fixed tests

* Move to enlistment to ensure caches is only updated on scope complete

* Clean up and handle null cultures

* Added functionality to the INavigationQueryService to get root keys

* Added migration

* Fixed issue with navigation

* Added migration

* Temp commit, move to cache refreshers.

* Fixed issues

* List urls

* fix build

* Fixed integration tests

* Refactor to create new content finder instead of changing the old

* rollback wrong commited line

* Clean up, and use docuemnt url service for index

* Fixed List endpoin

* Do not use Navigation service in methods intended by management api

* Fixed examine tests

* Make methods virtual

* Use domain from published request

* Use hybrid cache from new content finder

* Eliminate nucache usage

* Fixed issue with delivery api and url generation

* Fixed linux tests

* Added hybrid cache to all integration tests
This commit is contained in:
Bjarke Berg
2024-09-27 09:12:19 +02:00
committed by GitHub
parent 3180ab3ed0
commit 734b3cce2c
50 changed files with 2087 additions and 145 deletions

View File

@@ -1060,7 +1060,14 @@ public class ContentService : RepositoryService, IContentService
// Updates in-memory navigation structure - we only handle new items, other updates are not a concern
UpdateInMemoryNavigationStructure(
"Umbraco.Cms.Core.Services.ContentService.Save-with-contentSchedule",
() => _documentNavigationManagementService.Add(content.Key, GetParent(content)?.Key));
() =>
{
_documentNavigationManagementService.Add(content.Key, GetParent(content)?.Key);
if (content.Trashed)
{
_documentNavigationManagementService.MoveToBin(content.Key);
}
});
if (contentSchedule != null)
{
@@ -1129,7 +1136,14 @@ public class ContentService : RepositoryService, IContentService
// Updates in-memory navigation structure - we only handle new items, other updates are not a concern
UpdateInMemoryNavigationStructure(
"Umbraco.Cms.Core.Services.ContentService.Save",
() => _documentNavigationManagementService.Add(content.Key, GetParent(content)?.Key));
() =>
{
_documentNavigationManagementService.Add(content.Key, GetParent(content)?.Key);
if (content.Trashed)
{
_documentNavigationManagementService.MoveToBin(content.Key);
}
});
}
scope.Notifications.Publish(
@@ -1227,9 +1241,10 @@ public class ContentService : RepositoryService, IContentService
// publish the culture(s)
// we don't care about the response here, this response will be rechecked below but we need to set the culture info values now.
var publishTime = DateTime.Now;
foreach (CultureImpact? impact in impacts)
{
content.PublishCulture(impact);
content.PublishCulture(impact, publishTime);
}
// Change state to publishing
@@ -1866,7 +1881,7 @@ public class ContentService : RepositoryService, IContentService
// publish the culture values and validate the property values, if validation fails, log the invalid properties so the develeper has an idea of what has failed
IProperty[]? invalidProperties = null;
CultureImpact impact = _cultureImpactFactory.ImpactExplicit(culture, IsDefaultCulture(allLangs.Value, culture));
var tryPublish = d.PublishCulture(impact) &&
var tryPublish = d.PublishCulture(impact, date) &&
_propertyValidationService.Value.IsPropertyDataValid(d, out invalidProperties, impact);
if (invalidProperties != null && invalidProperties.Length > 0)
{
@@ -1943,17 +1958,19 @@ public class ContentService : RepositoryService, IContentService
{
// variant content type - publish specified cultures
// invariant content type - publish only the invariant culture
var publishTime = DateTime.Now;
if (content.ContentType.VariesByCulture())
{
return culturesToPublish.All(culture =>
{
CultureImpact? impact = _cultureImpactFactory.Create(culture, IsDefaultCulture(allLangs, culture), content);
return content.PublishCulture(impact) &&
return content.PublishCulture(impact, publishTime) &&
_propertyValidationService.Value.IsPropertyDataValid(content, out _, impact);
});
}
return content.PublishCulture(_cultureImpactFactory.ImpactInvariant())
return content.PublishCulture(_cultureImpactFactory.ImpactInvariant(), publishTime)
&& _propertyValidationService.Value.IsPropertyDataValid(content, out _, _cultureImpactFactory.ImpactInvariant());
}
@@ -3179,7 +3196,8 @@ public class ContentService : RepositoryService, IContentService
.ToArray();
// publish the culture(s)
if (!impactsToPublish.All(content.PublishCulture))
var publishTime = DateTime.Now;
if (!impactsToPublish.All(impact => content.PublishCulture(impact, publishTime)))
{
return new PublishResult(PublishResultType.FailedPublishContentInvalid, evtMsgs, content);
}