public HttpResponseMessage DownloadPackageFiles(InstallPackageModel model)
        {
            var repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);

            if (repo == null)
            {
                return(Json(
                           new { success = false, error = "No repository found with id " + RepoGuid },
                           HttpStatusCode.OK));
            }
            if (repo.HasConnection() == false)
            {
                return(Json(
                           new { success = false, error = "cannot_connect" },
                           HttpStatusCode.OK));
            }
            var installer = new global::umbraco.cms.businesslogic.packager.Installer(UmbracoContext.Current.Security.CurrentUser.Id);

            var tempFile = installer.Import(repo.fetch(model.KitGuid.ToString(), UmbracoContext.Current.Security.CurrentUser.Id));

            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));
        }
		public JsonResult DownloadPackageFiles(Guid kitGuid)
		{
			var repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
            if (repo == null)
            {
                return Json(new { success = false, error = "No repository found with id " + RepoGuid });
            }
			if (!repo.HasConnection())
			{
				return Json(new {success = false, error = "cannot_connect"});
			}
			var installer = new global::umbraco.cms.businesslogic.packager.Installer();

			var tempFile = installer.Import(repo.fetch(kitGuid.ToString()));
			installer.LoadConfig(tempFile);
			var pId = installer.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);
			return Json(new
				{
					success = true,
					manifestId = pId,
					packageFile = tempFile,
					percentage = 10,
					message = "Downloading starter kit files..."
				});
		}
        public PackageInstallModel InstallData(PackageInstallModel model)
        {
            var ins = new global::umbraco.cms.businesslogic.packager.Installer(Security.CurrentUser.Id);

            ins.LoadConfig(IOHelper.MapPath(model.TemporaryDirectoryPath));
            ins.InstallBusinessLogic(model.Id, IOHelper.MapPath(model.TemporaryDirectoryPath));
            return(model);
        }
Esempio n. 4
0
        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));
            model.Id = ins.CreateManifest(IOHelper.MapPath(model.TemporaryDirectoryPath), model.PackageGuid.ToString(), model.RepositoryGuid.ToString());

            return(model);
        }
        public PackageInstallModel InstallFiles(PackageInstallModel model)
        {
            var ins = new global::umbraco.cms.businesslogic.packager.Installer(Security.CurrentUser.Id);

            ins.LoadConfig(IOHelper.MapPath(model.TemporaryDirectoryPath));
            ins.InstallFiles(model.Id, IOHelper.MapPath(model.TemporaryDirectoryPath));

            //set a restarting marker and reset the app pool
            ApplicationContext.RestartApplicationPool(Request.TryGetHttpContext().Result);

            model.IsRestarting = true;

            return(model);
        }
