private void PopulateFromPackageData(LocalPackageInstallModel model) { var ins = new global::Umbraco.Web._Legacy.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.IconUrl = ins.IconUrl; 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.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; } } }
public PackageInstallModel Import(PackageInstallModel model) { var ins = new global::Umbraco.Web._Legacy.Packager.Installer(Security.CurrentUser.Id); 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( Services.TextService.Localize("packager/targetVersionMismatch", new[] { packageMinVersion.ToString() }))); } } model.TemporaryDirectoryPath = Path.Combine(SystemDirectories.Data, tempPath); model.Id = ins.CreateManifest(IOHelper.MapPath(model.TemporaryDirectoryPath), model.PackageGuid.ToString(), model.RepositoryGuid.ToString()); return(model); }
public HttpResponseMessage DownloadPackageFiles(InstallPackageModel model) { var packageFile = Current.Services.PackagingService.FetchPackageFile( model.KitGuid, UmbracoVersion.Current, UmbracoContext.Current.Security.CurrentUser.Id); var installer = new global::Umbraco.Web._Legacy.Packager.Installer(UmbracoContext.Current.Security.CurrentUser.Id); var tempFile = installer.Import(packageFile); installer.LoadConfig(tempFile); var pId = installer.CreateManifest(tempFile, model.KitGuid.ToString(), RepoGuid); return(Json(new { success = true, manifestId = pId, packageFile = tempFile, percentage = 10, message = "Downloading starter kit files..." }, HttpStatusCode.OK)); }