Skip to content

Commit 288d392

Browse files
committed
Working on getting the new packager logic implemented. This builds but will not work, lots more to do.
1 parent a1a1b9e commit 288d392

24 files changed

+944
-594
lines changed

src/Umbraco.Core/Events/ImportPackageEventArgs.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
using System.Collections.Generic;
2-
using Umbraco.Core.Packaging.Models;
2+
using Umbraco.Core.Models.Packaging;
33

44
namespace Umbraco.Core.Events
55
{
66
internal class ImportPackageEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>
77
{
8-
private readonly MetaData _packageMetaData;
8+
private readonly PackageMetaData _packageMetaData;
99

1010
public ImportPackageEventArgs(TEntity eventObject, bool canCancel)
1111
: base(new[] { eventObject }, canCancel)
1212
{
1313
}
1414

15-
public ImportPackageEventArgs(TEntity eventObject, MetaData packageMetaData)
15+
public ImportPackageEventArgs(TEntity eventObject, PackageMetaData packageMetaData)
1616
: base(new[] { eventObject })
1717
{
1818
_packageMetaData = packageMetaData;
1919
}
2020

21-
public MetaData PackageMetaData
21+
public PackageMetaData PackageMetaData
2222
{
2323
get { return _packageMetaData; }
2424
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Umbraco.Core.Models.Packaging
2+
{
3+
internal enum ActionRunAt
4+
{
5+
Undefined = 0,
6+
Install,
7+
Uninstall
8+
}
9+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Runtime.Serialization;
4+
5+
namespace Umbraco.Core.Models.Packaging
6+
{
7+
8+
/// <summary>
9+
/// A summary of all package item installed
10+
/// </summary>
11+
[Serializable]
12+
[DataContract(IsReference = true)]
13+
internal class InstallationSummary
14+
{
15+
public InstallationSummary(PackageMetaData metaData)
16+
:this()
17+
{
18+
InstalledPackage.MetaData = metaData;
19+
}
20+
21+
public InstallationSummary()
22+
{
23+
Actions = new List<PackageAction>();
24+
ContentInstalled = new List<IContent>();
25+
ContentTypesInstalled = new List<IContentType>();
26+
DataTypesInstalled = new List<IDataTypeDefinition>();
27+
DictionaryItemsInstalled = new List<IDictionaryItem>();
28+
LanguagesInstalled = new List<ILanguage>();
29+
MacrosInstalled = new List<IMacro>();
30+
TemplatesInstalled = new List<ITemplate>();
31+
32+
InstalledPackage = new InstalledPackage();
33+
}
34+
35+
public InstalledPackage InstalledPackage { get; set; }
36+
37+
public IEnumerable<IDataTypeDefinition> DataTypesInstalled { get; set; }
38+
public IEnumerable<ILanguage> LanguagesInstalled { get; set; }
39+
public IEnumerable<IDictionaryItem> DictionaryItemsInstalled { get; set; }
40+
public IEnumerable<IMacro> MacrosInstalled { get; set; }
41+
public IEnumerable<ITemplate> TemplatesInstalled { get; set; }
42+
public IEnumerable<IContentType> ContentTypesInstalled { get; set; }
43+
public IEnumerable<IFile> StylesheetsInstalled { get; set; }
44+
public IEnumerable<IContent> ContentInstalled { get; set; }
45+
public IEnumerable<PackageAction> Actions { get; set; }
46+
47+
}
48+
49+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using Umbraco.Core.Models.EntityBase;
5+
6+
namespace Umbraco.Core.Models.Packaging
7+
{
8+
/// <summary>
9+
/// Represents an installed package
10+
/// </summary>
11+
internal class InstalledPackage : Entity
12+
{
13+
/// <summary>
14+
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
15+
/// </summary>
16+
public InstalledPackage()
17+
{
18+
MetaData = new PackageMetaData();
19+
Macros = new List<int>();
20+
Templates = new List<int>();
21+
Stylesheets = new List<int>();
22+
DocumentTypes = new List<int>();
23+
Languages = new List<int>();
24+
DictionaryItems = new List<int>();
25+
DataTypes = new List<int>();
26+
Files = new List<string>();
27+
}
28+
29+
/// <summary>
30+
/// The unique package identifier
31+
/// </summary>
32+
public Guid PackageIdentifier { get; set; }
33+
34+
public bool EnableSkins { get; set; }
35+
public Guid SkinRepositoryId { get; set; }
36+
public Guid PackageRepositoryId { get; set; }
37+
38+
public bool HasUpdate { get; set; }
39+
40+
public PackageMetaData MetaData { get; set; }
41+
42+
public string Actions { get; set; }
43+
44+
public int? ContentNodeId { get; set; }
45+
public bool LoadChildContentNodes { get; set; }
46+
47+
public IEnumerable<int> Macros { get; set; }
48+
public IEnumerable<int> Templates { get; set; }
49+
public IEnumerable<int> Stylesheets { get; set; }
50+
public IEnumerable<int> DocumentTypes { get; set; }
51+
public IEnumerable<int> Languages { get; set; }
52+
public IEnumerable<int> DictionaryItems { get; set; }
53+
public IEnumerable<int> DataTypes { get; set; }
54+
55+
public IEnumerable<string> Files { get; set; }
56+
57+
58+
59+
}
60+
}
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
using System;
2-
using System.Runtime.Serialization;
3-
using System.Xml.Linq;
4-
5-
namespace Umbraco.Core.Packaging.Models
6-
{
7-
internal enum ActionRunAt
8-
{
9-
Undefined = 0,
10-
Install,
11-
Uninstall
12-
}
13-
14-
[Serializable]
15-
[DataContract(IsReference = true)]
16-
internal class PackageAction
17-
{
18-
private ActionRunAt _runAt;
19-
private bool? _undo;
20-
public string Alias { get; set; }
21-
22-
public string PackageName { get; set; }
23-
24-
public ActionRunAt RunAt
25-
{
26-
get { return _runAt == ActionRunAt.Undefined ? ActionRunAt.Install : _runAt; }
27-
set { _runAt = value; }
28-
}
29-
30-
public bool Undo //NOTE: Should thid default to "False"? but the documentation says default "True" (http://our.umbraco.org/wiki/reference/packaging/package-actions)
31-
{
32-
get { return _undo ?? true; }
33-
set { _undo = value; }
34-
}
35-
36-
public XElement XmlData { get; set; }
37-
}
1+
using System;
2+
using System.Runtime.Serialization;
3+
using System.Xml.Linq;
4+
5+
namespace Umbraco.Core.Models.Packaging
6+
{
7+
[Serializable]
8+
[DataContract(IsReference = true)]
9+
internal class PackageAction
10+
{
11+
private ActionRunAt _runAt;
12+
private bool? _undo;
13+
public string Alias { get; set; }
14+
15+
public string PackageName { get; set; }
16+
17+
public ActionRunAt RunAt
18+
{
19+
get { return _runAt == ActionRunAt.Undefined ? ActionRunAt.Install : _runAt; }
20+
set { _runAt = value; }
21+
}
22+
23+
public bool Undo //NOTE: Should thid default to "False"? but the documentation says default "True" (http://our.umbraco.org/wiki/reference/packaging/package-actions)
24+
{
25+
get { return _undo ?? true; }
26+
set { _undo = value; }
27+
}
28+
29+
public XElement XmlData { get; set; }
30+
}
3831
}

src/Umbraco.Core/Packaging/Models/MetaData.cs renamed to src/Umbraco.Core/Models/Packaging/PackageMetaData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using System;
22
using System.Runtime.Serialization;
33

4-
namespace Umbraco.Core.Packaging.Models
4+
namespace Umbraco.Core.Models.Packaging
55
{
66
[Serializable]
77
[DataContract(IsReference = true)]
8-
internal class MetaData
8+
internal class PackageMetaData
99
{
1010
public string Name { get; set; }
1111
public string Version { get; set; }
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Runtime.Serialization;
4-
using Umbraco.Core.Models;
5-
6-
namespace Umbraco.Core.Packaging.Models
7-
{
8-
[Serializable]
9-
[DataContract(IsReference = true)]
10-
internal class PreInstallWarnings
11-
{
12-
public KeyValuePair<string, string>[] UnsecureFiles { get; set; }
13-
public KeyValuePair<string, string>[] FilesReplaced { get; set; }
14-
public IEnumerable<IMacro> ConflictingMacroAliases { get; set; }
15-
public IEnumerable<ITemplate> ConflictingTemplateAliases { get; set; }
16-
public IEnumerable<IFile> ConflictingStylesheetNames { get; set; }
17-
public IEnumerable<string> AssembliesWithLegacyPropertyEditors { get; set; }
18-
}
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Runtime.Serialization;
4+
5+
namespace Umbraco.Core.Models.Packaging
6+
{
7+
[Serializable]
8+
[DataContract(IsReference = true)]
9+
internal class PreInstallWarnings
10+
{
11+
public KeyValuePair<string, string>[] ServerSideScripts { get; set; }
12+
public KeyValuePair<string, string>[] FilesReplaced { get; set; }
13+
public IEnumerable<IMacro> ConflictingMacroAliases { get; set; }
14+
public IEnumerable<ITemplate> ConflictingTemplateAliases { get; set; }
15+
public IEnumerable<IFile> ConflictingStylesheetNames { get; set; }
16+
public IEnumerable<string> AssembliesWithLegacyPropertyEditors { get; set; }
17+
public IEnumerable<string> AssemblyErrors { get; set; }
18+
}
1919
}

src/Umbraco.Core/Packaging/IPackageInstallation.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1-
using System.Xml.Linq;
2-
using Umbraco.Core.Packaging.Models;
1+
using System;
2+
using System.Xml.Linq;
3+
using Umbraco.Core.Models.Packaging;
4+
using Umbraco.Core.Persistence.Repositories;
35

46
namespace Umbraco.Core.Packaging
57
{
68
internal interface IPackageInstallation
79
{
8-
InstallationSummary InstallPackage(string packageFilePath, int userId);
9-
MetaData GetMetaData(string packageFilePath);
10+
/// <summary>
11+
/// This will install all of the files for the package - this needs to be done before the package data is installed
12+
/// </summary>
13+
/// <param name="packageFile"></param>
14+
/// <returns></returns>
15+
InstalledPackage InstallPackageFiles(string packageFile);
16+
17+
/// <summary>
18+
/// This will install the business logic data for the package - this can only be called after the package files are installed
19+
/// </summary>
20+
/// <param name="packageFile"></param>
21+
/// <param name="userId"></param>
22+
/// <returns></returns>
23+
InstallationSummary InstallPackageData(string packageFile, int userId);
24+
25+
PackageMetaData GetMetaData(string packageFilePath);
1026
PreInstallWarnings GetPreInstallWarnings(string packageFilePath);
1127
XElement GetConfigXmlElement(string packageFilePath);
1228
}

src/Umbraco.Core/Packaging/Models/InstallationSummary.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/Umbraco.Core/Packaging/PackageBuilding.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)