Esempio n. 6
0
        private bool InstallPackage()
        {
            //check if it's already installed
            //var allInstalled = InstalledPackage.GetAllInstalledPackages();

            //need to save the package manifest to a temp folder since that is how this package installer logic works
            var tempFile = Path.Combine(IOHelper.MapPath("~/App_Data/TEMP/Articulate"), Guid.NewGuid().ToString(), "package.xml");
            var tempDir  = Path.GetDirectoryName(tempFile);

            Directory.CreateDirectory(tempDir);

            try
            {
                System.IO.File.WriteAllText(tempFile, ArticulateResources.packageManifest);
                var ins = new global::umbraco.cms.businesslogic.packager.Installer(_userId);

                ins.LoadConfig(tempDir);

                int  packageId;
                bool sameVersion;
                if (IsPackageVersionAlreadyInstalled(ins.Name, ins.Version, out sameVersion, out packageId))
                {
                    //if it's the same version, we don't need to install anything
                    if (!sameVersion)
                    {
                        var pckId = ins.CreateManifest(tempDir, Guid.NewGuid().ToString(), "65194810-1f85-11dd-bd0b-0800200c9a66");
                        ins.InstallBusinessLogic(pckId, tempDir);
                        return(true);
                    }
                    return(false);
                }
                else
                {
                    var pckId = ins.CreateManifest(tempDir, Guid.NewGuid().ToString(), "65194810-1f85-11dd-bd0b-0800200c9a66");
                    ins.InstallBusinessLogic(pckId, tempDir);
                    return(true);
                }
            }
            finally
            {
                if (System.IO.File.Exists(tempFile))
                {
                    System.IO.File.Delete(tempFile);
                }
                if (System.IO.Directory.Exists(tempDir))
                {
                    System.IO.Directory.Delete(tempDir, true);
                }
            }
        }
		public JsonResult InstallPackageFiles(Guid kitGuid, int manifestId, string packageFile)
		{
			packageFile = Server.UrlDecode(packageFile);
			var installer = new global::umbraco.cms.businesslogic.packager.Installer();
			installer.LoadConfig(packageFile);
			installer.InstallFiles(manifestId, packageFile);
			return Json(new
				{
					success = true,
					manifestId,
					packageFile,
					percentage = 20,
					message = "Installing starter kit files"
				});
		}
        public JsonResult InstallPackageFiles(Guid kitGuid, int manifestId, string packageFile)
        {
            packageFile = Server.UrlDecode(packageFile);
            var installer = new global::umbraco.cms.businesslogic.packager.Installer();

            installer.LoadConfig(packageFile);
            installer.InstallFiles(manifestId, packageFile);
            return(Json(new
            {
                success = true,
                manifestId,
                packageFile,
                percentage = 20,
                message = "Installing starter kit files"
            }));
        }
        public HttpResponseMessage InstallPackageFiles(InstallPackageModel model)
        {
            model.PackageFile = HttpUtility.UrlDecode(model.PackageFile);
            var installer = new global::umbraco.cms.businesslogic.packager.Installer(UmbracoContext.Current.Security.CurrentUser.Id);

            installer.LoadConfig(model.PackageFile);
            installer.InstallFiles(model.ManifestId, model.PackageFile);
            return(Json(new
            {
                success = true,
                model.ManifestId,
                model.PackageFile,
                percentage = 20,
                message = "Installing starter kit files"
            }, HttpStatusCode.OK));
        }
Esempio n. 10
0
        public PackageInstallModel CleanUp(PackageInstallModel model)
        {
            var ins = new global::umbraco.cms.businesslogic.packager.Installer(Security.CurrentUser.Id);

            ins.LoadConfig(IOHelper.MapPath(model.TemporaryDirectoryPath));
            ins.InstallCleanUp(model.Id, IOHelper.MapPath(model.TemporaryDirectoryPath));

            var clientDependencyConfig  = new Umbraco.Core.Configuration.ClientDependencyConfiguration(ApplicationContext.ProfilingLogger.Logger);
            var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber();

            //clear the tree cache - we'll do this here even though the browser will reload, but just in case it doesn't can't hurt.
            //these bits are super old, but cant find another way to do this currently
            global::umbraco.cms.presentation.Trees.TreeDefinitionCollection.Instance.ReRegisterTrees();
            global::umbraco.BusinessLogic.Actions.Action.ReRegisterActionsAndHandlers();


            return(model);
        }
        public HttpResponseMessage CleanupInstallation(InstallPackageModel model)
        {
            model.PackageFile = HttpUtility.UrlDecode(model.PackageFile);
            var installer = new global::umbraco.cms.businesslogic.packager.Installer(UmbracoContext.Current.Security.CurrentUser.Id);

            installer.LoadConfig(model.PackageFile);
            installer.InstallCleanUp(model.ManifestId, model.PackageFile);

            library.RefreshContent();

            return(Json(new
            {
                success = true,
                model.ManifestId,
                model.PackageFile,
                percentage = 100,
                message = "Starter kit has been installed"
            }, HttpStatusCode.OK));
        }
