Class PublishStatusService
Implements IPublishStatusManagementService and IPublishStatusQueryService verifying the published status of documents.
Inheritance
Namespace: Umbraco.Cms.Core.Services.Navigation
Assembly: Umbraco.Core.dll
Syntax
public class PublishStatusService : IPublishStatusManagementService, IPublishStatusQueryService
Constructors
View SourcePublishStatusService(ILogger<PublishStatusService>, IPublishStatusRepository, ICoreScopeProvider, ILanguageService, IDocumentNavigationQueryService)
Initializes a new instance of the PublishStatusService class.
Declaration
public PublishStatusService(ILogger<PublishStatusService> logger, IPublishStatusRepository publishStatusRepository, ICoreScopeProvider coreScopeProvider, ILanguageService languageService, IDocumentNavigationQueryService documentNavigationQueryService)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<PublishStatusService> | logger | The logger for diagnostic output. |
| IPublishStatusRepository | publishStatusRepository | The repository for accessing publish status data. |
| ICoreScopeProvider | coreScopeProvider | The provider for creating database scopes. |
| ILanguageService | languageService | The service for retrieving language information. |
| IDocumentNavigationQueryService | documentNavigationQueryService | The service for querying document navigation structure. |
Methods
View SourceAddOrUpdateStatusAsync(Guid, CancellationToken)
Adds or updates the publish status for a specific document in the cache.
Declaration
public Task AddOrUpdateStatusAsync(Guid documentKey, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | documentKey | The unique key of the document to update. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
AddOrUpdateStatusWithDescendantsAsync(Guid, CancellationToken)
Adds or updates the publish status for a document and all its descendants in the cache.
Declaration
public Task AddOrUpdateStatusWithDescendantsAsync(Guid rootDocumentKey, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | rootDocumentKey | The unique key of the root document. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
HasPublishedAncestorPath(Guid)
Verifies if a document has a published ancestor path (i.e. all ancestors are themselves published in at least one culture).
Declaration
public bool HasPublishedAncestorPath(Guid contentKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | contentKey |
Returns
| Type | Description |
|---|---|
| bool | True if document has a published ancestor path. |
InitializeAsync(CancellationToken)
Initializes the publish status cache by loading all published document statuses from the database.
Declaration
public Task InitializeAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous initialization operation. |
IsDocumentPublished(Guid, string)
Checks if a document is published in a specific culture.
Declaration
public bool IsDocumentPublished(Guid documentKey, string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | documentKey | The document's key. |
| string | culture | The culture. |
Returns
| Type | Description |
|---|---|
| bool | True if document is published in the specified culture. |
IsDocumentPublishedInAnyCulture(Guid)
Checks if a document is published in any culture.
Declaration
public bool IsDocumentPublishedInAnyCulture(Guid documentKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | documentKey | The document's key. |
Returns
| Type | Description |
|---|---|
| bool | True if document has any published culture. |
RemoveAsync(Guid, CancellationToken)
Removes a document from the publish status cache.
Declaration
public Task RemoveAsync(Guid documentKey, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | documentKey | The unique key of the document to remove. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |