Files
Umbraco-CMS/src/Umbraco.Core/Packaging/InstallationSummary.cs
Shannon Deminick ca72fb01ec Fixes packager to ensure the GUIDs are used for all entities where possible (#10477)
* Clean up and changes to backoffice for the nuget only packages

* temp commit of package logic removal

* Lots of package code cleanup and removal

* Removes old package data from the test package xml

* Updates packaging code to take in XDocument instead of a file since we'll not be dealing with files, starts creating expressions for the package migrations scripting.

* fixing tests

* Fixes runtime state and boot failed middleware so that it actually runs. Separates out unattended install/upgrade into notification handlers.

* Gets unattended package migrations working and running

* Gets embedded package.xml resources able to install from package migration.

* Implements automatic package migrations for package that just declare an xml data manifest.

* fix build

* small cleanups

* fix build

* adds some tests

* Fix export test

* Fix newlines in test for linux

* Typo

* removes old todos and updates AutomaticPackgeMigrationPlan to use getter with backing field.

* Update dictionary package data to use GUID

* Ensures macros are packaged and used with their GUID

* Ensures the GUID for doc types and media types remains consistent for package installation based on what is in the xml.

* fix automatic migrations to not validate initial state, fixes packaging GUIDs for multiple entities.

* Added guids to embedded test packages (Some tests are still failing)

* Fix one more test

* Fixes up Key vs Id, moves tests to correct namespace, fix tests

* Fixes Dictionary packaging to ensure an xml hierarchy

* Fixes tests

* fixes package xml

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2021-06-17 08:15:38 +02:00

102 lines
4.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Packaging;
namespace Umbraco.Cms.Core.Packaging
{
[Serializable]
[DataContract(IsReference = true)]
public class InstallationSummary
{
public InstallationSummary(string packageName)
{
PackageName = packageName;
}
public InstallWarnings Warnings { get; set; } = new InstallWarnings();
public IEnumerable<IDataType> DataTypesInstalled { get; set; } = Enumerable.Empty<IDataType>();
public IEnumerable<ILanguage> LanguagesInstalled { get; set; } = Enumerable.Empty<ILanguage>();
public IEnumerable<IDictionaryItem> DictionaryItemsInstalled { get; set; } = Enumerable.Empty<IDictionaryItem>();
public IEnumerable<IMacro> MacrosInstalled { get; set; } = Enumerable.Empty<IMacro>();
public IEnumerable<ITemplate> TemplatesInstalled { get; set; } = Enumerable.Empty<ITemplate>();
public IEnumerable<IContentType> DocumentTypesInstalled { get; set; } = Enumerable.Empty<IContentType>();
public IEnumerable<IMediaType> MediaTypesInstalled { get; set; } = Enumerable.Empty<IMediaType>();
public IEnumerable<IFile> StylesheetsInstalled { get; set; } = Enumerable.Empty<IFile>();
public IEnumerable<IContent> ContentInstalled { get; set; } = Enumerable.Empty<IContent>();
public IEnumerable<IMedia> MediaInstalled { get; set; } = Enumerable.Empty<IMedia>();
public string PackageName { get; }
public override string ToString()
{
var sb = new StringBuilder();
var macroConflicts = Warnings.ConflictingMacros.ToList();
if (macroConflicts.Count > 0)
{
sb.Append("Conflicting macros found, they will be overwritten:");
foreach(IMacro m in macroConflicts)
{
sb.Append(m.Alias);
sb.Append(',');
}
sb.AppendLine(". ");
}
var templateConflicts = Warnings.ConflictingTemplates.ToList();
if (templateConflicts.Count > 0)
{
sb.Append("Conflicting templates found, they will be overwritten:");
foreach (ITemplate m in templateConflicts)
{
sb.Append(m.Alias);
sb.Append(',');
}
sb.AppendLine(". ");
}
var stylesheetConflicts = Warnings.ConflictingStylesheets.ToList();
if (stylesheetConflicts.Count > 0)
{
sb.Append("Conflicting stylesheets found, they will be overwritten:");
foreach (IFile m in stylesheetConflicts)
{
sb.Append(m.Alias);
sb.Append(',');
}
sb.AppendLine(". ");
}
sb.Append("Content items installed: ");
sb.Append(ContentInstalled.Count());
sb.AppendLine(". ");
sb.Append("Media items installed: ");
sb.Append(MediaInstalled.Count());
sb.AppendLine(". ");
sb.Append("Dictionary items installed: ");
sb.Append(DictionaryItemsInstalled.Count());
sb.AppendLine(". ");
sb.Append("Macros installed: ");
sb.Append(MacrosInstalled.Count());
sb.AppendLine(". ");
sb.Append("Stylesheets installed: ");
sb.Append(StylesheetsInstalled.Count());
sb.AppendLine(". ");
sb.Append("Templates installed: ");
sb.Append(TemplatesInstalled.Count());
sb.AppendLine();
sb.Append("Document types installed: ");
sb.Append(DocumentTypesInstalled.Count());
sb.AppendLine(". ");
sb.Append("Media types installed: ");
sb.Append(MediaTypesInstalled.Count());
sb.AppendLine(". ");
sb.Append("Data types items installed: ");
sb.Append(DataTypesInstalled.Count());
return sb.ToString();
}
}
}