Class PackagesRepository
Manages the storage of installed/created package definitions
Inheritance
Namespace: Umbraco.Cms.Core.Packaging
Assembly: Umbraco.Core.dll
Syntax
[Obsolete("Packages have now been moved to the database instead of local files, please use CreatedPackageSchemaRepository instead")]
public class PackagesRepository : ICreatedPackagesRepository, IPackageDefinitionRepository
Constructors
View SourcePackagesRepository(IContentService, IContentTypeService, IDataTypeService, IFileService, ILocalizationService, IHostingEnvironment, IEntityXmlSerializer, IOptions<GlobalSettings>, IMediaService, IMediaTypeService, MediaFileManager, FileSystems, string, string?, string?, string?)
Constructor
Declaration
public PackagesRepository(IContentService contentService, IContentTypeService contentTypeService, IDataTypeService dataTypeService, IFileService fileService, ILocalizationService languageService, IHostingEnvironment hostingEnvironment, IEntityXmlSerializer serializer, IOptions<GlobalSettings> globalSettings, IMediaService mediaService, IMediaTypeService mediaTypeService, MediaFileManager mediaFileManager, FileSystems fileSystems, string packageRepositoryFileName, string? tempFolderPath = null, string? packagesFolderPath = null, string? mediaFolderPath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IContentService | contentService | |
| IContentTypeService | contentTypeService | |
| IDataTypeService | dataTypeService | |
| IFileService | fileService | |
| ILocalizationService | languageService | |
| IHostingEnvironment | hostingEnvironment | |
| IEntityXmlSerializer | serializer | |
| IOptions<GlobalSettings> | globalSettings | |
| IMediaService | mediaService | |
| IMediaTypeService | mediaTypeService | |
| MediaFileManager | mediaFileManager | |
| FileSystems | fileSystems | |
| string | packageRepositoryFileName | The file name for storing the package definitions (i.e. "createdPackages.config") |
| string | tempFolderPath | |
| string | packagesFolderPath | |
| string | mediaFolderPath |
Methods
View SourceDelete(int)
Deletes a package definition from storage.
Declaration
public void Delete(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | The identifier of the package definition to delete. |
DeleteLocalRepositoryFiles()
Deletes the local repository files including the packages configuration file and folder.
Declaration
public void DeleteLocalRepositoryFiles()
ExportPackage(PackageDefinition)
Creates the package file and returns it's physical path
Declaration
public string ExportPackage(PackageDefinition definition)
Parameters
| Type | Name | Description |
|---|---|---|
| PackageDefinition | definition |
Returns
| Type | Description |
|---|---|
| string |
GetAll()
Gets all package definitions from storage.
Declaration
public IEnumerable<PackageDefinition?> GetAll()
Returns
| Type | Description |
|---|---|
| IEnumerable<PackageDefinition> | An enumerable collection of all PackageDefinition instances. |
GetById(int)
Gets a package definition by its integer identifier.
Declaration
public PackageDefinition? GetById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | The identifier of the package definition. |
Returns
| Type | Description |
|---|---|
| PackageDefinition | The PackageDefinition if found; otherwise, |
GetByKey(Guid)
Gets a package definition by its unique key.
Declaration
public PackageDefinition? GetByKey(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique key of the package definition. |
Returns
| Type | Description |
|---|---|
| PackageDefinition | The PackageDefinition if found; otherwise, |
Remarks
Default implementation returns null as the class is obsolete.
SavePackage(PackageDefinition)
Persists a package definition to storage.
Declaration
public bool SavePackage(PackageDefinition definition)
Parameters
| Type | Name | Description |
|---|---|---|
| PackageDefinition | definition | The package definition to save. |
Returns
| Type | Description |
|---|---|
| bool |
|