diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/ourpackagerrepository.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/ourpackagerrepository.resource.js
index 8d27b69dc6..d9307c7c28 100644
--- a/src/Umbraco.Web.UI.Client/src/common/resources/ourpackagerrepository.resource.js
+++ b/src/Umbraco.Web.UI.Client/src/common/resources/ourpackagerrepository.resource.js
@@ -5,7 +5,7 @@
**/
function ourPackageRepositoryResource($q, $http, umbDataFormatter, umbRequestHelper) {
- var baseurl = "http://localhost:24292/webapi/packages/v1";
+ var baseurl = "https://our.umbraco.org/webapi/packages/v1";
return {
diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
index b400185b02..561b9dd753 100644
--- a/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
@@ -31,7 +31,7 @@ function FormsController($scope, $route, $cookieStore, packageResource) {
return packageResource.installFiles(pack);
}, $scope.error)
.then(function(pack){
- $scope.state = "Restarting, please hold...";
+ $scope.state = "Restarting, please wait...";
return packageResource.installData(pack);
}, $scope.error)
.then(function(pack){
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/overview.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/overview.controller.js
index 5cf6e6bc07..c03b6cd230 100644
--- a/src/Umbraco.Web.UI.Client/src/views/packager/overview.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/packager/overview.controller.js
@@ -1,34 +1,47 @@
(function () {
"use strict";
- function PackagesOverviewController($scope, $route, $location, navigationService, $timeout) {
+ function PackagesOverviewController($scope, $route, $location, navigationService, $timeout, $cookieStore) {
- var vm = this;
+ //Hack!
+ // if there is a cookie value for packageInstallUri then we need to redirect there,
+ // the issue is that we still have webforms and we cannot go to a hash location and then window.reload
+ // because it will double load it.
+ // we will refresh and then navigate there.
+
+ var installPackageUri = window.localStorage.getItem("packageInstallUri");
+ if (installPackageUri) {
+ window.localStorage.removeItem("packageInstallUri");
+ $location.path(installPackageUri).search("");
+ }
+ else {
+ var vm = this;
- vm.page = {};
- vm.page.name = "Packages";
- vm.page.navigation = [
- {
- "name": "Packages",
- "icon": "icon-cloud",
- "view": "views/packager/views/repo.html",
- "active": true
- },
- {
- "name": "Installed",
- "icon": "icon-box",
- "view": "views/packager/views/installed.html"
- },
- {
- "name": "Install local",
- "icon": "icon-add",
- "view": "views/packager/views/install-local.html"
- }
- ];
+ vm.page = {};
+ vm.page.name = "Packages";
+ vm.page.navigation = [
+ {
+ "name": "Packages",
+ "icon": "icon-cloud",
+ "view": "views/packager/views/repo.html",
+ "active": true
+ },
+ {
+ "name": "Installed",
+ "icon": "icon-box",
+ "view": "views/packager/views/installed.html"
+ },
+ {
+ "name": "Install local",
+ "icon": "icon-add",
+ "view": "views/packager/views/install-local.html"
+ }
+ ];
- $timeout(function () {
- navigationService.syncTree({ tree: "packager", path: "-1" });
- });
+ $timeout(function () {
+ navigationService.syncTree({ tree: "packager", path: "-1" });
+ });
+ }
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js
index 5c1bf8584c..c68b31038f 100644
--- a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js
@@ -1,7 +1,7 @@
(function () {
"use strict";
- function PackagesInstallLocalController($scope, $route, $location, Upload, umbRequestHelper, packageResource, $cookieStore, versionHelper) {
+ function PackagesInstallLocalController($scope, $route, $location, Upload, umbRequestHelper, packageResource, $cookieStore, $timeout) {
var vm = this;
vm.state = "upload";
@@ -57,30 +57,7 @@
// set done status on file
vm.zipFile.uploadStatus = "done";
loadPackage();
-
vm.localPackage = data;
- vm.localPackage.allowed = true;
-
- //now we need to determine if this package is compatible to be installed
- if (vm.localPackage.umbracoVersion) {
- //0 if the versions are equal
- //a negative integer iff v1 < v2
- //a positive integer iff v1 > v2
-
- //ensure we aren't comparing the pre-release value
- var versionNumber = Umbraco.Sys.ServerVariables.application.version.split("-")[0];
-
- var compare = versionHelper.versionCompare(
- versionNumber,
- vm.localPackage.umbracoVersion);
- if (compare < 0) {
- //this is not compatible!
- vm.localPackage.allowed = false;
- vm.installState.status =
- "This package cannot be installed, it requires a minimum Umbraco version of " +
- vm.localPackage.umbracoVersion;
- }
- }
}
}).error(function (evt, status, headers, config) {
@@ -123,6 +100,16 @@
//TODO: If any of these fail, will they keep calling the next one?
packageResource
.installFiles(vm.localPackage)
+ .then(function(pack) {
+ vm.installState.status = "Importing...";
+ return packageResource.import(pack);
+ },
+ installError)
+ .then(function(pack) {
+ vm.installState.status = "Installing...";
+ return packageResource.installFiles(pack);
+ },
+ installError)
.then(function(pack) {
vm.installState.status = "Restarting, please wait...";
return packageResource.installData(pack);
@@ -133,17 +120,20 @@
return packageResource.cleanUp(pack);
},
installError)
- .then(function (result) {
+ .then(function(result) {
- if (result.postInstallationPath) {
- window.location.href = url;
- }
- else {
- var url = window.location.href + "?installed=" + vm.localPackage.packageGuid;
- window.location.reload(true);
- }
+ if (result.postInstallationPath) {
+ //Put the redirect Uri in a cookie so we can use after reloading
+ window.localStorage.setItem("packageInstallUri", result.postInstallationPath);
+ }
+ //reload on next digest (after cookie)
+ $timeout(function() {
+ window.location.reload(true);
+ });
- }, installError);
+
+ },
+ installError);
}
function installError() {
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.html b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.html
index 75a8101ace..4667af2d8f 100644
--- a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.html
+++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.html
@@ -73,7 +73,7 @@
Version
- {{ vm.package.version }}
+ {{ vm.localPackage.version }}
@@ -84,10 +84,10 @@
Read me
- {{ vm.localPackage.readme }}
+
-
+
-
-
+
{{vm.installState.status}}
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.controller.js
index f632d69e62..e87a4a2426 100644
--- a/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.controller.js
@@ -1,26 +1,30 @@
(function () {
"use strict";
- function PackagesRepoController($scope, $route, $location, $timeout, ourPackageRepositoryResource, $q) {
+ function PackagesRepoController($scope, $route, $location, $timeout, ourPackageRepositoryResource, $q, packageResource, $cookieStore) {
var vm = this;
vm.packageViewState = "packageList";
vm.categories = [];
- vm.loading = false;
+ vm.loading = true;
vm.pagination = {
pageNumber: 1,
totalPages: 10,
- pageSize: 2
+ pageSize: 8
};
vm.searchQuery = "";
-
+ vm.installState = {
+ status: ""
+ };
vm.selectCategory = selectCategory;
vm.showPackageDetails = showPackageDetails;
vm.setPackageViewState = setPackageViewState;
vm.nextPage = nextPage;
vm.prevPage = prevPage;
vm.goToPage = goToPage;
+ vm.installPackage = installPackage;
+ vm.downloadPackage = downloadPackage;
//used to cancel any request in progress if another one needs to take it's place
var canceler = null;
@@ -91,10 +95,7 @@
canceler = null;
});
}
- }
- else {
- vm.loading = false;
- }
+ }
});
}, 200));
@@ -175,6 +176,61 @@
});
}
+ function downloadPackage(selectedPackage) {
+ vm.loading = true;
+
+ packageResource
+ .fetch(selectedPackage.id)
+ .then(function(pack) {
+ vm.packageViewState = "packageInstall";
+ vm.loading = false;
+ vm.localPackage = pack;
+ vm.localPackage.allowed = true;
+ },
+ error);
+ }
+
+ function error(e, args) {
+
+ }
+
+ function installPackage(selectedPackage) {
+
+ vm.installState.status = "importing...";
+
+ packageResource
+ .import(selectedPackage)
+ .then(function(pack) {
+ vm.installState.status = "Installing...";
+ return packageResource.installFiles(pack);
+ },
+ error)
+ .then(function(pack) {
+ vm.installState.status = "Restarting, please wait...";
+ return packageResource.installData(pack);
+ },
+ error)
+ .then(function(pack) {
+ vm.installState.status = "All done, your browser will now refresh";
+ return packageResource.cleanUp(pack);
+ },
+ error)
+ .then(function(result) {
+
+ if (result.postInstallationPath) {
+ //Put the redirect Uri in a cookie so we can use after reloading
+ window.localStorage.setItem("packageInstallUri", result.postInstallationPath);
+ }
+
+ //reload on next digest (after cookie)
+ $timeout(function () {
+ window.location.reload(true);
+ });
+
+ },
+ error);
+ }
+
init();
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.html b/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.html
index 7a0abd6dc5..d42e955b4f 100644
--- a/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.html
+++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/repo.html
@@ -7,7 +7,7 @@
@@ -131,13 +131,13 @@
diff --git a/src/Umbraco.Web/Editors/PackageInstallController.cs b/src/Umbraco.Web/Editors/PackageInstallController.cs
index b8ffbe3572..41f183eb8c 100644
--- a/src/Umbraco.Web/Editors/PackageInstallController.cs
+++ b/src/Umbraco.Web/Editors/PackageInstallController.cs
@@ -218,10 +218,52 @@ namespace Umbraco.Web.Editors
Version = pack.Version,
Url = pack.Url,
License = pack.License,
- LicenseUrl = pack.LicenseUrl
+ LicenseUrl = pack.LicenseUrl,
+ Files = pack.Files
}).ToList();
}
+ private void PopulateFromPackageData(LocalPackageInstallModel model)
+ {
+ var ins = new global::umbraco.cms.businesslogic.packager.Installer(Security.CurrentUser.Id);
+ //this will load in all the metadata too
+ var tempDir = ins.Import(model.ZipFilePath, false);
+
+ model.TemporaryDirectoryPath = Path.Combine(SystemDirectories.Data, tempDir);
+ model.Name = ins.Name;
+ model.Author = ins.Author;
+ model.AuthorUrl = ins.AuthorUrl;
+ model.License = ins.License;
+ model.LicenseUrl = ins.LicenseUrl;
+ model.ReadMe = ins.ReadMe;
+ model.ConflictingMacroAliases = ins.ConflictingMacroAliases;
+ model.ConflictingStyleSheetNames = ins.ConflictingStyleSheetNames;
+ model.ConflictingTemplateAliases = ins.ConflictingTemplateAliases;
+ model.ContainsBinaryFileErrors = ins.ContainsBinaryFileErrors;
+ model.ContainsLegacyPropertyEditors = ins.ContainsLegacyPropertyEditors;
+ model.ContainsMacroConflict = ins.ContainsMacroConflict;
+ model.ContainsStyleSheetConflicts = ins.ContainsStyleSheeConflicts;
+ model.ContainsTemplateConflicts = ins.ContainsTemplateConflicts;
+ model.ContainsUnsecureFiles = ins.ContainsUnsecureFiles;
+ model.Url = ins.Url;
+ model.Version = ins.Version;
+
+ model.UmbracoVersion = ins.RequirementsType == RequirementsType.Strict
+ ? string.Format("{0}.{1}.{2}", ins.RequirementsMajor, ins.RequirementsMinor, ins.RequirementsPatch)
+ : string.Empty;
+
+ //now we need to check for version comparison
+ model.IsCompatible = true;
+ if (ins.RequirementsType == RequirementsType.Strict)
+ {
+ var packageMinVersion = new System.Version(ins.RequirementsMajor, ins.RequirementsMinor, ins.RequirementsPatch);
+ if (UmbracoVersion.Current < packageMinVersion)
+ {
+ model.IsCompatible = false;
+ }
+ }
+ }
+
[HttpPost]
[FileUploadCleanupFilter(false)]
public async Task
UploadLocalPackage()
@@ -269,65 +311,14 @@ namespace Umbraco.Web.Editors
//the file name must be a GUID - this is what the packager expects (strange yes)
//because essentially this is creating a temporary package Id that will be used
//for unpacking/installing/etc...
- var packageTempFileName = model.PackageGuid + ".umb";
- var packageTempFileLocation = Path.Combine(packageTempDir, packageTempFileName);
+ model.ZipFilePath = model.PackageGuid + ".umb";
+ var packageTempFileLocation = Path.Combine(packageTempDir, model.ZipFilePath);
File.Copy(file.LocalFileName, packageTempFileLocation, true);
- try
- {
- var ins = new global::umbraco.cms.businesslogic.packager.Installer(Security.CurrentUser.Id);
- //this will load in all the metadata too
- var tempDir = ins.Import(packageTempFileName);
+ //Populate the model from the metadata in the package file (zip file)
+ PopulateFromPackageData(model);
- //now we need to check for version comparison
- if (ins.RequirementsType == RequirementsType.Strict)
- {
- var packageMinVersion = new System.Version(ins.RequirementsMajor, ins.RequirementsMinor, ins.RequirementsPatch);
- if (UmbracoVersion.Current < packageMinVersion)
- {
- throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("This package cannot be installed, it requires a minimum Umbraco version of " + packageMinVersion));
- }
- }
-
- model.TemporaryDirectoryPath = Path.Combine(SystemDirectories.Data, tempDir);
- model.Id = ins.CreateManifest(
- IOHelper.MapPath(model.TemporaryDirectoryPath),
- model.PackageGuid.ToString(),
- //TODO: Does this matter? we're installing a local package
- string.Empty);
-
- model.Name = ins.Name;
- model.Author = ins.Author;
- model.AuthorUrl = ins.AuthorUrl;
- model.License = ins.License;
- model.LicenseUrl = ins.LicenseUrl;
- model.ReadMe = ins.ReadMe;
- model.ConflictingMacroAliases = ins.ConflictingMacroAliases;
- model.ConflictingStyleSheetNames = ins.ConflictingStyleSheetNames;
- model.ConflictingTemplateAliases = ins.ConflictingTemplateAliases;
- model.ContainsBinaryFileErrors = ins.ContainsBinaryFileErrors;
- model.ContainsLegacyPropertyEditors = ins.ContainsLegacyPropertyEditors;
- model.ContainsMacroConflict = ins.ContainsMacroConflict;
- model.ContainsStyleSheetConflicts = ins.ContainsStyleSheeConflicts;
- model.ContainsTemplateConflicts = ins.ContainsTemplateConflicts;
- model.ContainsUnsecureFiles = ins.ContainsUnsecureFiles;
- model.Url = ins.Url;
- model.Version = ins.Version;
-
- model.UmbracoVersion = ins.RequirementsType == RequirementsType.Strict
- ? string.Format("{0}.{1}.{2}", ins.RequirementsMajor, ins.RequirementsMinor, ins.RequirementsPatch)
- : string.Empty;
-
- //TODO: We need to add the 'strict' requirement to the installer
- }
- finally
- {
- //Cleanup file
- if (File.Exists(packageTempFileLocation))
- {
- File.Delete(packageTempFileLocation);
- }
- }
+ //TODO: We need to add the 'strict' requirement to the installer
}
else
{
@@ -349,7 +340,7 @@ namespace Umbraco.Web.Editors
///
///
[HttpGet]
- public PackageInstallModel Fetch(string packageGuid)
+ public LocalPackageInstallModel Fetch(string packageGuid)
{
//Default path
string path = Path.Combine("packages", packageGuid + ".umb");
@@ -361,14 +352,18 @@ namespace Umbraco.Web.Editors
path = our.fetch(packageGuid, Security.CurrentUser.Id);
}
}
-
- var p = new PackageInstallModel();
- p.PackageGuid = Guid.Parse(packageGuid);
- p.RepositoryGuid = Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66");
- p.ZipFilePath = path;
- //p.ZipFilePath = Path.Combine("temp", "package.umb");
- return p;
+ var model = new LocalPackageInstallModel
+ {
+ PackageGuid = Guid.Parse(packageGuid),
+ RepositoryGuid = Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66"),
+ ZipFilePath = path
+ };
+
+ //Populate the model from the metadata in the package file (zip file)
+ PopulateFromPackageData(model);
+
+ return model;
}
///
@@ -380,7 +375,19 @@ namespace Umbraco.Web.Editors
public PackageInstallModel Import(PackageInstallModel model)
{
var ins = new global::umbraco.cms.businesslogic.packager.Installer(Security.CurrentUser.Id);
- model.TemporaryDirectoryPath = Path.Combine(SystemDirectories.Data, ins.Import(model.ZipFilePath));
+
+ var tempPath = ins.Import(model.ZipFilePath);
+ //now we need to check for version comparison
+ if (ins.RequirementsType == RequirementsType.Strict)
+ {
+ var packageMinVersion = new System.Version(ins.RequirementsMajor, ins.RequirementsMinor, ins.RequirementsPatch);
+ if (UmbracoVersion.Current < packageMinVersion)
+ {
+ throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("This package cannot be installed, it requires a minimum Umbraco version of " + packageMinVersion));
+ }
+ }
+
+ model.TemporaryDirectoryPath = Path.Combine(SystemDirectories.Data, tempPath);
model.Id = ins.CreateManifest( IOHelper.MapPath(model.TemporaryDirectoryPath), model.PackageGuid.ToString(), model.RepositoryGuid.ToString());
return model;
@@ -423,6 +430,7 @@ namespace Umbraco.Web.Editors
public PackageInstallResult CleanUp(PackageInstallModel model)
{
var ins = new global::umbraco.cms.businesslogic.packager.Installer(Security.CurrentUser.Id);
+ var tempDir = IOHelper.MapPath(model.TemporaryDirectoryPath);
ins.LoadConfig(IOHelper.MapPath(model.TemporaryDirectoryPath));
ins.InstallCleanUp(model.Id, IOHelper.MapPath(model.TemporaryDirectoryPath));
@@ -435,6 +443,20 @@ namespace Umbraco.Web.Editors
global::umbraco.BusinessLogic.Actions.Action.ReRegisterActionsAndHandlers();
+ var redirectUrl = "";
+ if (ins.Control.IsNullOrWhiteSpace())
+ {
+ redirectUrl = string.Format("/developer/framed/{0}",
+ Uri.EscapeDataString(
+ string.Format("/umbraco/developer/Packages/installer.aspx?installing=custominstaller&dir={0}&pId={1}&customUrl={2}", tempDir, model.Id, ins.Url)));
+ }
+ else
+ {
+ redirectUrl = string.Format("/developer/framed/{0}",
+ Uri.EscapeDataString(
+ string.Format("/umbraco/developer/Packages/installer.aspx?installing=custominstaller&dir={0}&pId={1}&customControl={2}&customUrl={3}", tempDir, model.Id, ins.Control, ins.Url)));
+ }
+
return new PackageInstallResult
{
Id = model.Id,
@@ -442,8 +464,9 @@ namespace Umbraco.Web.Editors
PackageGuid = model.PackageGuid,
RepositoryGuid = model.RepositoryGuid,
TemporaryDirectoryPath = model.TemporaryDirectoryPath,
-
+ PostInstallationPath = redirectUrl
};
+
}
diff --git a/src/Umbraco.Web/Models/LocalPackageInstallModel.cs b/src/Umbraco.Web/Models/LocalPackageInstallModel.cs
index 20cf359ae1..abb7c85cec 100644
--- a/src/Umbraco.Web/Models/LocalPackageInstallModel.cs
+++ b/src/Umbraco.Web/Models/LocalPackageInstallModel.cs
@@ -21,6 +21,12 @@ namespace Umbraco.Web.Models
[DataMember(Name = "notifications")]
public List Notifications { get; private set; }
+ ///
+ /// A flag to determine if this package is compatible to be installed
+ ///
+ [DataMember(Name = "isCompatible")]
+ public bool IsCompatible { get; set; }
+
///
/// The minimum umbraco version that this package is pinned to
///
diff --git a/src/Umbraco.Web/Models/PackageInstallResult.cs b/src/Umbraco.Web/Models/PackageInstallResult.cs
index bffc1240cf..bb76bc663b 100644
--- a/src/Umbraco.Web/Models/PackageInstallResult.cs
+++ b/src/Umbraco.Web/Models/PackageInstallResult.cs
@@ -9,6 +9,6 @@ namespace Umbraco.Web.Models
public class PackageInstallResult : PackageInstallModel
{
[DataMember(Name = "postInstallationPath")]
- public Guid PostInstallationPath { get; set; }
+ public string PostInstallationPath { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs
index 1e013da452..6c4eef7862 100644
--- a/src/Umbraco.Web/umbraco.presentation/content.cs
+++ b/src/Umbraco.Web/umbraco.presentation/content.cs
@@ -331,6 +331,9 @@ namespace umbraco
using (var safeXml = GetSafeXmlWriter(false))
{
+ //TODO: This can be null: safeXml.Xml!!!!
+
+
var node = safeXml.Xml.GetElementById(c.Id.ToString(CultureInfo.InvariantCulture));
if (node == null) return;
var attr = node.GetAttributeNode("sortOrder");
diff --git a/src/umbraco.cms/businesslogic/Packager/Installer.cs b/src/umbraco.cms/businesslogic/Packager/Installer.cs
index fc3da251fd..fc3c866327 100644
--- a/src/umbraco.cms/businesslogic/Packager/Installer.cs
+++ b/src/umbraco.cms/businesslogic/Packager/Installer.cs
@@ -178,24 +178,25 @@ namespace umbraco.cms.businesslogic.packager
///
/// Imports the specified package
///
- /// Filename of the umbracopackage
+ /// Filename of the umbracopackage
+ /// true if the input file should be deleted after import
///
- public string Import(string InputFile)
+ public string Import(string inputFile, bool deleteFile)
{
using (DisposableTimer.DebugDuration(
- () => "Importing package file " + InputFile,
- () => "Package file " + InputFile + "imported"))
+ () => "Importing package file " + inputFile,
+ () => "Package file " + inputFile + "imported"))
{
var tempDir = "";
- if (File.Exists(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile)))
+ if (File.Exists(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + inputFile)))
{
- var fi = new FileInfo(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile));
+ var fi = new FileInfo(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + inputFile));
// Check if the file is a valid package
if (fi.Extension.ToLower() == ".umb")
{
try
{
- tempDir = UnPack(fi.FullName);
+ tempDir = UnPack(fi.FullName, deleteFile);
LoadConfig(tempDir);
}
catch (Exception unpackE)
@@ -207,9 +208,20 @@ namespace umbraco.cms.businesslogic.packager
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) + "'");
+ throw new Exception("Error - file not found. Could find file named '" + IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + inputFile) + "'");
return tempDir;
}
+
+ }
+
+ ///
+ /// Imports the specified package
+ ///
+ /// Filename of the umbracopackage
+ ///
+ public string Import(string inputFile)
+ {
+ return Import(inputFile, true);
}
public int CreateManifest(string tempDir, string guid, string repoGuid)
@@ -713,7 +725,8 @@ namespace umbraco.cms.businesslogic.packager
return path + fileName;
return path + Path.DirectorySeparatorChar + fileName;
}
- private static string UnPack(string zipName)
+
+ private static string UnPack(string zipName, bool deleteFile)
{
// Unzip
@@ -762,7 +775,12 @@ namespace umbraco.cms.businesslogic.packager
// Clean up
s.Close();
- File.Delete(zipName);
+
+ if (deleteFile)
+ {
+ File.Delete(zipName);
+ }
+
return tempDir;