Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Upgrade/Installer Code #4119

Merged
merged 18 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,002 changes: 500 additions & 502 deletions DNN Platform/Library/Common/Initialize.cs

Large diffs are not rendered by default.

122 changes: 4 additions & 118 deletions DNN Platform/Library/Services/Installer/LegacyUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public static void ParsePackageName(PackageInfo package)
/// <summary>
/// Process legacy language package (that is based on manifest xml file).
/// </summary>
[Obsolete("Module package required, functionality removed. Will be removed in 10.0.0.")]
public static void ProcessLegacyLanguages()
{
string filePath = Globals.ApplicationMapPath + Localization.SupportedLocalesFile.Substring(1).Replace("/", "\\");
Expand Down Expand Up @@ -266,12 +267,13 @@ public static void ProcessLegacyLanguages()
}
}
}
}

}
/// <summary>
/// Process legacy module version 3 .dnn install file.
/// </summary>
/// <param name="desktopModule"></param>
[Obsolete("Version 3 package formats not supported, must use modern package format. Will be removed in 10.0.0.")]
public static void ProcessLegacyModule(DesktopModuleInfo desktopModule)
{
// Get the Module folder
Expand Down Expand Up @@ -343,77 +345,6 @@ public static void ProcessLegacyModule(DesktopModuleInfo desktopModule)
}
}

public static void ProcessLegacyModules()
valadas marked this conversation as resolved.
Show resolved Hide resolved
{
foreach (DesktopModuleInfo desktopModule in DesktopModuleController.GetDesktopModules(Null.NullInteger).Values)
{
if (desktopModule.PackageID == Null.NullInteger)
{
ProcessLegacyModule(desktopModule);
}
}
}

/// <summary>
/// Process legacy skinobject version 3 .dnn install package.
/// </summary>
public static void ProcessLegacySkinControls()
{
foreach (SkinControlInfo skinControl in SkinControlController.GetSkinControls().Values)
{
if (skinControl.PackageID == Null.NullInteger)
{
try
{
// SkinControl is not affiliated with a Package
var package = new PackageInfo(new InstallerInfo());
package.Name = skinControl.ControlKey;

package.FriendlyName = skinControl.ControlKey;
package.Description = Null.NullString;
package.Version = new Version(1, 0, 0);
package.PackageType = "SkinObject";

// See if the SkinControl is using a "Namespace" for its name
ParsePackageName(package);

var skinControlWriter = new SkinControlPackageWriter(skinControl, package);
package.Manifest = skinControlWriter.WriteManifest(true);

// Save Package
PackageController.Instance.SaveExtensionPackage(package);

// Update SkinControl with new PackageID
skinControl.PackageID = package.PackageID;

// Save SkinControl
SkinControlController.SaveSkinControl(skinControl);
}
catch (Exception exc)
{
Logger.Error(exc);
}
}
}
}

public static void ProcessLegacySkins()
{
// Process Legacy Skins
string skinRootPath = Path.Combine(Globals.HostMapPath, SkinController.RootSkin);
foreach (string skinFolder in Directory.GetDirectories(skinRootPath))
{
ProcessLegacySkin(skinFolder, "Skin");
}

// Process Legacy Containers
skinRootPath = Path.Combine(Globals.HostMapPath, SkinController.RootContainer);
foreach (string skinFolder in Directory.GetDirectories(skinRootPath))
{
ProcessLegacySkin(skinFolder, "Container");
}
}

private static PackageInfo CreateSkinPackage(SkinPackageInfo skin)
{
// Create a Package
Expand Down Expand Up @@ -452,51 +383,6 @@ private static void CreateSkinManifest(XmlWriter writer, string skinFolder, stri
skinWriter.WriteManifest(writer, true);
}

private static void ProcessLegacySkin(string skinFolder, string skinType)
{
string skinName = Path.GetFileName(skinFolder);
if (skinName != "_default")
{
var skin = new SkinPackageInfo();
skin.SkinName = skinName;
skin.SkinType = skinType;

// Create a Package
PackageInfo package = CreateSkinPackage(skin);

// Create a SkinPackageWriter
var skinWriter = new SkinPackageWriter(skin, package);
skinWriter.GetFiles(false);

// Save the manifest
package.Manifest = skinWriter.WriteManifest(true);

// Save Package
PackageController.Instance.SaveExtensionPackage(package);

// Update Skin Package with new PackageID
skin.PackageID = package.PackageID;

// Save Skin Package
skin.SkinPackageID = SkinController.AddSkinPackage(skin);

foreach (InstallFile skinFile in skinWriter.Files.Values)
{
if (skinFile.Type == InstallFileType.Ascx)
{
if (skinType == "Skin")
{
SkinController.AddSkin(skin.SkinPackageID, Path.Combine("[G]" + SkinController.RootSkin, Path.Combine(skin.SkinName, skinFile.FullName)));
}
else
{
SkinController.AddSkin(skin.SkinPackageID, Path.Combine("[G]" + SkinController.RootContainer, Path.Combine(skin.SkinName, skinFile.FullName)));
}
}
}
}
}

private static void ParsePackageName(PackageInfo package, string separator)
{
// See if the Module is using a "Namespace" for its name
Expand Down
Loading