示例#1
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 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"
            }));
        }
        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));
        }
        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
            });
        }
		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"
			});
		}
		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();
                }
            }
        }