Package data installation is now all migrated
This commit is contained in:
@@ -59,18 +59,19 @@ namespace Umbraco.Core.Composing.Composers
|
|||||||
|
|
||||||
composition.RegisterUnique<IEntityXmlSerializer, EntityXmlSerializer>();
|
composition.RegisterUnique<IEntityXmlSerializer, EntityXmlSerializer>();
|
||||||
|
|
||||||
composition.RegisterUnique<PackageActionRunner>();
|
composition.RegisterUnique<IPackageActionRunner, PackageActionRunner>();
|
||||||
|
|
||||||
composition.RegisterUnique<ConflictingPackageData>();
|
composition.RegisterUnique<ConflictingPackageData>();
|
||||||
composition.RegisterUnique<CompiledPackageXmlParser>();
|
composition.RegisterUnique<CompiledPackageXmlParser>();
|
||||||
composition.RegisterUnique<ICreatedPackagesRepository>(factory => CreatePackageRepository(factory, "createdPackages.config"));
|
composition.RegisterUnique<ICreatedPackagesRepository>(factory => CreatePackageRepository(factory, "createdPackages.config"));
|
||||||
composition.RegisterUnique<IInstalledPackagesRepository>(factory => CreatePackageRepository(factory, "installedPackages.config"));
|
composition.RegisterUnique<IInstalledPackagesRepository>(factory => CreatePackageRepository(factory, "installedPackages.config"));
|
||||||
|
composition.RegisterUnique<PackageDataInstallation>();
|
||||||
composition.RegisterUnique<PackageFileInstallation>();
|
composition.RegisterUnique<PackageFileInstallation>();
|
||||||
var appRoot = new DirectoryInfo(IOHelper.GetRootDirectorySafe());
|
var appRoot = new DirectoryInfo(IOHelper.GetRootDirectorySafe());
|
||||||
composition.RegisterUnique<IPackageInstallation>(factory => //factory required because we need to pass in a string path
|
composition.RegisterUnique<IPackageInstallation>(factory => //factory required because we need to pass in a string path
|
||||||
new PackageInstallation(
|
new PackageInstallation(
|
||||||
factory.GetInstance<IPackagingService>(), factory.GetInstance<PackageFileInstallation>(),
|
factory.GetInstance<PackageDataInstallation>(), factory.GetInstance<PackageFileInstallation>(),
|
||||||
factory.GetInstance<CompiledPackageXmlParser>(),
|
factory.GetInstance<CompiledPackageXmlParser>(), factory.GetInstance<IPackageActionRunner>(),
|
||||||
SystemDirectories.Packages,
|
SystemDirectories.Packages,
|
||||||
appRoot, appRoot));
|
appRoot, appRoot));
|
||||||
|
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ namespace Umbraco.Core.Composing
|
|||||||
internal static PackageActionCollection PackageActions
|
internal static PackageActionCollection PackageActions
|
||||||
=> Factory.GetInstance<PackageActionCollection>();
|
=> Factory.GetInstance<PackageActionCollection>();
|
||||||
|
|
||||||
internal static PackageActionRunner PackageActionRunner
|
internal static IPackageActionRunner PackageActionRunner
|
||||||
=> Factory.GetInstance<PackageActionRunner>();
|
=> Factory.GetInstance<IPackageActionRunner>();
|
||||||
|
|
||||||
internal static PropertyValueConverterCollection PropertyValueConverters
|
internal static PropertyValueConverterCollection PropertyValueConverters
|
||||||
=> Factory.GetInstance<PropertyValueConverterCollection>();
|
=> Factory.GetInstance<PropertyValueConverterCollection>();
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
namespace Umbraco.Core
|
|
||||||
{
|
|
||||||
public static partial class Constants
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Defines the constants used for Umbraco packages in the package.config xml
|
|
||||||
/// </summary>
|
|
||||||
public static class Packaging
|
|
||||||
{
|
|
||||||
public const string UmbPackageNodeName = "umbPackage";
|
|
||||||
public const string DataTypesNodeName = "DataTypes";
|
|
||||||
public const string PackageXmlFileName = "package.xml";
|
|
||||||
public const string UmbracoPackageExtention = ".umb";
|
|
||||||
public const string DataTypeNodeName = "DataType";
|
|
||||||
public const string LanguagesNodeName = "Languages";
|
|
||||||
public const string FilesNodeName = "files";
|
|
||||||
public const string StylesheetsNodeName = "Stylesheets";
|
|
||||||
public const string TemplatesNodeName = "Templates";
|
|
||||||
public const string NameNodeName = "Name";
|
|
||||||
public const string TemplateNodeName = "Template";
|
|
||||||
public const string AliasNodeNameSmall = "alias";
|
|
||||||
public const string AliasNodeNameCapital = "Alias";
|
|
||||||
public const string DictionaryItemsNodeName = "DictionaryItems";
|
|
||||||
public const string DictionaryItemNodeName = "DictionaryItem";
|
|
||||||
public const string MacrosNodeName = "Macros";
|
|
||||||
public const string DocumentsNodeName = "Documents";
|
|
||||||
public const string DocumentSetNodeName = "DocumentSet";
|
|
||||||
public const string DocumentTypesNodeName = "DocumentTypes";
|
|
||||||
public const string DocumentTypeNodeName = "DocumentType";
|
|
||||||
public const string FileNodeName = "file";
|
|
||||||
public const string OrgNameNodeName = "orgName";
|
|
||||||
public const string OrgPathNodeName = "orgPath";
|
|
||||||
public const string GuidNodeName = "guid";
|
|
||||||
public const string StylesheetNodeName = "styleSheet";
|
|
||||||
public const string MacroNodeName = "macro";
|
|
||||||
public const string InfoNodeName = "info";
|
|
||||||
public const string PackageRequirementsMajorXpath = "./package/requirements/major";
|
|
||||||
public const string PackageRequirementsMinorXpath = "./package/requirements/minor";
|
|
||||||
public const string PackageRequirementsPatchXpath = "./package/requirements/patch";
|
|
||||||
public const string PackageNameXpath = "./package/name";
|
|
||||||
public const string PackageVersionXpath = "./package/version";
|
|
||||||
public const string PackageUrlXpath = "./package/url";
|
|
||||||
public const string PackageLicenseXpath = "./package/license";
|
|
||||||
public const string PackageLicenseXpathUrlAttribute = "url";
|
|
||||||
public const string AuthorNameXpath = "./author/name";
|
|
||||||
public const string AuthorWebsiteXpath = "./author/website";
|
|
||||||
public const string ReadmeXpath = "./readme";
|
|
||||||
public const string ControlNodeName = "control";
|
|
||||||
public const string ActionNodeName = "Action";
|
|
||||||
public const string ActionsNodeName = "Actions";
|
|
||||||
public const string UndoNodeAttribute = "undo";
|
|
||||||
public const string RunatNodeAttribute = "runat";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Umbraco.Core.Events
|
|
||||||
{
|
|
||||||
public class ImportEventArgs<TEntity> : CancellableEnumerableObjectEventArgs<TEntity>, IEquatable<ImportEventArgs<TEntity>>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor accepting an XElement with the xml being imported
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="xml"></param>
|
|
||||||
public ImportEventArgs(XElement xml) : base(new List<TEntity>(), true)
|
|
||||||
{
|
|
||||||
Xml = xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor accepting a list of entities and an XElement with the imported xml
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="eventObject"></param>
|
|
||||||
/// <param name="xml"></param>
|
|
||||||
/// <param name="canCancel"></param>
|
|
||||||
public ImportEventArgs(IEnumerable<TEntity> eventObject, XElement xml, bool canCancel)
|
|
||||||
: base(eventObject, canCancel)
|
|
||||||
{
|
|
||||||
Xml = xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ImportEventArgs(IEnumerable<TEntity> eventObject, bool canCancel) : base(eventObject, canCancel)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ImportEventArgs(IEnumerable<TEntity> eventObject) : base(eventObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns all entities that were imported during the operation
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<TEntity> ImportedEntities
|
|
||||||
{
|
|
||||||
get { return EventObject; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the xml relating to the import event
|
|
||||||
/// </summary>
|
|
||||||
public XElement Xml { get; private set; }
|
|
||||||
|
|
||||||
public bool Equals(ImportEventArgs<TEntity> other)
|
|
||||||
{
|
|
||||||
if (ReferenceEquals(null, other)) return false;
|
|
||||||
if (ReferenceEquals(this, other)) return true;
|
|
||||||
return base.Equals(other) && Equals(Xml, other.Xml);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
|
||||||
if (ReferenceEquals(null, obj)) return false;
|
|
||||||
if (ReferenceEquals(this, obj)) return true;
|
|
||||||
if (obj.GetType() != this.GetType()) return false;
|
|
||||||
return Equals((ImportEventArgs<TEntity>) obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
unchecked
|
|
||||||
{
|
|
||||||
return (base.GetHashCode() * 397) ^ (Xml != null ? Xml.GetHashCode() : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator ==(ImportEventArgs<TEntity> left, ImportEventArgs<TEntity> right)
|
|
||||||
{
|
|
||||||
return Equals(left, right);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator !=(ImportEventArgs<TEntity> left, ImportEventArgs<TEntity> right)
|
|
||||||
{
|
|
||||||
return !Equals(left, right);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -34,7 +34,11 @@ namespace Umbraco.Core.Models.Packaging
|
|||||||
public IEnumerable<XElement> Macros { get; set; } //fixme: make strongly typed
|
public IEnumerable<XElement> Macros { get; set; } //fixme: make strongly typed
|
||||||
public IEnumerable<XElement> Templates { get; set; } //fixme: make strongly typed
|
public IEnumerable<XElement> Templates { get; set; } //fixme: make strongly typed
|
||||||
public IEnumerable<XElement> Stylesheets { get; set; } //fixme: make strongly typed
|
public IEnumerable<XElement> Stylesheets { get; set; } //fixme: make strongly typed
|
||||||
|
public IEnumerable<XElement> DataTypes { get; set; } //fixme: make strongly typed
|
||||||
|
public IEnumerable<XElement> Languages { get; set; } //fixme: make strongly typed
|
||||||
|
public IEnumerable<XElement> DictionaryItems { get; set; } //fixme: make strongly typed
|
||||||
|
public IEnumerable<XElement> DocumentTypes { get; set; } //fixme: make strongly typed
|
||||||
|
public IEnumerable<XElement> Documents { get; set; } //fixme: make strongly typed
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CompiledPackageFile
|
public class CompiledPackageFile
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Umbraco.Core.Models.Packaging
|
|||||||
public IEnumerable<IMacro> MacrosInstalled { get; set; } = Enumerable.Empty<IMacro>();
|
public IEnumerable<IMacro> MacrosInstalled { get; set; } = Enumerable.Empty<IMacro>();
|
||||||
public IEnumerable<string> FilesInstalled { get; set; } = Enumerable.Empty<string>();
|
public IEnumerable<string> FilesInstalled { get; set; } = Enumerable.Empty<string>();
|
||||||
public IEnumerable<ITemplate> TemplatesInstalled { get; set; } = Enumerable.Empty<ITemplate>();
|
public IEnumerable<ITemplate> TemplatesInstalled { get; set; } = Enumerable.Empty<ITemplate>();
|
||||||
public IEnumerable<IContentType> ContentTypesInstalled { get; set; } = Enumerable.Empty<IContentType>();
|
public IEnumerable<IContentType> DocumentTypesInstalled { get; set; } = Enumerable.Empty<IContentType>();
|
||||||
public IEnumerable<IFile> StylesheetsInstalled { get; set; } = Enumerable.Empty<IFile>();
|
public IEnumerable<IFile> StylesheetsInstalled { get; set; } = Enumerable.Empty<IFile>();
|
||||||
public IEnumerable<IContent> ContentInstalled { get; set; } = Enumerable.Empty<IContent>();
|
public IEnumerable<IContent> ContentInstalled { get; set; } = Enumerable.Empty<IContent>();
|
||||||
public IEnumerable<PackageAction> Actions { get; set; } = Enumerable.Empty<PackageAction>();
|
public IEnumerable<PackageAction> Actions { get; set; } = Enumerable.Empty<PackageAction>();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Umbraco.Core.Packaging
|
|||||||
{
|
{
|
||||||
if (xml == null) throw new ArgumentNullException(nameof(xml));
|
if (xml == null) throw new ArgumentNullException(nameof(xml));
|
||||||
if (xml.Root == null) throw new ArgumentException(nameof(xml), "The xml document is invalid");
|
if (xml.Root == null) throw new ArgumentException(nameof(xml), "The xml document is invalid");
|
||||||
if (xml.Root.Name != Constants.Packaging.UmbPackageNodeName) throw new FormatException("The xml document is invalid");
|
if (xml.Root.Name != "umbPackage") throw new FormatException("The xml document is invalid");
|
||||||
|
|
||||||
var info = xml.Root.Element("info");
|
var info = xml.Root.Element("info");
|
||||||
if (info == null) throw new FormatException("The xml document is invalid");
|
if (info == null) throw new FormatException("The xml document is invalid");
|
||||||
@@ -53,7 +53,6 @@ namespace Umbraco.Core.Packaging
|
|||||||
UmbracoVersionRequirementsType = requirements.AttributeValue<string>("type").IsNullOrWhiteSpace() ? RequirementsType.Legacy : Enum<RequirementsType>.Parse(requirements.AttributeValue<string>("type")),
|
UmbracoVersionRequirementsType = requirements.AttributeValue<string>("type").IsNullOrWhiteSpace() ? RequirementsType.Legacy : Enum<RequirementsType>.Parse(requirements.AttributeValue<string>("type")),
|
||||||
Control = package.Element("control")?.Value,
|
Control = package.Element("control")?.Value,
|
||||||
Actions = xml.Element("Actions")?.ToString(SaveOptions.None) ?? "<Actions></Actions>", //take the entire outer xml value
|
Actions = xml.Element("Actions")?.ToString(SaveOptions.None) ?? "<Actions></Actions>", //take the entire outer xml value
|
||||||
|
|
||||||
Files = xml.Root.Element("files")?.Elements("file")?.Select(x => new CompiledPackageFile
|
Files = xml.Root.Element("files")?.Elements("file")?.Select(x => new CompiledPackageFile
|
||||||
{
|
{
|
||||||
UniqueFileName = x.Element("guid")?.Value,
|
UniqueFileName = x.Element("guid")?.Value,
|
||||||
@@ -64,7 +63,11 @@ namespace Umbraco.Core.Packaging
|
|||||||
Macros = xml.Element("Macros")?.Elements("macro") ?? Enumerable.Empty<XElement>(),
|
Macros = xml.Element("Macros")?.Elements("macro") ?? Enumerable.Empty<XElement>(),
|
||||||
Templates = xml.Element("Templates")?.Elements("Template") ?? Enumerable.Empty<XElement>(),
|
Templates = xml.Element("Templates")?.Elements("Template") ?? Enumerable.Empty<XElement>(),
|
||||||
Stylesheets = xml.Element("Stylesheets")?.Elements("styleSheet") ?? Enumerable.Empty<XElement>(),
|
Stylesheets = xml.Element("Stylesheets")?.Elements("styleSheet") ?? Enumerable.Empty<XElement>(),
|
||||||
|
DataTypes = xml.Element("DataTypes")?.Elements("DataType") ?? Enumerable.Empty<XElement>(),
|
||||||
|
Languages = xml.Element("Languages")?.Elements("Language") ?? Enumerable.Empty<XElement>(),
|
||||||
|
DictionaryItems = xml.Element("DictionaryItems")?.Elements("DictionaryItem") ?? Enumerable.Empty<XElement>(),
|
||||||
|
DocumentTypes = xml.Element("DocumentTypes")?.Elements("DocumentType") ?? Enumerable.Empty<XElement>(),
|
||||||
|
Documents = xml.Element("Documents")?.Elements("DocumentSet") ?? Enumerable.Empty<XElement>(),
|
||||||
};
|
};
|
||||||
|
|
||||||
def.Warnings = GetPreInstallWarnings(def, applicationRootFolder);
|
def.Warnings = GetPreInstallWarnings(def, applicationRootFolder);
|
||||||
@@ -133,9 +136,8 @@ namespace Umbraco.Core.Packaging
|
|||||||
{
|
{
|
||||||
return pathElement.TrimStart(new[] { '\\', '/', '~' }).Replace("/", "\\");
|
return pathElement.TrimStart(new[] { '\\', '/', '~' }).Replace("/", "\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
//fixme: This is duplicated in the parser
|
private static string UpdatePathPlaceholders(string path)
|
||||||
public static string UpdatePathPlaceholders(string path)
|
|
||||||
{
|
{
|
||||||
if (path.Contains("[$"))
|
if (path.Contains("[$"))
|
||||||
{
|
{
|
||||||
@@ -146,5 +148,40 @@ namespace Umbraco.Core.Packaging
|
|||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<PackageAction> GetPackageActions(XElement actionsElement, string packageName)
|
||||||
|
{
|
||||||
|
if (actionsElement == null) { return new PackageAction[0]; }
|
||||||
|
|
||||||
|
if (string.Equals("Actions", actionsElement.Name.LocalName) == false)
|
||||||
|
throw new ArgumentException($"Must be \"Actions\" as root", nameof(actionsElement));
|
||||||
|
|
||||||
|
return actionsElement.Elements("Action")
|
||||||
|
.Select(elemet =>
|
||||||
|
{
|
||||||
|
var aliasAttr = elemet.Attribute("Alias");
|
||||||
|
if (aliasAttr == null)
|
||||||
|
throw new ArgumentException("missing \"Alias\" atribute in alias element", nameof(actionsElement));
|
||||||
|
|
||||||
|
var packageAction = new PackageAction
|
||||||
|
{
|
||||||
|
XmlData = elemet,
|
||||||
|
Alias = aliasAttr.Value,
|
||||||
|
PackageName = packageName,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var attr = elemet.Attribute("runat");
|
||||||
|
|
||||||
|
if (attr != null && Enum.TryParse(attr.Value, true, out ActionRunAt runAt)) { packageAction.RunAt = runAt; }
|
||||||
|
|
||||||
|
attr = elemet.Attribute("undo");
|
||||||
|
|
||||||
|
if (attr != null && bool.TryParse(attr.Value, out var undo)) { packageAction.Undo = undo; }
|
||||||
|
|
||||||
|
|
||||||
|
return packageAction;
|
||||||
|
}).ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ namespace Umbraco.Core.Packaging
|
|||||||
return stylesheetNodes
|
return stylesheetNodes
|
||||||
.Select(n =>
|
.Select(n =>
|
||||||
{
|
{
|
||||||
var xElement = n.Element(Constants.Packaging.NameNodeName);
|
var xElement = n.Element("Name");
|
||||||
if (xElement == null)
|
if (xElement == null)
|
||||||
throw new FormatException($"Missing \"{Constants.Packaging.NameNodeName}\" element");
|
throw new FormatException("Missing \"Name\" element");
|
||||||
|
|
||||||
return _fileService.GetStylesheetByName(xElement.Value) as IFile;
|
return _fileService.GetStylesheetByName(xElement.Value) as IFile;
|
||||||
})
|
})
|
||||||
@@ -37,9 +37,9 @@ namespace Umbraco.Core.Packaging
|
|||||||
return templateNodes
|
return templateNodes
|
||||||
.Select(n =>
|
.Select(n =>
|
||||||
{
|
{
|
||||||
var xElement = n.Element(Constants.Packaging.AliasNodeNameCapital) ?? n.Element(Constants.Packaging.AliasNodeNameSmall);
|
var xElement = n.Element("Alias") ?? n.Element("alias");
|
||||||
if (xElement == null)
|
if (xElement == null)
|
||||||
throw new FormatException($"missing a \"{Constants.Packaging.AliasNodeNameCapital}\" element");
|
throw new FormatException("missing a \"Alias\" element");
|
||||||
|
|
||||||
return _fileService.GetTemplate(xElement.Value);
|
return _fileService.GetTemplate(xElement.Value);
|
||||||
})
|
})
|
||||||
@@ -51,9 +51,9 @@ namespace Umbraco.Core.Packaging
|
|||||||
return macroNodes
|
return macroNodes
|
||||||
.Select(n =>
|
.Select(n =>
|
||||||
{
|
{
|
||||||
var xElement = n.Element(Constants.Packaging.AliasNodeNameSmall) ?? n.Element(Constants.Packaging.AliasNodeNameCapital);
|
var xElement = n.Element("alias") ?? n.Element("Alias");
|
||||||
if (xElement == null)
|
if (xElement == null)
|
||||||
throw new FormatException($"missing a \"{Constants.Packaging.AliasNodeNameSmall}\" element in {Constants.Packaging.AliasNodeNameSmall} element");
|
throw new FormatException("missing a \"alias\" element in alias element");
|
||||||
|
|
||||||
return _macroService.GetByAlias(xElement.Value);
|
return _macroService.GetByAlias(xElement.Value);
|
||||||
})
|
})
|
||||||
|
|||||||
23
src/Umbraco.Core/Packaging/IPackageActionRunner.cs
Normal file
23
src/Umbraco.Core/Packaging/IPackageActionRunner.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Packaging
|
||||||
|
{
|
||||||
|
public interface IPackageActionRunner
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Runs the package action with the specified action alias.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageName">Name of the package.</param>
|
||||||
|
/// <param name="actionAlias">The action alias.</param>
|
||||||
|
/// <param name="actionXml">The action XML.</param>
|
||||||
|
void RunPackageAction(string packageName, string actionAlias, XElement actionXml);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Undos the package action with the specified action alias.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="packageName">Name of the package.</param>
|
||||||
|
/// <param name="actionAlias">The action alias.</param>
|
||||||
|
/// <param name="actionXml">The action XML.</param>
|
||||||
|
void UndoPackageAction(string packageName, string actionAlias, XElement actionXml);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,9 +4,8 @@ using Umbraco.Core.Models.Packaging;
|
|||||||
|
|
||||||
namespace Umbraco.Core.Packaging
|
namespace Umbraco.Core.Packaging
|
||||||
{
|
{
|
||||||
internal interface IPackageInstallation
|
public interface IPackageInstallation
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Installs a packages data and entities
|
/// Installs a packages data and entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -5,11 +5,10 @@ using Umbraco.Core._Legacy.PackageActions;
|
|||||||
|
|
||||||
namespace Umbraco.Core.Packaging
|
namespace Umbraco.Core.Packaging
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Package actions are executed on packge install / uninstall.
|
/// Package actions are executed on packge install / uninstall.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class PackageActionRunner
|
internal class PackageActionRunner : IPackageActionRunner
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly PackageActionCollection _packageActions;
|
private readonly PackageActionCollection _packageActions;
|
||||||
|
|||||||
1144
src/Umbraco.Core/Packaging/PackageDataInstallation.cs
Normal file
1144
src/Umbraco.Core/Packaging/PackageDataInstallation.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
@@ -10,13 +11,13 @@ using Umbraco.Core.Services;
|
|||||||
|
|
||||||
namespace Umbraco.Core.Packaging
|
namespace Umbraco.Core.Packaging
|
||||||
{
|
{
|
||||||
|
|
||||||
internal class PackageInstallation : IPackageInstallation
|
internal class PackageInstallation : IPackageInstallation
|
||||||
{
|
{
|
||||||
private readonly IPackagingService _packagingService;
|
|
||||||
private readonly PackageExtraction _packageExtraction;
|
private readonly PackageExtraction _packageExtraction;
|
||||||
|
private readonly PackageDataInstallation _packageDataInstallation;
|
||||||
private readonly PackageFileInstallation _packageFileInstallation;
|
private readonly PackageFileInstallation _packageFileInstallation;
|
||||||
private readonly CompiledPackageXmlParser _parser;
|
private readonly CompiledPackageXmlParser _parser;
|
||||||
|
private readonly IPackageActionRunner _packageActionRunner;
|
||||||
private readonly string _packagesFolderPath;
|
private readonly string _packagesFolderPath;
|
||||||
private readonly DirectoryInfo _packageExtractionFolder;
|
private readonly DirectoryInfo _packageExtractionFolder;
|
||||||
private readonly DirectoryInfo _applicationRootFolder;
|
private readonly DirectoryInfo _applicationRootFolder;
|
||||||
@@ -24,9 +25,10 @@ namespace Umbraco.Core.Packaging
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packagingService"></param>
|
/// <param name="packageDataInstallation"></param>
|
||||||
/// <param name="packageFileInstallation"></param>
|
/// <param name="packageFileInstallation"></param>
|
||||||
/// <param name="parser"></param>
|
/// <param name="parser"></param>
|
||||||
|
/// <param name="packageActionRunner"></param>
|
||||||
/// <param name="packagesFolderPath">
|
/// <param name="packagesFolderPath">
|
||||||
/// The relative path of the package storage folder (i.e. ~/App_Data/Packages )
|
/// The relative path of the package storage folder (i.e. ~/App_Data/Packages )
|
||||||
/// </param>
|
/// </param>
|
||||||
@@ -36,13 +38,14 @@ namespace Umbraco.Core.Packaging
|
|||||||
/// <param name="packageExtractionFolder">
|
/// <param name="packageExtractionFolder">
|
||||||
/// The destination root folder to extract the package files (generally the same as applicationRoot) but can be modified for testing
|
/// The destination root folder to extract the package files (generally the same as applicationRoot) but can be modified for testing
|
||||||
/// </param>
|
/// </param>
|
||||||
public PackageInstallation(IPackagingService packagingService, PackageFileInstallation packageFileInstallation, CompiledPackageXmlParser parser,
|
public PackageInstallation(PackageDataInstallation packageDataInstallation, PackageFileInstallation packageFileInstallation, CompiledPackageXmlParser parser, IPackageActionRunner packageActionRunner,
|
||||||
string packagesFolderPath, DirectoryInfo applicationRootFolder, DirectoryInfo packageExtractionFolder)
|
string packagesFolderPath, DirectoryInfo applicationRootFolder, DirectoryInfo packageExtractionFolder)
|
||||||
{
|
{
|
||||||
_packageExtraction = new PackageExtraction();
|
_packageExtraction = new PackageExtraction();
|
||||||
_packageFileInstallation = packageFileInstallation;
|
_packageFileInstallation = packageFileInstallation ?? throw new ArgumentNullException(nameof(packageFileInstallation));
|
||||||
_packagingService = packagingService ?? throw new ArgumentNullException(nameof(packagingService));
|
_packageDataInstallation = packageDataInstallation ?? throw new ArgumentNullException(nameof(packageDataInstallation));
|
||||||
_parser = parser;
|
_parser = parser;
|
||||||
|
_packageActionRunner = packageActionRunner;
|
||||||
_packagesFolderPath = packagesFolderPath;
|
_packagesFolderPath = packagesFolderPath;
|
||||||
_applicationRootFolder = applicationRootFolder;
|
_applicationRootFolder = applicationRootFolder;
|
||||||
_packageExtractionFolder = packageExtractionFolder;
|
_packageExtractionFolder = packageExtractionFolder;
|
||||||
@@ -61,8 +64,6 @@ namespace Umbraco.Core.Packaging
|
|||||||
return compiledPackage;
|
return compiledPackage;
|
||||||
}
|
}
|
||||||
|
|
||||||
//fixme: Should we move all of the ImportXXXX methods here instead of on the IPackagingService? we don't want to have cicurlar refs
|
|
||||||
|
|
||||||
public IEnumerable<string> InstallPackageFiles(PackageDefinition packageDefinition, CompiledPackage compiledPackage, int userId)
|
public IEnumerable<string> InstallPackageFiles(PackageDefinition packageDefinition, CompiledPackage compiledPackage, int userId)
|
||||||
{
|
{
|
||||||
if (packageDefinition == null) throw new ArgumentNullException(nameof(packageDefinition));
|
if (packageDefinition == null) throw new ArgumentNullException(nameof(packageDefinition));
|
||||||
@@ -79,118 +80,77 @@ namespace Umbraco.Core.Packaging
|
|||||||
|
|
||||||
public InstallationSummary InstallPackageData(PackageDefinition packageDefinition, CompiledPackage compiledPackage, int userId)
|
public InstallationSummary InstallPackageData(PackageDefinition packageDefinition, CompiledPackage compiledPackage, int userId)
|
||||||
{
|
{
|
||||||
//fixme: fill this in
|
//TODO: Update the PackageDefinition!
|
||||||
throw new NotImplementedException();
|
|
||||||
|
var installationSummary = new InstallationSummary
|
||||||
|
{
|
||||||
|
DataTypesInstalled = _packageDataInstallation.ImportDataTypes(compiledPackage.DataTypes.ToList(), userId),
|
||||||
|
LanguagesInstalled = _packageDataInstallation.ImportLanguages(compiledPackage.Languages, userId),
|
||||||
|
DictionaryItemsInstalled = _packageDataInstallation.ImportDictionaryItems(compiledPackage.DictionaryItems, userId),
|
||||||
|
MacrosInstalled = _packageDataInstallation.ImportMacros(compiledPackage.Macros, userId),
|
||||||
|
TemplatesInstalled = _packageDataInstallation.ImportTemplates(compiledPackage.Templates.ToList(), userId),
|
||||||
|
DocumentTypesInstalled = _packageDataInstallation.ImportDocumentTypes(compiledPackage.DocumentTypes, userId)
|
||||||
|
};
|
||||||
|
|
||||||
|
//we need a reference to the imported doc types to continue
|
||||||
|
var importedDocTypes = installationSummary.DocumentTypesInstalled.ToDictionary(x => x.Alias, x => x);
|
||||||
|
|
||||||
|
installationSummary.StylesheetsInstalled = _packageDataInstallation.ImportStylesheets(compiledPackage.Stylesheets, userId);
|
||||||
|
installationSummary.ContentInstalled = _packageDataInstallation.ImportContent(compiledPackage.Documents, importedDocTypes, userId);
|
||||||
|
installationSummary.Actions = _parser.GetPackageActions(XElement.Parse(compiledPackage.Actions), compiledPackage.Name);
|
||||||
|
installationSummary.MetaData = compiledPackage;
|
||||||
|
//fixme: Verify that this will work!
|
||||||
|
installationSummary.FilesInstalled = packageDefinition.Files;
|
||||||
|
installationSummary.PackageInstalled = true;
|
||||||
|
|
||||||
|
//make sure the definition is up to date with everything
|
||||||
|
|
||||||
|
foreach (var x in installationSummary.DataTypesInstalled) packageDefinition.DataTypes.Add(x.Id.ToInvariantString());
|
||||||
|
foreach (var x in installationSummary.LanguagesInstalled) packageDefinition.Languages.Add(x.Id.ToInvariantString());
|
||||||
|
foreach (var x in installationSummary.DictionaryItemsInstalled) packageDefinition.DictionaryItems.Add(x.Id.ToInvariantString());
|
||||||
|
foreach (var x in installationSummary.MacrosInstalled) packageDefinition.Macros.Add(x.Id.ToInvariantString());
|
||||||
|
foreach (var x in installationSummary.TemplatesInstalled) packageDefinition.Templates.Add(x.Id.ToInvariantString());
|
||||||
|
foreach (var x in installationSummary.DocumentTypesInstalled) packageDefinition.DocumentTypes.Add(x.Id.ToInvariantString());
|
||||||
|
foreach (var x in installationSummary.StylesheetsInstalled) packageDefinition.Stylesheets.Add(x.Id.ToInvariantString());
|
||||||
|
var contentInstalled = installationSummary.ContentInstalled.ToList();
|
||||||
|
packageDefinition.ContentNodeId = contentInstalled.Count > 0 ? contentInstalled[0].Id.ToInvariantString() : null;
|
||||||
|
|
||||||
|
RunPackageActions(packageDefinition, installationSummary.Actions);
|
||||||
|
|
||||||
|
return installationSummary;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public InstallationSummary InstallPackage(FileInfo packageFile, int userId)
|
private void RunPackageActions(PackageDefinition packageDefinition, IEnumerable<PackageAction> actions)
|
||||||
//{
|
{
|
||||||
// XElement dataTypes;
|
foreach (var n in actions)
|
||||||
// XElement languages;
|
{
|
||||||
// XElement dictionaryItems;
|
var undo = n.Undo;
|
||||||
// XElement macroes;
|
if (undo)
|
||||||
// XElement files;
|
packageDefinition.Actions += n.XmlData.ToString();
|
||||||
// XElement templates;
|
|
||||||
// XElement documentTypes;
|
|
||||||
// XElement styleSheets;
|
|
||||||
// XElement documentSet;
|
|
||||||
// XElement documents;
|
|
||||||
// XElement actions;
|
|
||||||
// IPackageInfo metaData;
|
|
||||||
// InstallationSummary installationSummary;
|
|
||||||
|
|
||||||
// try
|
//Run the actions tagged only for 'install'
|
||||||
// {
|
if (n.RunAt != ActionRunAt.Install) continue;
|
||||||
// XElement rootElement = GetConfigXmlElement(packageFile);
|
|
||||||
// PackageSupportedCheck(rootElement);
|
|
||||||
// PackageStructureSanityCheck(packageFile, rootElement);
|
|
||||||
// dataTypes = rootElement.Element(Constants.Packaging.DataTypesNodeName);
|
|
||||||
// languages = rootElement.Element(Constants.Packaging.LanguagesNodeName);
|
|
||||||
// dictionaryItems = rootElement.Element(Constants.Packaging.DictionaryItemsNodeName);
|
|
||||||
// macroes = rootElement.Element(Constants.Packaging.MacrosNodeName);
|
|
||||||
// files = rootElement.Element(Constants.Packaging.FilesNodeName);
|
|
||||||
// templates = rootElement.Element(Constants.Packaging.TemplatesNodeName);
|
|
||||||
// documentTypes = rootElement.Element(Constants.Packaging.DocumentTypesNodeName);
|
|
||||||
// styleSheets = rootElement.Element(Constants.Packaging.StylesheetsNodeName);
|
|
||||||
// documentSet = rootElement.Element(Constants.Packaging.DocumentSetNodeName);
|
|
||||||
// documents = rootElement.Element(Constants.Packaging.DocumentsNodeName);
|
|
||||||
// actions = rootElement.Element(Constants.Packaging.ActionsNodeName);
|
|
||||||
|
|
||||||
// metaData = GetMetaData(rootElement);
|
if (n.Alias.IsNullOrWhiteSpace() == false)
|
||||||
// installationSummary = new InstallationSummary {MetaData = metaData};
|
_packageActionRunner.RunPackageAction(packageDefinition.Name, n.Alias, n.XmlData);
|
||||||
// }
|
}
|
||||||
// catch (Exception e)
|
}
|
||||||
// {
|
|
||||||
// throw new Exception("Error reading " + packageFile, e);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// var dataTypeDefinitions = EmptyEnumerableIfNull<IDataType>(dataTypes) ?? InstallDataTypes(dataTypes, userId);
|
|
||||||
// installationSummary.DataTypesInstalled = dataTypeDefinitions;
|
|
||||||
|
|
||||||
// var languagesInstalled = EmptyEnumerableIfNull<ILanguage>(languages) ?? InstallLanguages(languages, userId);
|
|
||||||
// installationSummary.LanguagesInstalled = languagesInstalled;
|
|
||||||
|
|
||||||
// var dictionaryInstalled = EmptyEnumerableIfNull<IDictionaryItem>(dictionaryItems) ?? InstallDictionaryItems(dictionaryItems);
|
|
||||||
// installationSummary.DictionaryItemsInstalled = dictionaryInstalled;
|
|
||||||
|
|
||||||
// var macros = EmptyEnumerableIfNull<IMacro>(macroes) ?? InstallMacros(macroes, userId);
|
|
||||||
// installationSummary.MacrosInstalled = macros;
|
|
||||||
|
|
||||||
// var templatesInstalled = EmptyEnumerableIfNull<ITemplate>(templates) ?? InstallTemplats(templates, userId);
|
|
||||||
// installationSummary.TemplatesInstalled = templatesInstalled;
|
|
||||||
|
|
||||||
// var documentTypesInstalled = EmptyEnumerableIfNull<IContentType>(documentTypes) ?? InstallDocumentTypes(documentTypes, userId);
|
|
||||||
// installationSummary.ContentTypesInstalled =documentTypesInstalled;
|
|
||||||
|
|
||||||
// var stylesheetsInstalled = EmptyEnumerableIfNull<IFile>(styleSheets) ?? InstallStylesheets(styleSheets);
|
|
||||||
// installationSummary.StylesheetsInstalled = stylesheetsInstalled;
|
|
||||||
|
|
||||||
// var documentsInstalled = documents != null ? InstallDocuments(documents, userId)
|
|
||||||
// : EmptyEnumerableIfNull<IContent>(documentSet)
|
|
||||||
// ?? InstallDocuments(documentSet, userId);
|
|
||||||
// installationSummary.ContentInstalled = documentsInstalled;
|
|
||||||
|
|
||||||
// var packageActions = EmptyEnumerableIfNull<PackageAction>(actions) ?? GetPackageActions(actions, metaData.Name);
|
|
||||||
// installationSummary.Actions = packageActions;
|
|
||||||
|
|
||||||
// installationSummary.PackageInstalled = true;
|
|
||||||
|
|
||||||
// return installationSummary;
|
|
||||||
// }
|
|
||||||
// catch (Exception e)
|
|
||||||
// {
|
|
||||||
// throw new Exception("Error installing package " + packageFile, e);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
private FileInfo GetPackageZipFile(string packageFileName) => new FileInfo(IOHelper.MapPath(_packagesFolderPath).EnsureEndsWith('\\') + packageFileName);
|
private FileInfo GetPackageZipFile(string packageFileName) => new FileInfo(IOHelper.MapPath(_packagesFolderPath).EnsureEndsWith('\\') + packageFileName);
|
||||||
|
|
||||||
private static IEnumerable<T> EmptyEnumerableIfNull<T>(object obj)
|
|
||||||
{
|
|
||||||
return obj == null ? Enumerable.Empty<T>() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private XDocument GetConfigXmlDoc(FileInfo packageFile)
|
private XDocument GetConfigXmlDoc(FileInfo packageFile)
|
||||||
{
|
{
|
||||||
var configXmlContent = _packageExtraction.ReadTextFileFromArchive(packageFile, Constants.Packaging.PackageXmlFileName, out _);
|
var configXmlContent = _packageExtraction.ReadTextFileFromArchive(packageFile, "package.xml", out _);
|
||||||
|
|
||||||
var document = XDocument.Parse(configXmlContent);
|
var document = XDocument.Parse(configXmlContent);
|
||||||
|
|
||||||
if (document.Root == null ||
|
if (document.Root == null ||
|
||||||
document.Root.Name.LocalName.Equals(Constants.Packaging.UmbPackageNodeName) == false)
|
document.Root.Name.LocalName.Equals("umbPackage") == false)
|
||||||
throw new FormatException("xml does not have a root node called \"umbPackage\"");
|
throw new FormatException("xml does not have a root node called \"umbPackage\"");
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XElement GetConfigXmlElement(FileInfo packageFile)
|
|
||||||
{
|
|
||||||
var document = GetConfigXmlDoc(packageFile);
|
|
||||||
return document.Root;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ValidatePackageFile(FileInfo packageFile, CompiledPackage package)
|
private void ValidatePackageFile(FileInfo packageFile, CompiledPackage package)
|
||||||
{
|
{
|
||||||
if (!(package.Files?.Count > 0)) return;
|
if (!(package.Files?.Count > 0)) return;
|
||||||
@@ -205,8 +165,8 @@ namespace Umbraco.Core.Packaging
|
|||||||
string.Join(", ", missingFiles.Select(
|
string.Join(", ", missingFiles.Select(
|
||||||
mf =>
|
mf =>
|
||||||
{
|
{
|
||||||
var sd = sourceDestination.Single(fi => fi.packageUniqueFile == mf);
|
var (packageUniqueFile, appRelativePath) = sourceDestination.Single(fi => fi.packageUniqueFile == mf);
|
||||||
return $"source: \"{sd.packageUniqueFile}\" destination: \"{sd.appRelativePath}\"";
|
return $"source: \"{packageUniqueFile}\" destination: \"{appRelativePath}\"";
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,143 +179,7 @@ namespace Umbraco.Core.Packaging
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<PackageAction> GetPackageActions(XElement actionsElement, string packageName)
|
|
||||||
{
|
|
||||||
if (actionsElement == null) { return new PackageAction[0]; }
|
|
||||||
|
|
||||||
if (string.Equals(Constants.Packaging.ActionsNodeName, actionsElement.Name.LocalName) == false)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Must be \"" + Constants.Packaging.ActionsNodeName + "\" as root",
|
|
||||||
"actionsElement");
|
|
||||||
}
|
|
||||||
|
|
||||||
return actionsElement.Elements(Constants.Packaging.ActionNodeName)
|
|
||||||
.Select(elemet =>
|
|
||||||
{
|
|
||||||
XAttribute aliasAttr = elemet.Attribute(Constants.Packaging.AliasNodeNameCapital);
|
|
||||||
if (aliasAttr == null)
|
|
||||||
throw new ArgumentException(
|
|
||||||
"missing \"" + Constants.Packaging.AliasNodeNameCapital + "\" atribute in alias element",
|
|
||||||
"actionsElement");
|
|
||||||
|
|
||||||
var packageAction = new PackageAction
|
|
||||||
{
|
|
||||||
XmlData = elemet,
|
|
||||||
Alias = aliasAttr.Value,
|
|
||||||
PackageName = packageName,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
var attr = elemet.Attribute(Constants.Packaging.RunatNodeAttribute);
|
|
||||||
|
|
||||||
if (attr != null && Enum.TryParse(attr.Value, true, out ActionRunAt runAt)) { packageAction.RunAt = runAt; }
|
|
||||||
|
|
||||||
attr = elemet.Attribute(Constants.Packaging.UndoNodeAttribute);
|
|
||||||
|
|
||||||
if (attr != null && bool.TryParse(attr.Value, out var undo)) { packageAction.Undo = undo; }
|
|
||||||
|
|
||||||
|
|
||||||
return packageAction;
|
|
||||||
}).ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IContent> InstallDocuments(XElement documentsElement, int userId = 0)
|
|
||||||
{
|
|
||||||
if ((string.Equals(Constants.Packaging.DocumentSetNodeName, documentsElement.Name.LocalName) == false)
|
|
||||||
&& (string.Equals(Constants.Packaging.DocumentsNodeName, documentsElement.Name.LocalName) == false))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Must be \"" + Constants.Packaging.DocumentsNodeName + "\" as root",
|
|
||||||
"documentsElement");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(Constants.Packaging.DocumentSetNodeName, documentsElement.Name.LocalName))
|
|
||||||
return _packagingService.ImportContent(documentsElement, -1, userId);
|
|
||||||
|
|
||||||
return
|
|
||||||
documentsElement.Elements(Constants.Packaging.DocumentSetNodeName)
|
|
||||||
.SelectMany(documentSetElement => _packagingService.ImportContent(documentSetElement, -1, userId))
|
|
||||||
.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IFile> InstallStylesheets(XElement styleSheetsElement)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.StylesheetsNodeName, styleSheetsElement.Name.LocalName) == false)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Must be \"" + Constants.Packaging.StylesheetsNodeName + "\" as root",
|
|
||||||
"styleSheetsElement");
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Call _packagingService when import stylesheets import has been implimentet
|
|
||||||
if (styleSheetsElement.HasElements == false) { return new List<IFile>(); }
|
|
||||||
|
|
||||||
throw new NotImplementedException("The packaging service do not yes have a method for importing stylesheets");
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IContentType> InstallDocumentTypes(XElement documentTypes, int userId = 0)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.DocumentTypesNodeName, documentTypes.Name.LocalName) == false)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.DocumentTypeNodeName, documentTypes.Name.LocalName) == false)
|
|
||||||
throw new ArgumentException(
|
|
||||||
"Must be \"" + Constants.Packaging.DocumentTypesNodeName + "\" as root", "documentTypes");
|
|
||||||
|
|
||||||
documentTypes = new XElement(Constants.Packaging.DocumentTypesNodeName, documentTypes);
|
|
||||||
}
|
|
||||||
|
|
||||||
return _packagingService.ImportContentTypes(documentTypes, userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<ITemplate> InstallTemplates(XElement templateElement, int userId = 0)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.TemplatesNodeName, templateElement.Name.LocalName) == false)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Must be \"" + Constants.Packaging.TemplatesNodeName + "\" as root",
|
|
||||||
"templateElement");
|
|
||||||
}
|
|
||||||
return _packagingService.ImportTemplates(templateElement, userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IMacro> InstallMacros(XElement macroElements, int userId = 0)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.MacrosNodeName, macroElements.Name.LocalName) == false)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Must be \"" + Constants.Packaging.MacrosNodeName + "\" as root",
|
|
||||||
"macroElements");
|
|
||||||
}
|
|
||||||
return _packagingService.ImportMacros(macroElements, userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IDictionaryItem> InstallDictionaryItems(XElement dictionaryItemsElement)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.DictionaryItemsNodeName, dictionaryItemsElement.Name.LocalName) ==
|
|
||||||
false)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Must be \"" + Constants.Packaging.DictionaryItemsNodeName + "\" as root",
|
|
||||||
"dictionaryItemsElement");
|
|
||||||
}
|
|
||||||
return _packagingService.ImportDictionaryItems(dictionaryItemsElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<ILanguage> InstallLanguages(XElement languageElement, int userId = 0)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.LanguagesNodeName, languageElement.Name.LocalName) == false)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Must be \"" + Constants.Packaging.LanguagesNodeName + "\" as root", "languageElement");
|
|
||||||
}
|
|
||||||
return _packagingService.ImportLanguages(languageElement, userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IDataType> InstallDataTypes(XElement dataTypeElements, int userId = 0)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.DataTypesNodeName, dataTypeElements.Name.LocalName) == false)
|
|
||||||
{
|
|
||||||
if (string.Equals(Constants.Packaging.DataTypeNodeName, dataTypeElements.Name.LocalName) == false)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Must be \"" + Constants.Packaging.DataTypeNodeName + "\" as root", "dataTypeElements");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _packagingService.ImportDataTypeDefinitions(dataTypeElements, userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,81 +72,6 @@ namespace Umbraco.Core.Services
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Importing
|
|
||||||
/// <summary>
|
|
||||||
/// Imports and saves package xml as <see cref="IContent"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="element">Xml to import</param>
|
|
||||||
/// <param name="parentId">Optional parent Id for the content being imported</param>
|
|
||||||
/// <param name="userId">Optional Id of the user performing the import</param>
|
|
||||||
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
|
|
||||||
/// <returns>An enumrable list of generated content</returns>
|
|
||||||
IEnumerable<IContent> ImportContent(XElement element, int parentId = -1, int userId = 0, bool raiseEvents = true);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Imports and saves package xml as <see cref="IContentType"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="element">Xml to import</param>
|
|
||||||
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin)</param>
|
|
||||||
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
|
|
||||||
/// <returns>An enumrable list of generated ContentTypes</returns>
|
|
||||||
IEnumerable<IContentType> ImportContentTypes(XElement element, int userId = 0, bool raiseEvents = true);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Imports and saves package xml as <see cref="IContentType"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="element">Xml to import</param>
|
|
||||||
/// <param name="importStructure">Boolean indicating whether or not to import the </param>
|
|
||||||
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin)</param>
|
|
||||||
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
|
|
||||||
/// <returns>An enumrable list of generated ContentTypes</returns>
|
|
||||||
IEnumerable<IContentType> ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Imports and saves package xml as <see cref="IDataType"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="element">Xml to import</param>
|
|
||||||
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin).</param>
|
|
||||||
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
|
|
||||||
/// <returns>An enumrable list of generated DataTypeDefinitions</returns>
|
|
||||||
IEnumerable<IDataType> ImportDataTypeDefinitions(XElement element, int userId = 0, bool raiseEvents = true);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Imports and saves the 'DictionaryItems' part of the package xml as a list of <see cref="IDictionaryItem"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dictionaryItemElementList">Xml to import</param>
|
|
||||||
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
|
|
||||||
/// <returns>An enumerable list of dictionary items</returns>
|
|
||||||
IEnumerable<IDictionaryItem> ImportDictionaryItems(XElement dictionaryItemElementList, bool raiseEvents = true);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Imports and saves the 'Languages' part of a package xml as a list of <see cref="ILanguage"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="languageElementList">Xml to import</param>
|
|
||||||
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin)</param>
|
|
||||||
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
|
|
||||||
/// <returns>An enumerable list of generated languages</returns>
|
|
||||||
IEnumerable<ILanguage> ImportLanguages(XElement languageElementList, int userId = 0, bool raiseEvents = true);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Imports and saves the 'Macros' part of a package xml as a list of <see cref="IMacro"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="element">Xml to import</param>
|
|
||||||
/// <param name="userId">Optional id of the User performing the operation</param>
|
|
||||||
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
IEnumerable<IMacro> ImportMacros(XElement element, int userId = 0, bool raiseEvents = true);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Imports and saves package xml as <see cref="ITemplate"/>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="element">Xml to import</param>
|
|
||||||
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin)</param>
|
|
||||||
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
|
|
||||||
/// <returns>An enumrable list of generated Templates</returns>
|
|
||||||
IEnumerable<ITemplate> ImportTemplates(XElement element, int userId = 0, bool raiseEvents = true);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This will fetch an Umbraco package file from the package repository and return the file name of the downloaded package
|
/// This will fetch an Umbraco package file from the package repository and return the file name of the downloaded package
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -320,7 +320,6 @@
|
|||||||
<Compile Include="Constants-Icons.cs" />
|
<Compile Include="Constants-Icons.cs" />
|
||||||
<Compile Include="Constants-ObjectTypes.cs" />
|
<Compile Include="Constants-ObjectTypes.cs" />
|
||||||
<Compile Include="Constants-PackageRepository.cs" />
|
<Compile Include="Constants-PackageRepository.cs" />
|
||||||
<Compile Include="Constants-Packaging.cs" />
|
|
||||||
<Compile Include="Constants-PropertyEditors.cs" />
|
<Compile Include="Constants-PropertyEditors.cs" />
|
||||||
<Compile Include="Constants-PropertyTypeGroups.cs" />
|
<Compile Include="Constants-PropertyTypeGroups.cs" />
|
||||||
<Compile Include="Constants-Security.cs" />
|
<Compile Include="Constants-Security.cs" />
|
||||||
@@ -447,9 +446,11 @@
|
|||||||
<Compile Include="Packaging\CompiledPackageXmlParser.cs" />
|
<Compile Include="Packaging\CompiledPackageXmlParser.cs" />
|
||||||
<Compile Include="Packaging\ICreatedPackagesRepository.cs" />
|
<Compile Include="Packaging\ICreatedPackagesRepository.cs" />
|
||||||
<Compile Include="Packaging\IInstalledPackagesRepository.cs" />
|
<Compile Include="Packaging\IInstalledPackagesRepository.cs" />
|
||||||
|
<Compile Include="Packaging\IPackageActionRunner.cs" />
|
||||||
<Compile Include="Packaging\IPackageDefinitionRepository.cs" />
|
<Compile Include="Packaging\IPackageDefinitionRepository.cs" />
|
||||||
<Compile Include="Packaging\IPackageInstallation.cs" />
|
<Compile Include="Packaging\IPackageInstallation.cs" />
|
||||||
<Compile Include="Packaging\PackageActionRunner.cs" />
|
<Compile Include="Packaging\PackageActionRunner.cs" />
|
||||||
|
<Compile Include="Packaging\PackageDataInstallation.cs" />
|
||||||
<Compile Include="Packaging\PackageDefinitionXmlParser.cs" />
|
<Compile Include="Packaging\PackageDefinitionXmlParser.cs" />
|
||||||
<Compile Include="Packaging\PackageFileInstallation.cs" />
|
<Compile Include="Packaging\PackageFileInstallation.cs" />
|
||||||
<Compile Include="Packaging\PackagesRepository.cs" />
|
<Compile Include="Packaging\PackagesRepository.cs" />
|
||||||
@@ -573,7 +574,6 @@
|
|||||||
<Compile Include="Events\IEventDispatcher.cs" />
|
<Compile Include="Events\IEventDispatcher.cs" />
|
||||||
<Compile Include="Events\IEventMessagesAccessor.cs" />
|
<Compile Include="Events\IEventMessagesAccessor.cs" />
|
||||||
<Compile Include="Events\IEventMessagesFactory.cs" />
|
<Compile Include="Events\IEventMessagesFactory.cs" />
|
||||||
<Compile Include="Events\ImportEventArgs.cs" />
|
|
||||||
<Compile Include="Events\ImportPackageEventArgs.cs" />
|
<Compile Include="Events\ImportPackageEventArgs.cs" />
|
||||||
<Compile Include="Events\MacroErrorEventArgs.cs" />
|
<Compile Include="Events\MacroErrorEventArgs.cs" />
|
||||||
<Compile Include="Events\MigrationEventArgs.cs" />
|
<Compile Include="Events\MigrationEventArgs.cs" />
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ using System.Linq;
|
|||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Umbraco.Core;
|
using Umbraco.Core;
|
||||||
|
using Umbraco.Core.Composing;
|
||||||
using Umbraco.Core.IO;
|
using Umbraco.Core.IO;
|
||||||
using Umbraco.Core.Models.Packaging;
|
using Umbraco.Core.Models.Packaging;
|
||||||
using Umbraco.Core.Packaging;
|
using Umbraco.Core.Packaging;
|
||||||
|
using Umbraco.Core.PropertyEditors;
|
||||||
using Umbraco.Core.Services;
|
using Umbraco.Core.Services;
|
||||||
using Umbraco.Core.Services.Implement;
|
using Umbraco.Core.Services.Implement;
|
||||||
using Umbraco.Tests.TestHelpers;
|
using Umbraco.Tests.TestHelpers;
|
||||||
@@ -38,10 +40,16 @@ namespace Umbraco.Tests.Packaging
|
|||||||
|
|
||||||
private CompiledPackageXmlParser Parser => new CompiledPackageXmlParser(new ConflictingPackageData(ServiceContext.MacroService, ServiceContext.FileService));
|
private CompiledPackageXmlParser Parser => new CompiledPackageXmlParser(new ConflictingPackageData(ServiceContext.MacroService, ServiceContext.FileService));
|
||||||
|
|
||||||
|
private PackageDataInstallation PackageDataInstallation => new PackageDataInstallation(
|
||||||
|
Logger, ServiceContext.FileService, ServiceContext.MacroService, ServiceContext.LocalizationService,
|
||||||
|
ServiceContext.DataTypeService, ServiceContext.EntityService,
|
||||||
|
ServiceContext.ContentTypeService, ServiceContext.ContentService,
|
||||||
|
Factory.GetInstance<PropertyEditorCollection>());
|
||||||
|
|
||||||
private IPackageInstallation PackageInstallation => new PackageInstallation(
|
private IPackageInstallation PackageInstallation => new PackageInstallation(
|
||||||
ServiceContext.PackagingService,
|
PackageDataInstallation,
|
||||||
new PackageFileInstallation(Parser, ProfilingLogger),
|
new PackageFileInstallation(Parser, ProfilingLogger),
|
||||||
Parser,
|
Parser, Mock.Of<IPackageActionRunner>(),
|
||||||
packagesFolderPath: "~/Packaging/packages",//this is where our test zip file is
|
packagesFolderPath: "~/Packaging/packages",//this is where our test zip file is
|
||||||
applicationRootFolder: new DirectoryInfo(IOHelper.GetRootDirectorySafe()),
|
applicationRootFolder: new DirectoryInfo(IOHelper.GetRootDirectorySafe()),
|
||||||
packageExtractionFolder: new DirectoryInfo(IOHelper.MapPath("~/" + _testBaseFolder))); //we don't want to extract package files to the real root, so extract to a test folder
|
packageExtractionFolder: new DirectoryInfo(IOHelper.MapPath("~/" + _testBaseFolder))); //we don't want to extract package files to the real root, so extract to a test folder
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Umbraco.Core;
|
|||||||
using Umbraco.Core.Composing;
|
using Umbraco.Core.Composing;
|
||||||
using Umbraco.Core.Composing.Composers;
|
using Umbraco.Core.Composing.Composers;
|
||||||
using Umbraco.Core.Logging;
|
using Umbraco.Core.Logging;
|
||||||
|
using Umbraco.Core.Packaging;
|
||||||
using Umbraco.Core.Persistence.Dtos;
|
using Umbraco.Core.Persistence.Dtos;
|
||||||
using Umbraco.Core.PropertyEditors;
|
using Umbraco.Core.PropertyEditors;
|
||||||
using Umbraco.Core.Services;
|
using Umbraco.Core.Services;
|
||||||
@@ -65,6 +66,8 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
Composition.ComposeFileSystems();
|
Composition.ComposeFileSystems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PackageDataInstallation PackagingService => Factory.GetInstance<PackageDataInstallation>();
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PackagingService_Can_Import_uBlogsy_ContentTypes_And_Verify_Structure()
|
public void PackagingService_Can_Import_uBlogsy_ContentTypes_And_Verify_Structure()
|
||||||
{
|
{
|
||||||
@@ -74,12 +77,11 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||||
var templateElement = xml.Descendants("Templates").First();
|
var templateElement = xml.Descendants("Templates").First();
|
||||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dataTypes = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
var dataTypes = PackagingService.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0);
|
||||||
var templates = packagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0);
|
||||||
|
|
||||||
var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count();
|
var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count();
|
||||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||||
@@ -122,12 +124,11 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||||
var templateElement = xml.Descendants("Templates").First();
|
var templateElement = xml.Descendants("Templates").First();
|
||||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dataTypes = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
var dataTypes = PackagingService.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0);
|
||||||
var templates = packagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var mRBasePage = contentTypes.First(x => x.Alias == "MRBasePage");
|
var mRBasePage = contentTypes.First(x => x.Alias == "MRBasePage");
|
||||||
@@ -148,12 +149,11 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||||
var templateElement = xml.Descendants("Templates").First();
|
var templateElement = xml.Descendants("Templates").First();
|
||||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dataTypes = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
var dataTypes = PackagingService.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0);
|
||||||
var templates = packagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0);
|
||||||
|
|
||||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||||
|
|
||||||
@@ -186,11 +186,11 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
string strXml = ImportResources.StandardMvc_Package;
|
string strXml = ImportResources.StandardMvc_Package;
|
||||||
var xml = XElement.Parse(strXml);
|
var xml = XElement.Parse(strXml);
|
||||||
var element = xml.Descendants("Templates").First();
|
var element = xml.Descendants("Templates").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
var init = ServiceContext.FileService.GetTemplates().Count();
|
var init = ServiceContext.FileService.GetTemplates().Count();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var templates = packagingService.ImportTemplates(element);
|
var templates = PackagingService.ImportTemplates(element.Elements("Template").ToList(), 0);
|
||||||
var numberOfTemplates = (from doc in element.Elements("Template") select doc).Count();
|
var numberOfTemplates = (from doc in element.Elements("Template") select doc).Count();
|
||||||
var allTemplates = ServiceContext.FileService.GetTemplates();
|
var allTemplates = ServiceContext.FileService.GetTemplates();
|
||||||
|
|
||||||
@@ -209,11 +209,11 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
// Arrange
|
// Arrange
|
||||||
string strXml = ImportResources.StandardMvc_Package;
|
string strXml = ImportResources.StandardMvc_Package;
|
||||||
var xml = XElement.Parse(strXml);
|
var xml = XElement.Parse(strXml);
|
||||||
var element = xml.Descendants("Templates").First().Element("Template");
|
var element = xml.Descendants("Templates").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var templates = packagingService.ImportTemplates(element);
|
var templates = PackagingService.ImportTemplate(element.Elements("Template").First(), 0);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(templates, Is.Not.Null);
|
Assert.That(templates, Is.Not.Null);
|
||||||
@@ -230,12 +230,12 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||||
var templateElement = xml.Descendants("Templates").First();
|
var templateElement = xml.Descendants("Templates").First();
|
||||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
var dataTypeDefinitions = PackagingService.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0);
|
||||||
var templates = packagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0);
|
||||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@@ -268,13 +268,13 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dataTypeDefinitions = ServiceContext.PackagingService.ImportDataTypeDefinitions(dataTypeElement);
|
var dataTypeDefinitions = PackagingService.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0);
|
||||||
var templates = ServiceContext.PackagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var contentTypes = ServiceContext.PackagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0);
|
||||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||||
|
|
||||||
//Assert - Re-Import contenttypes doesn't throw
|
//Assert - Re-Import contenttypes doesn't throw
|
||||||
Assert.DoesNotThrow(() => ServiceContext.PackagingService.ImportContentTypes(docTypeElement));
|
Assert.DoesNotThrow(() => PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0));
|
||||||
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
||||||
Assert.That(dataTypeDefinitions, Is.Not.Null);
|
Assert.That(dataTypeDefinitions, Is.Not.Null);
|
||||||
Assert.That(dataTypeDefinitions.Any(), Is.True);
|
Assert.That(dataTypeDefinitions.Any(), Is.True);
|
||||||
@@ -292,13 +292,13 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dataTypeDefinitions = ServiceContext.PackagingService.ImportDataTypeDefinitions(dataTypeElement);
|
var dataTypeDefinitions = PackagingService.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0);
|
||||||
var templates = ServiceContext.PackagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var contentTypes = ServiceContext.PackagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0);
|
||||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||||
|
|
||||||
//Assert - Re-Import contenttypes doesn't throw
|
//Assert - Re-Import contenttypes doesn't throw
|
||||||
Assert.DoesNotThrow(() => ServiceContext.PackagingService.ImportContentTypes(docTypeElement));
|
Assert.DoesNotThrow(() => PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0));
|
||||||
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
Assert.That(contentTypes.Count(), Is.EqualTo(numberOfDocTypes));
|
||||||
Assert.That(dataTypeDefinitions, Is.Not.Null);
|
Assert.That(dataTypeDefinitions, Is.Not.Null);
|
||||||
Assert.That(dataTypeDefinitions.Any(), Is.True);
|
Assert.That(dataTypeDefinitions.Any(), Is.True);
|
||||||
@@ -314,12 +314,13 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||||
var docTypesElement = xml.Descendants("DocumentTypes").First();
|
var docTypesElement = xml.Descendants("DocumentTypes").First();
|
||||||
var element = xml.Descendants("DocumentSet").First();
|
var element = xml.Descendants("DocumentSet").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
var dataTypeDefinitions = PackagingService.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0);
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypesElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypesElement.Elements("DocumentType"), 0);
|
||||||
var contents = packagingService.ImportContent(element);
|
var importedContentTypes = contentTypes.ToDictionary(x => x.Alias, x => x);
|
||||||
|
var contents = PackagingService.ImportContent(element, -1, importedContentTypes, 0);
|
||||||
var numberOfDocs = (from doc in element.Descendants()
|
var numberOfDocs = (from doc in element.Descendants()
|
||||||
where (string) doc.Attribute("isDoc") == ""
|
where (string) doc.Attribute("isDoc") == ""
|
||||||
select doc).Count();
|
select doc).Count();
|
||||||
@@ -347,12 +348,13 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var dataTypeElement = xml.Descendants("DataTypes").First();
|
var dataTypeElement = xml.Descendants("DataTypes").First();
|
||||||
var docTypesElement = xml.Descendants("DocumentTypes").First();
|
var docTypesElement = xml.Descendants("DocumentTypes").First();
|
||||||
var element = xml.Descendants("DocumentSet").First();
|
var element = xml.Descendants("DocumentSet").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement);
|
var dataTypeDefinitions = PackagingService.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0);
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypesElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypesElement.Elements("DocumentType"), 0);
|
||||||
var contents = packagingService.ImportContent(element);
|
var importedContentTypes = contentTypes.ToDictionary(x => x.Alias, x => x);
|
||||||
|
var contents = PackagingService.ImportContent(element, -1, importedContentTypes, 0);
|
||||||
var numberOfDocs = (from doc in element.Descendants()
|
var numberOfDocs = (from doc in element.Descendants()
|
||||||
where (string)doc.Attribute("isDoc") == ""
|
where (string)doc.Attribute("isDoc") == ""
|
||||||
select doc).Count();
|
select doc).Count();
|
||||||
@@ -382,10 +384,10 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
string strXml = ImportResources.XsltSearch_Package;
|
string strXml = ImportResources.XsltSearch_Package;
|
||||||
var xml = XElement.Parse(strXml);
|
var xml = XElement.Parse(strXml);
|
||||||
var templateElement = xml.Descendants("Templates").First();
|
var templateElement = xml.Descendants("Templates").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var templates = packagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count();
|
var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@@ -399,10 +401,10 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
// Arrange
|
// Arrange
|
||||||
string strXml = ImportResources.SingleDocType;
|
string strXml = ImportResources.SingleDocType;
|
||||||
var docTypeElement = XElement.Parse(strXml);
|
var docTypeElement = XElement.Parse(strXml);
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentType(docTypeElement, 0);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(contentTypes.Any(), Is.True);
|
Assert.That(contentTypes.Any(), Is.True);
|
||||||
@@ -416,11 +418,11 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
// Arrange
|
// Arrange
|
||||||
string strXml = ImportResources.SingleDocType;
|
string strXml = ImportResources.SingleDocType;
|
||||||
var docTypeElement = XElement.Parse(strXml);
|
var docTypeElement = XElement.Parse(strXml);
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
var serializer = Factory.GetInstance<IEntityXmlSerializer>();
|
var serializer = Factory.GetInstance<IEntityXmlSerializer>();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentType(docTypeElement, 0);
|
||||||
var contentType = contentTypes.FirstOrDefault();
|
var contentType = contentTypes.FirstOrDefault();
|
||||||
var element = serializer.Serialize(contentType);
|
var element = serializer.Serialize(contentType);
|
||||||
|
|
||||||
@@ -442,8 +444,8 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var docTypeElement = XElement.Parse(strXml);
|
var docTypeElement = XElement.Parse(strXml);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var contentTypes = ServiceContext.PackagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentType(docTypeElement, 0);
|
||||||
var contentTypesUpdated = ServiceContext.PackagingService.ImportContentTypes(docTypeElement);
|
var contentTypesUpdated = PackagingService.ImportDocumentType(docTypeElement, 0);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(contentTypes.Any(), Is.True);
|
Assert.That(contentTypes.Any(), Is.True);
|
||||||
@@ -465,7 +467,7 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
|
|
||||||
var templateElement = newPackageXml.Descendants("Templates").First();
|
var templateElement = newPackageXml.Descendants("Templates").First();
|
||||||
var templateElementUpdated = updatedPackageXml.Descendants("Templates").First();
|
var templateElementUpdated = updatedPackageXml.Descendants("Templates").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
var fileService = ServiceContext.FileService;
|
var fileService = ServiceContext.FileService;
|
||||||
|
|
||||||
// kill default test data
|
// kill default test data
|
||||||
@@ -473,8 +475,8 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
|
|
||||||
// Act
|
// Act
|
||||||
var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count();
|
var numberOfTemplates = (from doc in templateElement.Elements("Template") select doc).Count();
|
||||||
var templates = packagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var templatesAfterUpdate = packagingService.ImportTemplates(templateElementUpdated);
|
var templatesAfterUpdate = PackagingService.ImportTemplates(templateElementUpdated.Elements("Template").ToList(), 0);
|
||||||
var allTemplates = fileService.GetTemplates();
|
var allTemplates = fileService.GetTemplates();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@@ -500,7 +502,7 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
AddLanguages();
|
AddLanguages();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
ServiceContext.PackagingService.ImportDictionaryItems(dictionaryItemsElement);
|
PackagingService.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), 0);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB");
|
AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB");
|
||||||
@@ -522,7 +524,7 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
AddLanguages();
|
AddLanguages();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var dictionaryItems = ServiceContext.PackagingService.ImportDictionaryItems(dictionaryItemsElement);
|
var dictionaryItems = PackagingService.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), 0);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(ServiceContext.LocalizationService.DictionaryItemExists(parentKey), "DictionaryItem parentKey does not exist");
|
Assert.That(ServiceContext.LocalizationService.DictionaryItemExists(parentKey), "DictionaryItem parentKey does not exist");
|
||||||
@@ -551,7 +553,7 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
AddExistingEnglishAndNorwegianParentDictionaryItem(expectedEnglishParentValue, expectedNorwegianParentValue);
|
AddExistingEnglishAndNorwegianParentDictionaryItem(expectedEnglishParentValue, expectedNorwegianParentValue);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
ServiceContext.PackagingService.ImportDictionaryItems(dictionaryItemsElement);
|
PackagingService.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), 0);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB");
|
AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB");
|
||||||
@@ -576,7 +578,7 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
AddExistingEnglishParentDictionaryItem(expectedEnglishParentValue);
|
AddExistingEnglishParentDictionaryItem(expectedEnglishParentValue);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
ServiceContext.PackagingService.ImportDictionaryItems(dictionaryItemsElement);
|
PackagingService.ImportDictionaryItems(dictionaryItemsElement.Elements("DictionaryItem"), 0);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB");
|
AssertDictionaryItem("Parent", expectedEnglishParentValue, "en-GB");
|
||||||
@@ -593,7 +595,7 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var LanguageItemsElement = newPackageXml.Elements("Languages").First();
|
var LanguageItemsElement = newPackageXml.Elements("Languages").First();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var languages = ServiceContext.PackagingService.ImportLanguages(LanguageItemsElement);
|
var languages = PackagingService.ImportLanguages(LanguageItemsElement.Elements("Language"), 0);
|
||||||
var allLanguages = ServiceContext.LocalizationService.GetAllLanguages();
|
var allLanguages = ServiceContext.LocalizationService.GetAllLanguages();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@@ -611,10 +613,10 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
string strXml = ImportResources.uBlogsy_Package;
|
string strXml = ImportResources.uBlogsy_Package;
|
||||||
var xml = XElement.Parse(strXml);
|
var xml = XElement.Parse(strXml);
|
||||||
var macrosElement = xml.Descendants("Macros").First();
|
var macrosElement = xml.Descendants("Macros").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var macros = packagingService.ImportMacros(macrosElement).ToList();
|
var macros = PackagingService.ImportMacros(macrosElement.Elements("macro"), 0).ToList();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(macros.Any(), Is.True);
|
Assert.That(macros.Any(), Is.True);
|
||||||
@@ -633,10 +635,10 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
string strXml = ImportResources.XsltSearch_Package;
|
string strXml = ImportResources.XsltSearch_Package;
|
||||||
var xml = XElement.Parse(strXml);
|
var xml = XElement.Parse(strXml);
|
||||||
var macrosElement = xml.Descendants("Macros").First();
|
var macrosElement = xml.Descendants("Macros").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var macros = packagingService.ImportMacros(macrosElement).ToList();
|
var macros = PackagingService.ImportMacros(macrosElement.Elements("macro"), 0).ToList();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(macros.Any(), Is.True);
|
Assert.That(macros.Any(), Is.True);
|
||||||
@@ -657,11 +659,11 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
var xml = XElement.Parse(strXml);
|
var xml = XElement.Parse(strXml);
|
||||||
var templateElement = xml.Descendants("Templates").First();
|
var templateElement = xml.Descendants("Templates").First();
|
||||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var templates = packagingService.ImportTemplates(templateElement);
|
var templates = PackagingService.ImportTemplates(templateElement.Elements("Template").ToList(), 0);
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0);
|
||||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@@ -685,10 +687,10 @@ namespace Umbraco.Tests.Services.Importing
|
|||||||
string strXml = ImportResources.CompositionsTestPackage_Random;
|
string strXml = ImportResources.CompositionsTestPackage_Random;
|
||||||
var xml = XElement.Parse(strXml);
|
var xml = XElement.Parse(strXml);
|
||||||
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
var docTypeElement = xml.Descendants("DocumentTypes").First();
|
||||||
var packagingService = ServiceContext.PackagingService;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement);
|
var contentTypes = PackagingService.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0);
|
||||||
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
var numberOfDocTypes = (from doc in docTypeElement.Elements("DocumentType") select doc).Count();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Umbraco.Core.Scoping;
|
|||||||
using Umbraco.Core.Services;
|
using Umbraco.Core.Services;
|
||||||
using Umbraco.Core.Services.Implement;
|
using Umbraco.Core.Services.Implement;
|
||||||
using Umbraco.Core.Strings;
|
using Umbraco.Core.Strings;
|
||||||
|
using Umbraco.Tests.TestHelpers.Stubs;
|
||||||
using Umbraco.Web.Services;
|
using Umbraco.Web.Services;
|
||||||
|
|
||||||
namespace Umbraco.Tests.TestHelpers
|
namespace Umbraco.Tests.TestHelpers
|
||||||
@@ -78,9 +79,11 @@ namespace Umbraco.Tests.TestHelpers
|
|||||||
/// <param name="cache">A cache.</param>
|
/// <param name="cache">A cache.</param>
|
||||||
/// <param name="logger">A logger.</param>
|
/// <param name="logger">A logger.</param>
|
||||||
/// <param name="globalSettings"></param>
|
/// <param name="globalSettings"></param>
|
||||||
|
/// <param name="umbracoSettings"></param>
|
||||||
/// <param name="eventMessagesFactory">An event messages factory.</param>
|
/// <param name="eventMessagesFactory">An event messages factory.</param>
|
||||||
/// <param name="urlSegmentProviders">Some url segment providers.</param>
|
/// <param name="urlSegmentProviders">Some url segment providers.</param>
|
||||||
/// <param name="container">A container.</param>
|
/// <param name="typeLoader"></param>
|
||||||
|
/// <param name="factory">A container.</param>
|
||||||
/// <param name="scopeProvider"></param>
|
/// <param name="scopeProvider"></param>
|
||||||
/// <returns>A ServiceContext.</returns>
|
/// <returns>A ServiceContext.</returns>
|
||||||
/// <remarks>Should be used sparingly for integration tests only - for unit tests
|
/// <remarks>Should be used sparingly for integration tests only - for unit tests
|
||||||
@@ -168,12 +171,22 @@ namespace Umbraco.Tests.TestHelpers
|
|||||||
GetRepo<IEntityRepository>(c)));
|
GetRepo<IEntityRepository>(c)));
|
||||||
|
|
||||||
var macroService = GetLazyService<IMacroService>(factory, c => new MacroService(scopeProvider, logger, eventMessagesFactory, GetRepo<IMacroRepository>(c), GetRepo<IAuditRepository>(c)));
|
var macroService = GetLazyService<IMacroService>(factory, c => new MacroService(scopeProvider, logger, eventMessagesFactory, GetRepo<IMacroRepository>(c), GetRepo<IAuditRepository>(c)));
|
||||||
var packagingService = GetLazyService<IPackagingService>(factory, c => new PackagingService(
|
var packagingService = GetLazyService<IPackagingService>(factory, c =>
|
||||||
logger, contentService.Value, contentTypeService.Value, macroService.Value, dataTypeService.Value, fileService.Value, localizationService.Value, entityService.Value, auditService.Value, new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<DataEditor>())),
|
{
|
||||||
createdPackages: new PackagesRepository(contentService.Value, contentTypeService.Value, dataTypeService.Value, fileService.Value, macroService.Value, localizationService.Value,
|
var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty<DataEditor>()));
|
||||||
new EntityXmlSerializer(contentService.Value, mediaService.Value, dataTypeService.Value, userService.Value, localizationService.Value, contentTypeService.Value, urlSegmentProviders), logger, "createdPackages.config"),
|
var compiledPackageXmlParser = new CompiledPackageXmlParser(new ConflictingPackageData(macroService.Value, fileService.Value));
|
||||||
installedPackages: new PackagesRepository(contentService.Value, contentTypeService.Value, dataTypeService.Value, fileService.Value, macroService.Value, localizationService.Value,
|
return new PackagingService(
|
||||||
new EntityXmlSerializer(contentService.Value, mediaService.Value, dataTypeService.Value, userService.Value, localizationService.Value, contentTypeService.Value, urlSegmentProviders), logger, "installedPackages.config")));
|
auditService.Value,
|
||||||
|
new PackagesRepository(contentService.Value, contentTypeService.Value, dataTypeService.Value, fileService.Value, macroService.Value, localizationService.Value,
|
||||||
|
new EntityXmlSerializer(contentService.Value, mediaService.Value, dataTypeService.Value, userService.Value, localizationService.Value, contentTypeService.Value, urlSegmentProviders), logger, "createdPackages.config"),
|
||||||
|
new PackagesRepository(contentService.Value, contentTypeService.Value, dataTypeService.Value, fileService.Value, macroService.Value, localizationService.Value,
|
||||||
|
new EntityXmlSerializer(contentService.Value, mediaService.Value, dataTypeService.Value, userService.Value, localizationService.Value, contentTypeService.Value, urlSegmentProviders), logger, "installedPackages.config"),
|
||||||
|
new PackageInstallation(
|
||||||
|
new PackageDataInstallation(logger, fileService.Value, macroService.Value, localizationService.Value, dataTypeService.Value, entityService.Value, contentTypeService.Value, contentService.Value, propertyEditorCollection),
|
||||||
|
new PackageFileInstallation(compiledPackageXmlParser, new ProfilingLogger(logger, new TestProfiler())),
|
||||||
|
compiledPackageXmlParser, Mock.Of<IPackageActionRunner>(),
|
||||||
|
"", null, null));
|
||||||
|
});
|
||||||
var relationService = GetLazyService<IRelationService>(factory, c => new RelationService(scopeProvider, logger, eventMessagesFactory, entityService.Value, GetRepo<IRelationRepository>(c), GetRepo<IRelationTypeRepository>(c)));
|
var relationService = GetLazyService<IRelationService>(factory, c => new RelationService(scopeProvider, logger, eventMessagesFactory, entityService.Value, GetRepo<IRelationRepository>(c), GetRepo<IRelationTypeRepository>(c)));
|
||||||
var treeService = GetLazyService<IApplicationTreeService>(factory, c => new ApplicationTreeService(logger, cache, typeLoader));
|
var treeService = GetLazyService<IApplicationTreeService>(factory, c => new ApplicationTreeService(logger, cache, typeLoader));
|
||||||
var tagService = GetLazyService<ITagService>(factory, c => new TagService(scopeProvider, logger, eventMessagesFactory, GetRepo<ITagRepository>(c)));
|
var tagService = GetLazyService<ITagService>(factory, c => new TagService(scopeProvider, logger, eventMessagesFactory, GetRepo<ITagRepository>(c)));
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ namespace Umbraco.Web.Composing
|
|||||||
|
|
||||||
internal static ManifestValueValidatorCollection ManifestValidators => CoreCurrent.ManifestValidators;
|
internal static ManifestValueValidatorCollection ManifestValidators => CoreCurrent.ManifestValidators;
|
||||||
|
|
||||||
internal static PackageActionRunner PackageActionRunner => CoreCurrent.PackageActionRunner;
|
internal static IPackageActionRunner PackageActionRunner => CoreCurrent.PackageActionRunner;
|
||||||
|
|
||||||
internal static PackageActionCollection PackageActions => CoreCurrent.PackageActions;
|
internal static PackageActionCollection PackageActions => CoreCurrent.PackageActions;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ using Umbraco.Core.Dictionary;
|
|||||||
using Umbraco.Core.IO;
|
using Umbraco.Core.IO;
|
||||||
using Umbraco.Core.Logging;
|
using Umbraco.Core.Logging;
|
||||||
using Umbraco.Core.Models;
|
using Umbraco.Core.Models;
|
||||||
|
using Umbraco.Core.Packaging;
|
||||||
using Umbraco.Core.Persistence;
|
using Umbraco.Core.Persistence;
|
||||||
|
using Umbraco.Core.PropertyEditors;
|
||||||
using Umbraco.Core.Services;
|
using Umbraco.Core.Services;
|
||||||
using Umbraco.Core.Services.Implement;
|
using Umbraco.Core.Services.Implement;
|
||||||
using Umbraco.Web.Composing;
|
using Umbraco.Web.Composing;
|
||||||
@@ -46,10 +48,19 @@ namespace Umbraco.Web.Editors
|
|||||||
public class ContentTypeController : ContentTypeControllerBase<IContentType>
|
public class ContentTypeController : ContentTypeControllerBase<IContentType>
|
||||||
{
|
{
|
||||||
private readonly IEntityXmlSerializer _serializer;
|
private readonly IEntityXmlSerializer _serializer;
|
||||||
|
private readonly PropertyEditorCollection _propertyEditors;
|
||||||
|
|
||||||
public ContentTypeController(IEntityXmlSerializer serializer, ICultureDictionaryFactory cultureDictionaryFactory, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, CacheHelper applicationCache, IProfilingLogger logger, IRuntimeState runtimeState) : base(cultureDictionaryFactory, globalSettings, umbracoContextAccessor, sqlContext, services, applicationCache, logger, runtimeState)
|
public ContentTypeController(IEntityXmlSerializer serializer,
|
||||||
|
ICultureDictionaryFactory cultureDictionaryFactory,
|
||||||
|
IGlobalSettings globalSettings,
|
||||||
|
IUmbracoContextAccessor umbracoContextAccessor,
|
||||||
|
ISqlContext sqlContext, PropertyEditorCollection propertyEditors,
|
||||||
|
ServiceContext services, CacheHelper applicationCache,
|
||||||
|
IProfilingLogger logger, IRuntimeState runtimeState)
|
||||||
|
: base(cultureDictionaryFactory, globalSettings, umbracoContextAccessor, sqlContext, services, applicationCache, logger, runtimeState)
|
||||||
{
|
{
|
||||||
_serializer = serializer;
|
_serializer = serializer;
|
||||||
|
_propertyEditors = propertyEditors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetCount()
|
public int GetCount()
|
||||||
@@ -162,8 +173,8 @@ namespace Umbraco.Web.Editors
|
|||||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
var configuration = Current.Services.DataTypeService.GetDataType(id).Configuration;
|
var configuration = Services.DataTypeService.GetDataType(id).Configuration;
|
||||||
var editor = Current.PropertyEditors[dataTypeDiff.EditorAlias];
|
var editor = _propertyEditors[dataTypeDiff.EditorAlias];
|
||||||
|
|
||||||
return new ContentPropertyDisplay()
|
return new ContentPropertyDisplay()
|
||||||
{
|
{
|
||||||
@@ -488,14 +499,16 @@ namespace Umbraco.Web.Editors
|
|||||||
{
|
{
|
||||||
return Request.CreateResponse(HttpStatusCode.NotFound);
|
return Request.CreateResponse(HttpStatusCode.NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dataInstaller = new PackageDataInstallation(Logger, Services.FileService, Services.MacroService, Services.LocalizationService,
|
||||||
|
Services.DataTypeService, Services.EntityService, Services.ContentTypeService, Services.ContentService, _propertyEditors);
|
||||||
|
|
||||||
var xd = new XmlDocument();
|
var xd = new XmlDocument {XmlResolver = null};
|
||||||
xd.XmlResolver = null;
|
|
||||||
xd.Load(filePath);
|
xd.Load(filePath);
|
||||||
|
|
||||||
var userId = Security.GetUserId();
|
var userId = Security.GetUserId().ResultOr(0);
|
||||||
var element = XElement.Parse(xd.InnerXml);
|
var element = XElement.Parse(xd.InnerXml);
|
||||||
Current.Services.PackagingService.ImportContentTypes(element, userId);
|
dataInstaller.ImportDocumentType(element, userId);
|
||||||
|
|
||||||
// Try to clean up the temporary file.
|
// Try to clean up the temporary file.
|
||||||
try
|
try
|
||||||
@@ -504,7 +517,7 @@ namespace Umbraco.Web.Editors
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Current.Logger.Error<ContentTypeController>(ex, "Error cleaning up temporary udt file in App_Data: {File}", filePath);
|
Logger.Error<ContentTypeController>(ex, "Error cleaning up temporary udt file in App_Data: {File}", filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Request.CreateResponse(HttpStatusCode.OK);
|
return Request.CreateResponse(HttpStatusCode.OK);
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ namespace Umbraco.Web.Editors
|
|||||||
[UmbracoApplicationAuthorize(Core.Constants.Applications.Packages)]
|
[UmbracoApplicationAuthorize(Core.Constants.Applications.Packages)]
|
||||||
public class PackageInstallController : UmbracoAuthorizedJsonController
|
public class PackageInstallController : UmbracoAuthorizedJsonController
|
||||||
{
|
{
|
||||||
private readonly PackageActionRunner _packageActionRunner;
|
private readonly IPackageActionRunner _packageActionRunner;
|
||||||
|
|
||||||
public PackageInstallController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor,
|
public PackageInstallController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor,
|
||||||
ISqlContext sqlContext, ServiceContext services, CacheHelper applicationCache,
|
ISqlContext sqlContext, ServiceContext services, CacheHelper applicationCache,
|
||||||
IProfilingLogger logger, IRuntimeState runtimeState, PackageActionRunner packageActionRunner)
|
IProfilingLogger logger, IRuntimeState runtimeState, IPackageActionRunner packageActionRunner)
|
||||||
: base(globalSettings, umbracoContextAccessor, sqlContext, services, applicationCache, logger, runtimeState)
|
: base(globalSettings, umbracoContextAccessor, sqlContext, services, applicationCache, logger, runtimeState)
|
||||||
{
|
{
|
||||||
_packageActionRunner = packageActionRunner;
|
_packageActionRunner = packageActionRunner;
|
||||||
@@ -259,6 +259,7 @@ namespace Umbraco.Web.Editors
|
|||||||
};
|
};
|
||||||
|
|
||||||
// trigger the UninstalledPackage event
|
// trigger the UninstalledPackage event
|
||||||
|
// fixme: This all needs to be part of the service!
|
||||||
PackagingService.OnUninstalledPackage(new UninstallPackageEventArgs<UninstallationSummary>(summary, package, false));
|
PackagingService.OnUninstalledPackage(new UninstallPackageEventArgs<UninstallationSummary>(summary, package, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1136,7 +1136,6 @@
|
|||||||
<Compile Include="_Legacy\PackageActions\addProxyFeedHost.cs" />
|
<Compile Include="_Legacy\PackageActions\addProxyFeedHost.cs" />
|
||||||
<Compile Include="_Legacy\PackageActions\allowDoctype.cs" />
|
<Compile Include="_Legacy\PackageActions\allowDoctype.cs" />
|
||||||
<Compile Include="_Legacy\PackageActions\publishRootDocument.cs" />
|
<Compile Include="_Legacy\PackageActions\publishRootDocument.cs" />
|
||||||
<Compile Include="_Legacy\Packager\Installer.cs" />
|
|
||||||
<Compile Include="_Legacy\UI\ITask.cs" />
|
<Compile Include="_Legacy\UI\ITask.cs" />
|
||||||
<Compile Include="_Legacy\UI\ITaskReturnUrl.cs" />
|
<Compile Include="_Legacy\UI\ITaskReturnUrl.cs" />
|
||||||
<Compile Include="_Legacy\UI\LegacyDialogHandler.cs" />
|
<Compile Include="_Legacy\UI\LegacyDialogHandler.cs" />
|
||||||
|
|||||||
@@ -1,688 +0,0 @@
|
|||||||
//using System;
|
|
||||||
//using System.Collections.Generic;
|
|
||||||
//using System.Diagnostics;
|
|
||||||
//using System.Globalization;
|
|
||||||
//using System.IO;
|
|
||||||
//using System.Linq;
|
|
||||||
//using System.Net;
|
|
||||||
//using System.Xml;
|
|
||||||
//using System.Xml.Linq;
|
|
||||||
//using System.Xml.XPath;
|
|
||||||
//using ICSharpCode.SharpZipLib.Zip;
|
|
||||||
//using Umbraco.Core;
|
|
||||||
//using Umbraco.Core.Composing;
|
|
||||||
//using Umbraco.Core.Events;
|
|
||||||
//using Umbraco.Core.IO;
|
|
||||||
//using Umbraco.Core.Logging;
|
|
||||||
//using Umbraco.Core.Models;
|
|
||||||
//using Umbraco.Core.Models.Packaging;
|
|
||||||
//using Umbraco.Core.Packaging;
|
|
||||||
//using Umbraco.Core.Services.Implement;
|
|
||||||
//using File = System.IO.File;
|
|
||||||
|
|
||||||
//namespace Umbraco.Web._Legacy.Packager
|
|
||||||
//{
|
|
||||||
// /// <summary>
|
|
||||||
// /// The packager is a component which enables sharing of both data and functionality components between different umbraco installations.
|
|
||||||
// ///
|
|
||||||
// /// The output is a .umb (a zip compressed file) which contains the exported documents/medias/macroes/documentTypes (etc.)
|
|
||||||
// /// in a Xml document, along with the physical files used (images/usercontrols/xsl documents etc.)
|
|
||||||
// ///
|
|
||||||
// /// Partly implemented, import of packages is done, the export is *under construction*.
|
|
||||||
// /// </summary>
|
|
||||||
// /// <remarks>
|
|
||||||
// /// Ruben Verborgh 31/12/2007: I had to change some code, I marked my changes with "DATALAYER".
|
|
||||||
// /// Reason: @@IDENTITY can't be used with the new datalayer.
|
|
||||||
// /// I wasn't able to test the code, since I'm not aware how the code functions.
|
|
||||||
// /// </remarks>
|
|
||||||
// public class Installer
|
|
||||||
// {
|
|
||||||
// private const string PackageServer = "packages.umbraco.org";
|
|
||||||
|
|
||||||
// private readonly Dictionary<string, string> _conflictingMacroAliases = new Dictionary<string, string>();
|
|
||||||
// private readonly Dictionary<string, string> _conflictingTemplateAliases = new Dictionary<string, string>();
|
|
||||||
// private readonly Dictionary<string, string> _conflictingStyleSheetNames = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
// private readonly int _currentUserId = -1;
|
|
||||||
// private static WebClient _webClient;
|
|
||||||
|
|
||||||
|
|
||||||
// public string Name { get; private set; }
|
|
||||||
// public string Version { get; private set; }
|
|
||||||
// public string Url { get; private set; }
|
|
||||||
// public string License { get; private set; }
|
|
||||||
// public string LicenseUrl { get; private set; }
|
|
||||||
// public string Author { get; private set; }
|
|
||||||
// public string AuthorUrl { get; private set; }
|
|
||||||
// public string ReadMe { get; private set; }
|
|
||||||
// public string Control { get; private set; }
|
|
||||||
|
|
||||||
// public bool ContainsMacroConflict { get; private set; }
|
|
||||||
// public IDictionary<string, string> ConflictingMacroAliases => _conflictingMacroAliases;
|
|
||||||
|
|
||||||
// public bool ContainsUnsecureFiles { get; private set; }
|
|
||||||
// public List<string> UnsecureFiles { get; } = new List<string>();
|
|
||||||
|
|
||||||
// public bool ContainsTemplateConflicts { get; private set; }
|
|
||||||
// public IDictionary<string, string> ConflictingTemplateAliases => _conflictingTemplateAliases;
|
|
||||||
|
|
||||||
// public bool ContainsStyleSheeConflicts { get; private set; }
|
|
||||||
// public IDictionary<string, string> ConflictingStyleSheetNames => _conflictingStyleSheetNames;
|
|
||||||
|
|
||||||
// public int RequirementsMajor { get; private set; }
|
|
||||||
// public int RequirementsMinor { get; private set; }
|
|
||||||
// public int RequirementsPatch { get; private set; }
|
|
||||||
|
|
||||||
// public RequirementsType RequirementsType { get; private set; }
|
|
||||||
|
|
||||||
// public string IconUrl { get; private set; }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// The xml of the compiled package
|
|
||||||
// /// </summary>
|
|
||||||
// public XDocument Config { get; private set; }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Constructor
|
|
||||||
// /// </summary>
|
|
||||||
// public Installer()
|
|
||||||
// {
|
|
||||||
// Initialize();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public Installer(int currentUserId)
|
|
||||||
// {
|
|
||||||
// Initialize();
|
|
||||||
// _currentUserId = currentUserId;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private void Initialize()
|
|
||||||
// {
|
|
||||||
// ContainsTemplateConflicts = false;
|
|
||||||
// ContainsUnsecureFiles = false;
|
|
||||||
// ContainsMacroConflict = false;
|
|
||||||
// ContainsStyleSheeConflicts = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Constructor
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="name">The name of the package</param>
|
|
||||||
// /// <param name="version">The version of the package</param>
|
|
||||||
// /// <param name="url">The url to a descriptionpage</param>
|
|
||||||
// /// <param name="license">The license under which the package is released (preferably GPL ;))</param>
|
|
||||||
// /// <param name="licenseUrl">The url to a licensedescription</param>
|
|
||||||
// /// <param name="author">The original author of the package</param>
|
|
||||||
// /// <param name="authorUrl">The url to the Authors website</param>
|
|
||||||
// /// <param name="requirementsMajor">Umbraco version major</param>
|
|
||||||
// /// <param name="requirementsMinor">Umbraco version minor</param>
|
|
||||||
// /// <param name="requirementsPatch">Umbraco version patch</param>
|
|
||||||
// /// <param name="readme">The readme text</param>
|
|
||||||
// /// <param name="control">The name of the usercontrol used to configure the package after install</param>
|
|
||||||
// /// <param name="requirementsType"></param>
|
|
||||||
// /// <param name="iconUrl"></param>
|
|
||||||
// public Installer(string name, string version, string url, string license, string licenseUrl, string author, string authorUrl, int requirementsMajor, int requirementsMinor, int requirementsPatch, string readme, string control, RequirementsType requirementsType, string iconUrl)
|
|
||||||
// {
|
|
||||||
// ContainsTemplateConflicts = false;
|
|
||||||
// ContainsUnsecureFiles = false;
|
|
||||||
// ContainsMacroConflict = false;
|
|
||||||
// ContainsStyleSheeConflicts = false;
|
|
||||||
// this.Name = name;
|
|
||||||
// this.Version = version;
|
|
||||||
// this.Url = url;
|
|
||||||
// this.License = license;
|
|
||||||
// this.LicenseUrl = licenseUrl;
|
|
||||||
// this.RequirementsMajor = requirementsMajor;
|
|
||||||
// this.RequirementsMinor = requirementsMinor;
|
|
||||||
// this.RequirementsPatch = requirementsPatch;
|
|
||||||
// this.RequirementsType = requirementsType;
|
|
||||||
// this.Author = author;
|
|
||||||
// this.AuthorUrl = authorUrl;
|
|
||||||
// this.IconUrl = iconUrl;
|
|
||||||
// ReadMe = readme;
|
|
||||||
// this.Control = control;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #region Public Methods
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Imports the specified package
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="inputFile">Filename of the umbracopackage</param>
|
|
||||||
// /// <param name="deleteFile">true if the input file should be deleted after import</param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// public string Import(string inputFile, bool deleteFile)
|
|
||||||
// {
|
|
||||||
// using (Current.ProfilingLogger.DebugDuration<Installer>(
|
|
||||||
// $"Importing package file {inputFile}.",
|
|
||||||
// $"Package file {inputFile} imported."))
|
|
||||||
// {
|
|
||||||
// var tempDir = "";
|
|
||||||
// if (File.Exists(IOHelper.MapPath(SystemDirectories.Data + "/" + inputFile)))
|
|
||||||
// {
|
|
||||||
// var fi = new FileInfo(IOHelper.MapPath(SystemDirectories.Data + "/" + inputFile));
|
|
||||||
// // Check if the file is a valid package
|
|
||||||
// if (fi.Extension.ToLower() == ".umb")
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// tempDir = UnPack(fi.FullName, deleteFile);
|
|
||||||
// LoadConfig(tempDir);
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Current.Logger.Error<Installer>(ex, "Error importing file {FileName}", fi.FullName);
|
|
||||||
// throw;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// throw new Exception("Error - file isn't a package (doesn't have a .umb extension). Check if the file automatically got named '.zip' upon download.");
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// throw new Exception("Error - file not found. Could find file named '" + IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + inputFile) + "'");
|
|
||||||
// return tempDir;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Imports the specified package
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="inputFile">Filename of the umbracopackage</param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// public string Import(string inputFile)
|
|
||||||
// {
|
|
||||||
// return Import(inputFile, true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public int CreateManifest(Guid guid)
|
|
||||||
// {
|
|
||||||
// //This is the new improved install rutine, which chops up the process into 3 steps, creating the manifest, moving files, and finally handling umb objects
|
|
||||||
|
|
||||||
// var parser = new CompiledPackageXmlParser();
|
|
||||||
// var def = parser.ToCompiledPackage(Config);
|
|
||||||
|
|
||||||
// //create a new entry in the installedPackages.config
|
|
||||||
// var installedPackage = new PackageDefinition
|
|
||||||
// {
|
|
||||||
// Author = def.Author,
|
|
||||||
// AuthorUrl = def.AuthorUrl,
|
|
||||||
// Control = def.Control,
|
|
||||||
// IconUrl = def.IconUrl,
|
|
||||||
// License = def.License,
|
|
||||||
// LicenseUrl = def.LicenseUrl,
|
|
||||||
// Name = def.Name,
|
|
||||||
// Readme = def.Readme,
|
|
||||||
// UmbracoVersion = def.UmbracoVersion,
|
|
||||||
// Url = def.Url,
|
|
||||||
// Version = def.Version,
|
|
||||||
// PackageId = guid
|
|
||||||
// };
|
|
||||||
|
|
||||||
// if (!Current.Services.PackagingService.SaveInstalledPackage(installedPackage))
|
|
||||||
// throw new InvalidOperationException("Could not save package definition");
|
|
||||||
|
|
||||||
// return installedPackage.Id;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public void InstallFiles(int packageId, string tempDir)
|
|
||||||
// {
|
|
||||||
// var parser = new CompiledPackageXmlParser();
|
|
||||||
|
|
||||||
// using (Current.ProfilingLogger.DebugDuration<Installer>(
|
|
||||||
// "Installing package files for package id " + packageId + " into temp folder " + tempDir,
|
|
||||||
// "Package file installation complete for package id " + packageId))
|
|
||||||
// {
|
|
||||||
// //retrieve the manifest to continue installation
|
|
||||||
// var insPack = Current.Services.PackagingService.GetInstalledPackageById(packageId);
|
|
||||||
|
|
||||||
// //TODO: Depending on some files, some files should be installed differently.
|
|
||||||
// //i.e. if stylsheets should probably be installed via business logic, media items should probably use the media IFileSystem!
|
|
||||||
|
|
||||||
// // Move files
|
|
||||||
// //string virtualBasePath = System.Web.HttpContext.Current.Request.ApplicationPath;
|
|
||||||
// string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
|
|
||||||
|
|
||||||
// var def = parser.ToCompiledPackage(Config);
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// foreach (var f in def.Files)
|
|
||||||
// {
|
|
||||||
// var destPath = GetFileName(basePath, f.OriginalPath);
|
|
||||||
// var sourceFile = GetFileName(tempDir, f.UniqueFileName);
|
|
||||||
// var destFile = GetFileName(destPath, f.OriginalName);
|
|
||||||
|
|
||||||
// // Create the destination directory if it doesn't exist
|
|
||||||
// if (Directory.Exists(destPath) == false)
|
|
||||||
// Directory.CreateDirectory(destPath);
|
|
||||||
// //If a file with this name exists, delete it
|
|
||||||
// else if (File.Exists(destFile))
|
|
||||||
// File.Delete(destFile);
|
|
||||||
|
|
||||||
// // Copy the file
|
|
||||||
// // SJ: Note - this used to do a move but some packages included the same file to be
|
|
||||||
// // copied to multiple locations like so:
|
|
||||||
// //
|
|
||||||
// // <file>
|
|
||||||
// // <guid>my-icon.png</guid>
|
|
||||||
// // <orgPath>/umbraco/Images/</orgPath>
|
|
||||||
// // <orgName>my-icon.png</orgName>
|
|
||||||
// // </file>
|
|
||||||
// // <file>
|
|
||||||
// // <guid>my-icon.png</guid>
|
|
||||||
// // <orgPath>/App_Plugins/MyPlugin/Images</orgPath>
|
|
||||||
// // <orgName>my-icon.png</orgName>
|
|
||||||
// // </file>
|
|
||||||
// //
|
|
||||||
// // Since this file unzips as a flat list of files, moving the file the first time means
|
|
||||||
// // that when you try to do that a second time, it would result in a FileNotFoundException
|
|
||||||
// File.Copy(sourceFile, destFile);
|
|
||||||
|
|
||||||
// //PPH log file install
|
|
||||||
// insPack.Files.Add(f.OriginalPath.EnsureEndsWith('/') + f.OriginalName);
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Once we're done copying, remove all the files
|
|
||||||
// foreach (var f in def.Files)
|
|
||||||
// {
|
|
||||||
// var sourceFile = GetFileName(tempDir, f.UniqueFileName);
|
|
||||||
// if (File.Exists(sourceFile))
|
|
||||||
// File.Delete(sourceFile);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Current.Logger.Error<Installer>(ex, "Package install error");
|
|
||||||
// throw;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // log that a user has install files
|
|
||||||
// if (_currentUserId > -1)
|
|
||||||
// {
|
|
||||||
// Current.Services.AuditService.Add(AuditType.PackagerInstall,
|
|
||||||
// _currentUserId,
|
|
||||||
// -1, "Package", string.Format("Package '{0}' installed. Package guid: {1}", insPack.Name, insPack.PackageId));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Current.Services.PackagingService.SaveInstalledPackage(insPack);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public void InstallBusinessLogic(int packageId, string tempDir)
|
|
||||||
// {
|
|
||||||
// using (Current.ProfilingLogger.DebugDuration<Installer>(
|
|
||||||
// "Installing business logic for package id " + packageId + " into temp folder " + tempDir,
|
|
||||||
// "Package business logic installation complete for package id " + packageId))
|
|
||||||
// {
|
|
||||||
// PackageDefinition insPack;
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// //retrieve the manifest to continue installation
|
|
||||||
// insPack = Current.Services.PackagingService.GetInstalledPackageById(packageId);
|
|
||||||
// //bool saveNeeded = false;
|
|
||||||
|
|
||||||
// // Get current user, with a fallback
|
|
||||||
// var currentUser = Current.Services.UserService.GetUserById(Constants.Security.SuperUserId);
|
|
||||||
|
|
||||||
// //TODO: Get rid of this entire class! Until then all packages will be installed by the admin user
|
|
||||||
|
|
||||||
// var rootElement = Config.Root;
|
|
||||||
// var packagingService = Current.Services.PackagingService;
|
|
||||||
|
|
||||||
// //Perhaps it would have been a good idea to put the following into methods eh?!?
|
|
||||||
|
|
||||||
// #region DataTypes
|
|
||||||
// var dataTypeElement = rootElement.Descendants("DataTypes").FirstOrDefault();
|
|
||||||
// if (dataTypeElement != null)
|
|
||||||
// {
|
|
||||||
// var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement, currentUser.Id);
|
|
||||||
// foreach (var dataTypeDefinition in dataTypeDefinitions)
|
|
||||||
// {
|
|
||||||
// insPack.DataTypes.Add(dataTypeDefinition.Id.ToString(CultureInfo.InvariantCulture));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Languages
|
|
||||||
// var languageItemsElement = rootElement.Descendants("Languages").FirstOrDefault();
|
|
||||||
// if (languageItemsElement != null)
|
|
||||||
// {
|
|
||||||
// var insertedLanguages = packagingService.ImportLanguages(languageItemsElement);
|
|
||||||
// foreach(var x in insertedLanguages.Select(l => l.Id.ToString(CultureInfo.InvariantCulture)))
|
|
||||||
// insPack.Languages.Add(x);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Dictionary items
|
|
||||||
// var dictionaryItemsElement = rootElement.Descendants("DictionaryItems").FirstOrDefault();
|
|
||||||
// if (dictionaryItemsElement != null)
|
|
||||||
// {
|
|
||||||
// var insertedDictionaryItems = packagingService.ImportDictionaryItems(dictionaryItemsElement);
|
|
||||||
// foreach (var x in insertedDictionaryItems.Select(d => d.Id.ToString(CultureInfo.InvariantCulture)))
|
|
||||||
// insPack.DictionaryItems.Add(x);
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Macros
|
|
||||||
// var macroItemsElement = rootElement.Descendants("Macros").FirstOrDefault();
|
|
||||||
// if (macroItemsElement != null)
|
|
||||||
// {
|
|
||||||
// var insertedMacros = packagingService.ImportMacros(macroItemsElement);
|
|
||||||
// foreach (var x in insertedMacros.Select(m => m.Id.ToString(CultureInfo.InvariantCulture)))
|
|
||||||
// insPack.Macros.Add(x);
|
|
||||||
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Templates
|
|
||||||
// var templateElement = rootElement.Descendants("Templates").FirstOrDefault();
|
|
||||||
// if (templateElement != null)
|
|
||||||
// {
|
|
||||||
// var templates = packagingService.ImportTemplates(templateElement, currentUser.Id);
|
|
||||||
// foreach (var template in templates)
|
|
||||||
// {
|
|
||||||
// insPack.Templates.Add(template.Id.ToString(CultureInfo.InvariantCulture));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region DocumentTypes
|
|
||||||
// //Check whether the root element is a doc type rather then a complete package
|
|
||||||
// var docTypeElement = rootElement.Name.LocalName.Equals("DocumentType") ||
|
|
||||||
// rootElement.Name.LocalName.Equals("DocumentTypes")
|
|
||||||
// ? rootElement
|
|
||||||
// : rootElement.Descendants("DocumentTypes").FirstOrDefault();
|
|
||||||
|
|
||||||
// if (docTypeElement != null)
|
|
||||||
// {
|
|
||||||
// var contentTypes = packagingService.ImportContentTypes(docTypeElement, currentUser.Id);
|
|
||||||
// foreach (var contentType in contentTypes)
|
|
||||||
// {
|
|
||||||
// insPack.DocumentTypes.Add(contentType.Id.ToString(CultureInfo.InvariantCulture));
|
|
||||||
// //saveNeeded = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Stylesheets
|
|
||||||
// foreach (var n in Config.Root.XPathSelectElements("Stylesheets/Stylesheet"))
|
|
||||||
// {
|
|
||||||
// string stylesheetName = n.Element("Name")?.Value;
|
|
||||||
// if (stylesheetName.IsNullOrWhiteSpace()) continue;
|
|
||||||
|
|
||||||
// var s = Current.Services.FileService.GetStylesheetByName(stylesheetName);
|
|
||||||
// if (s == null)
|
|
||||||
// {
|
|
||||||
// var fileName = n.Element("FileName")?.Value;
|
|
||||||
// if (fileName == null) continue;
|
|
||||||
// var content = n.Element("Content")?.Value;
|
|
||||||
// if (content == null) continue;
|
|
||||||
|
|
||||||
// s = new Stylesheet(fileName) { Content = content };
|
|
||||||
// Current.Services.FileService.SaveStylesheet(s);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// foreach (var prop in n.XPathSelectElements("Properties/Property"))
|
|
||||||
// {
|
|
||||||
// string alias = prop.Element("Alias")?.Value;
|
|
||||||
// var sp = s.Properties.SingleOrDefault(p => p != null && p.Alias == alias);
|
|
||||||
// string name = prop.Element("Name")?.Value;
|
|
||||||
// if (sp == null)
|
|
||||||
// {
|
|
||||||
// //sp = StylesheetProperty.MakeNew(
|
|
||||||
// // name,
|
|
||||||
// // s,
|
|
||||||
// // u);
|
|
||||||
|
|
||||||
// sp = new StylesheetProperty(name, "#" + name.ToSafeAlias(), "");
|
|
||||||
// s.AddProperty(sp);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// //sp.Text = name;
|
|
||||||
// //Changing the name requires removing the current property and then adding another new one
|
|
||||||
// if (sp.Name != name)
|
|
||||||
// {
|
|
||||||
// s.RemoveProperty(sp.Name);
|
|
||||||
// var newProp = new StylesheetProperty(name, sp.Alias, sp.Value);
|
|
||||||
// s.AddProperty(newProp);
|
|
||||||
// sp = newProp;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// sp.Alias = alias;
|
|
||||||
// sp.Value = prop.Element("Value")?.Value;
|
|
||||||
// }
|
|
||||||
// //s.saveCssToFile();
|
|
||||||
// Current.Services.FileService.SaveStylesheet(s);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// insPack.Stylesheets.Add(s.Id.ToString(CultureInfo.InvariantCulture));
|
|
||||||
// //saveNeeded = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //if (saveNeeded) { insPack.Save(); saveNeeded = false; }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Documents
|
|
||||||
// var documentElement = rootElement.Descendants("DocumentSet").FirstOrDefault();
|
|
||||||
// if (documentElement != null)
|
|
||||||
// {
|
|
||||||
// var content = packagingService.ImportContent(documentElement, -1, currentUser.Id);
|
|
||||||
// var firstContentItem = content.First();
|
|
||||||
// insPack.ContentNodeId = firstContentItem.Id.ToString(CultureInfo.InvariantCulture);
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region Package Actions
|
|
||||||
// foreach (var n in Config.Root.XPathSelectElements("Actions/Action"))
|
|
||||||
// {
|
|
||||||
// var undo = n.AttributeValue<string>("undo");
|
|
||||||
// if (undo == null || undo == "true")
|
|
||||||
// {
|
|
||||||
// insPack.Actions += n.ToString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Run the actions tagged only for 'install'
|
|
||||||
// var runat = n.AttributeValue<string>("runat");
|
|
||||||
|
|
||||||
// if (runat != null && runat == "install")
|
|
||||||
// {
|
|
||||||
// var alias = n.AttributeValue<string>("alias");
|
|
||||||
// if (alias.IsNullOrWhiteSpace() == false)
|
|
||||||
// {
|
|
||||||
// Current.PackageActionRunner.RunPackageAction(insPack.Name, alias, n);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// Current.Services.PackagingService.SaveInstalledPackage(insPack);
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Current.Logger.Error<Installer>(ex, "Error installing businesslogic");
|
|
||||||
// throw;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// OnPackageInstalled(insPack);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Remove the temp installation folder
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="packageId"></param>
|
|
||||||
// /// <param name="tempDir"></param>
|
|
||||||
// public void InstallCleanUp(int packageId, string tempDir)
|
|
||||||
// {
|
|
||||||
// if (Directory.Exists(tempDir))
|
|
||||||
// {
|
|
||||||
// Directory.Delete(tempDir, true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Reads the configuration of the package from the configuration xmldocument
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="tempDir">The folder to which the contents of the package is extracted</param>
|
|
||||||
// public void LoadConfig(string tempDir)
|
|
||||||
// {
|
|
||||||
// Config = XDocument.Load(tempDir + Path.DirectorySeparatorChar + "package.xml");
|
|
||||||
|
|
||||||
// var parser = new CompiledPackageXmlParser();
|
|
||||||
// var def = parser.ToCompiledPackage(Config);
|
|
||||||
|
|
||||||
// Name = def.Name;
|
|
||||||
// Version = def.Version;
|
|
||||||
// Url = def.Url;
|
|
||||||
// License = def.License;
|
|
||||||
// LicenseUrl = def.LicenseUrl;
|
|
||||||
|
|
||||||
// RequirementsMajor = def.UmbracoVersion.Major;
|
|
||||||
// RequirementsMinor = def.UmbracoVersion.Minor;
|
|
||||||
// RequirementsPatch = def.UmbracoVersion.Build;
|
|
||||||
// RequirementsType = def.UmbracoVersionRequirementsType;
|
|
||||||
// IconUrl = def.IconUrl;
|
|
||||||
// Author = def.Author;
|
|
||||||
// AuthorUrl = def.AuthorUrl;
|
|
||||||
// ReadMe = def.Readme;
|
|
||||||
// Control = def.Control;
|
|
||||||
|
|
||||||
// var basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
|
|
||||||
// var dllBinFiles = new List<string>();
|
|
||||||
|
|
||||||
// foreach (var f in def.Files)
|
|
||||||
// {
|
|
||||||
// var badFile = false;
|
|
||||||
// var destPath = GetFileName(basePath, f.OriginalPath);
|
|
||||||
// var orgName = f.OriginalName;
|
|
||||||
// var destFile = GetFileName(destPath, orgName);
|
|
||||||
|
|
||||||
// if (destPath.ToLower().Contains(IOHelper.DirSepChar + "app_code"))
|
|
||||||
// {
|
|
||||||
// badFile = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (destPath.ToLower().Contains(IOHelper.DirSepChar + "bin"))
|
|
||||||
// {
|
|
||||||
// badFile = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (destFile.ToLower().EndsWith(".dll"))
|
|
||||||
// {
|
|
||||||
// badFile = true;
|
|
||||||
// dllBinFiles.Add(Path.Combine(tempDir, orgName));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (badFile)
|
|
||||||
// {
|
|
||||||
// ContainsUnsecureFiles = true;
|
|
||||||
// UnsecureFiles.Add(f.OriginalName);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// //this will check for existing macros with the same alias
|
|
||||||
// //since we will not overwrite on import it's a good idea to inform the user what will be overwritten
|
|
||||||
// foreach (var n in Config.Root.XPathSelectElements("//macro"))
|
|
||||||
// {
|
|
||||||
// var alias = n.Element("alias")?.Value;
|
|
||||||
// if (!string.IsNullOrEmpty(alias))
|
|
||||||
// {
|
|
||||||
// var m = Current.Services.MacroService.GetByAlias(alias);
|
|
||||||
// if (m != null)
|
|
||||||
// {
|
|
||||||
// ContainsMacroConflict = true;
|
|
||||||
// if (_conflictingMacroAliases.ContainsKey(m.Name) == false)
|
|
||||||
// {
|
|
||||||
// _conflictingMacroAliases.Add(m.Name, alias);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// foreach (var n in Config.Root.XPathSelectElements("Templates/Template"))
|
|
||||||
// {
|
|
||||||
// var alias = n.Element("Alias")?.Value;
|
|
||||||
// if (!string.IsNullOrEmpty(alias))
|
|
||||||
// {
|
|
||||||
// var t = Current.Services.FileService.GetTemplate(alias);
|
|
||||||
// if (t != null)
|
|
||||||
// {
|
|
||||||
// ContainsTemplateConflicts = true;
|
|
||||||
// if (_conflictingTemplateAliases.ContainsKey(t.Alias) == false)
|
|
||||||
// {
|
|
||||||
// _conflictingTemplateAliases.Add(t.Alias, alias);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// foreach (var n in Config.Root.XPathSelectElements("Stylesheets/Stylesheet"))
|
|
||||||
// {
|
|
||||||
// var alias = n.Element("Name")?.Value;
|
|
||||||
// if (!string.IsNullOrEmpty(alias))
|
|
||||||
// {
|
|
||||||
// var s = Current.Services.FileService.GetStylesheetByName(alias);
|
|
||||||
// if (s != null)
|
|
||||||
// {
|
|
||||||
// ContainsStyleSheeConflicts = true;
|
|
||||||
// if (_conflictingStyleSheetNames.ContainsKey(s.Alias) == false)
|
|
||||||
// {
|
|
||||||
// _conflictingStyleSheetNames.Add(s.Alias, alias);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// This uses the old method of fetching and only supports the packages.umbraco.org repository.
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="Package"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// public string Fetch(Guid Package)
|
|
||||||
// {
|
|
||||||
// // Check for package directory
|
|
||||||
// if (Directory.Exists(IOHelper.MapPath(SystemDirectories.Packages)) == false)
|
|
||||||
// Directory.CreateDirectory(IOHelper.MapPath(SystemDirectories.Packages));
|
|
||||||
|
|
||||||
// if (_webClient == null)
|
|
||||||
// _webClient = new WebClient();
|
|
||||||
|
|
||||||
// _webClient.DownloadFile(
|
|
||||||
// "http://" + PackageServer + "/fetch?package=" + Package.ToString(),
|
|
||||||
// IOHelper.MapPath(SystemDirectories.Packages + "/" + Package + ".umb"));
|
|
||||||
|
|
||||||
// return "packages\\" + Package + ".umb";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// private void OnPackageInstalled(PackageDefinition insPack)
|
|
||||||
// {
|
|
||||||
// // getting an InstallationSummary for sending to the PackagingService.ImportedPackage event
|
|
||||||
// var fileService = Current.Services.FileService;
|
|
||||||
// var macroService = Current.Services.MacroService;
|
|
||||||
// var contentTypeService = Current.Services.ContentTypeService;
|
|
||||||
// var dataTypeService = Current.Services.DataTypeService;
|
|
||||||
// var localizationService = Current.Services.LocalizationService;
|
|
||||||
|
|
||||||
// var installationSummary = InstallationSummary.FromPackageDefinition(insPack, contentTypeService, dataTypeService, fileService, localizationService, macroService);
|
|
||||||
// installationSummary.PackageInstalled = true;
|
|
||||||
|
|
||||||
// var args = new ImportPackageEventArgs<InstallationSummary>(installationSummary, insPack, false);
|
|
||||||
// PackagingService.OnImportedPackage(args);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
Reference in New Issue
Block a user