Пример #1
0
        internal void InstallStatus(bool isCompleted, string errorMsg)
        {
            try
            {
                var userAgent = _httpContext.Request.UserAgent;

                // Check for current install Id
                var installId = Guid.NewGuid();

                var installCookie = _httpContext.Request.GetCookieValue(Constants.Web.InstallerCookieName);
                if (string.IsNullOrEmpty(installCookie) == false)
                {
                    if (Guid.TryParse(installCookie, out installId))
                    {
                        // check that it's a valid Guid
                        if (installId == Guid.Empty)
                        {
                            installId = Guid.NewGuid();
                        }
                    }
                }
                _httpContext.Response.Cookies.Set(new HttpCookie(Constants.Web.InstallerCookieName, "1"));

                var dbProvider = string.Empty;
                if (IsBrandNewInstall == false)
                {
                    // we don't have DatabaseProvider anymore... doing it differently
                    //dbProvider = ApplicationContext.Current.DatabaseContext.DatabaseProvider.ToString();
                    dbProvider = GetDbProviderString(Current.SqlContext);
                }

                var check = new org.umbraco.update.CheckForUpgrade();
                check.Install(installId,
                              IsBrandNewInstall == false,
                              isCompleted,
                              DateTime.Now,
                              UmbracoVersion.Current.Major,
                              UmbracoVersion.Current.Minor,
                              UmbracoVersion.Current.Build,
                              UmbracoVersion.Comment,
                              errorMsg,
                              userAgent,
                              dbProvider);
            }
            catch (Exception ex)
            {
                _logger.Error <InstallHelper>(ex, "An error occurred in InstallStatus trying to check upgrades");
            }
        }
Пример #2
0
        internal void InstallStatus(bool isCompleted, string errorMsg)
        {
            try
            {
                string userAgent = _umbContext.HttpContext.Request.UserAgent;

                // Check for current install Id
                var installId     = Guid.NewGuid();
                var installCookie = new StateHelper.Cookies.Cookie("umb_installId", 1);
                if (string.IsNullOrEmpty(installCookie.GetValue()) == false)
                {
                    if (Guid.TryParse(installCookie.GetValue(), out installId))
                    {
                        // check that it's a valid Guid
                        if (installId == Guid.Empty)
                        {
                            installId = Guid.NewGuid();
                        }
                    }
                }
                installCookie.SetValue(installId.ToString());

                string dbProvider = string.Empty;
                if (IsBrandNewInstall == false)
                {
                    dbProvider = ApplicationContext.Current.DatabaseContext.DatabaseProvider.ToString();
                }

                org.umbraco.update.CheckForUpgrade check = new org.umbraco.update.CheckForUpgrade();
                check.Install(installId,
                              IsBrandNewInstall == false,
                              isCompleted,
                              DateTime.Now,
                              UmbracoVersion.Current.Major,
                              UmbracoVersion.Current.Minor,
                              UmbracoVersion.Current.Build,
                              UmbracoVersion.CurrentComment,
                              errorMsg,
                              userAgent,
                              dbProvider);
            }
            catch (Exception ex)
            {
                LogHelper.Error <InstallHelper>("An error occurred in InstallStatus trying to check upgrades", ex);
            }
        }