Esempio n. 12
0
        public JsonResult CleanupInstallation(Guid kitGuid, int manifestId, string packageFile)
        {
            packageFile = Server.UrlDecode(packageFile);
            var installer = new global::umbraco.cms.businesslogic.packager.Installer();

            installer.LoadConfig(packageFile);
            installer.InstallCleanUp(manifestId, packageFile);

            library.RefreshContent();

            return(Json(new
            {
                success = true,
                manifestId,
                packageFile,
                percentage = 100,
                message = "Starter kit has been installed"
            }));
        }
        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.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.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;
                }
            }
        }
        public PackageInstallModel Import(PackageInstallModel model)
        {
            var ins = new global::umbraco.cms.businesslogic.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);
        }
Esempio n. 15
0
        public HttpResponseMessage DownloadPackageFiles(InstallPackageModel model)
        {
            var packageFile = _applicationContext.Services.PackagingService.FetchPackageFile(
                model.KitGuid,
                UmbracoVersion.Current,
                UmbracoContext.Current.Security.CurrentUser.Id);

            var installer = new global::umbraco.cms.businesslogic.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));
        }
Esempio n. 16
0
        public JsonResult DownloadPackageFiles(Guid kitGuid)
        {
            var repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);

            if (!repo.HasConnection())
            {
                return(Json(new { success = false, error = "cannot_connect" }));
            }
            var installer = new global::umbraco.cms.businesslogic.packager.Installer();

            var tempFile = installer.Import(repo.fetch(kitGuid.ToString()));

            installer.LoadConfig(tempFile);
            var pId = installer.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);

            return(Json(new
            {
                success = true,
                manifestId = pId,
                packageFile = tempFile,
                percentage = 10,
                message = "Downloading starter kit files..."
            }));
        }
        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));

            var clientDependencyConfig  = new Umbraco.Core.Configuration.ClientDependencyConfiguration(ApplicationContext.ProfilingLogger.Logger);
            var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber();

            //clear the tree cache - we'll do this here even though the browser will reload, but just in case it doesn't can't hurt.
            //these bits are super old, but cant find another way to do this currently
            global::umbraco.cms.presentation.Trees.TreeDefinitionCollection.Instance.ReRegisterTrees();
            global::umbraco.BusinessLogic.Actions.Action.ReRegisterActionsAndHandlers();


            var redirectUrl = "";

            if (ins.Control.IsNullOrWhiteSpace() == false)
            {
                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,
                ZipFilePath = model.ZipFilePath,
                PackageGuid = model.PackageGuid,
                RepositoryGuid = model.RepositoryGuid,
                TemporaryDirectoryPath = model.TemporaryDirectoryPath,
                PostInstallationPath = redirectUrl
            });
        }
		protected void SelectStarterKitDesign(object sender, EventArgs e)
		{
            InstallHelper.ClearProgress();

			var kitGuid = new Guid(((LinkButton)sender).CommandArgument);

            if (!global::umbraco.cms.businesslogic.skinning.Skinning.IsSkinInstalled(kitGuid))
			{

				InstallHelper.SetProgress(5, "Fetching starting kit from the repository", "");

                var installer = new global::umbraco.cms.businesslogic.packager.Installer();

				if (_repo.HasConnection())
				{
                    var p = new global::umbraco.cms.businesslogic.packager.Installer();

                    InstallHelper.SetProgress(15, "Connected to repository", "");

					string tempFile = p.Import(_repo.fetch(kitGuid.ToString()));
					p.LoadConfig(tempFile);
					int pID = p.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);

                    InstallHelper.SetProgress(30, "Installing skin files", "");
					p.InstallFiles(pID, tempFile);

                    InstallHelper.SetProgress(50, "Installing skin system objects", "");
					p.InstallBusinessLogic(pID, tempFile);

                    InstallHelper.SetProgress(60, "Finishing skin installation", "");
					p.InstallCleanUp(pID, tempFile);

					library.RefreshContent();

                    InstallHelper.SetProgress(80, "Activating skin", "");
                    if (global::umbraco.cms.businesslogic.skinning.Skinning.GetAllSkins().Count > 0)
					{
                        global::umbraco.cms.businesslogic.skinning.Skinning.ActivateAsCurrentSkin(
                            global::umbraco.cms.businesslogic.skinning.Skinning.GetAllSkins()[0]);
					}


                    InstallHelper.SetProgress(100, "Skin installation has been completed", "");

					try
					{


						if (string.IsNullOrEmpty(GlobalSettings.ConfigurationStatus))
						{
                            GlobalSettings.ConfigurationStatus = UmbracoVersion.Current.ToString(3);
							Application["umbracoNeedConfiguration"] = false;
						}
					}
					catch
					{

					}

					try
					{
						InstallHelper.RedirectToNextStep(Page, GetCurrentStep());
					}
					catch
					{
						OnStarterKitDesignInstalled();
					}
				}
				else
				{
					ShowConnectionError();
				}

			}
		}
        protected void SelectStarterKitDesign(object sender, EventArgs e)
        {
            InstallHelper.ClearProgress();

            var kitGuid = new Guid(((LinkButton)sender).CommandArgument);

            if (!global::umbraco.cms.businesslogic.skinning.Skinning.IsSkinInstalled(kitGuid))
            {
                InstallHelper.SetProgress(5, "Fetching starting kit from the repository", "");

                var installer = new global::umbraco.cms.businesslogic.packager.Installer();

                if (_repo.HasConnection())
                {
                    var p = new global::umbraco.cms.businesslogic.packager.Installer();

                    InstallHelper.SetProgress(15, "Connected to repository", "");

                    string tempFile = p.Import(_repo.fetch(kitGuid.ToString()));
                    p.LoadConfig(tempFile);
                    int pID = p.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);

                    InstallHelper.SetProgress(30, "Installing skin files", "");
                    p.InstallFiles(pID, tempFile);

                    InstallHelper.SetProgress(50, "Installing skin system objects", "");
                    p.InstallBusinessLogic(pID, tempFile);

                    InstallHelper.SetProgress(60, "Finishing skin installation", "");
                    p.InstallCleanUp(pID, tempFile);

                    library.RefreshContent();

                    InstallHelper.SetProgress(80, "Activating skin", "");
                    if (global::umbraco.cms.businesslogic.skinning.Skinning.GetAllSkins().Count > 0)
                    {
                        global::umbraco.cms.businesslogic.skinning.Skinning.ActivateAsCurrentSkin(
                            global::umbraco.cms.businesslogic.skinning.Skinning.GetAllSkins()[0]);
                    }


                    InstallHelper.SetProgress(100, "Skin installation has been completed", "");

                    try
                    {
                        if (string.IsNullOrEmpty(GlobalSettings.ConfigurationStatus))
                        {
                            GlobalSettings.ConfigurationStatus      = UmbracoVersion.Current.ToString(3);
                            Application["umbracoNeedConfiguration"] = false;
                        }
                    }
                    catch
                    {
                    }

                    try
                    {
                        InstallHelper.RedirectToNextStep(Page, GetCurrentStep());
                    }
                    catch
                    {
                        OnStarterKitDesignInstalled();
                    }
                }
                else
                {
                    ShowConnectionError();
                }
            }
        }
		public JsonResult CleanupInstallation(Guid kitGuid, int manifestId, string packageFile)
		{
			packageFile = Server.UrlDecode(packageFile);
			var installer = new global::umbraco.cms.businesslogic.packager.Installer();
			installer.LoadConfig(packageFile);
			installer.InstallCleanUp(manifestId, packageFile);

			library.RefreshContent();

			return Json(new
			{
				success = true,
				manifestId,
				packageFile,
				percentage = 100,
				message = "Starter kit has been installed"
			});
		}