Пример #1
0
        private void InstallResources()
        {
            //Start Timer
            Upgrade.StartTimer();

            //Write out Header
            HtmlUtils.WriteHeader(Response, "installResources");

            Response.Write("<h2>Install Resources Status Report</h2>");
            Response.Flush();

            // install new resources(s)
            ResourceInstaller resourceInstaller = new ResourceInstaller();

            resourceInstaller.Install(true, 0);

            Response.Write("<h2>Installation Complete</h2>");
            Response.Flush();

            //Write out Footer
            HtmlUtils.WriteFooter(Response);
        }
Пример #2
0
        private void UpgradeApplication()
        {
            //Start Timer
            Upgrade.StartTimer();

            //Write out Header
            HtmlUtils.WriteHeader(Response, "upgrade");

            Response.Write("<h2>Current Assembly Version: " + Globals.glbAppVersion + "</h2>");
            Response.Flush();

            // get path to script files
            string providerPath = PortalSettings.GetProviderPath();

            if (!providerPath.StartsWith("ERROR:"))
            {
                // get current database version
                IDataReader dr = PortalSettings.GetDatabaseVersion();
                if (dr.Read())
                {
                    //Call Upgrade with the current DB Version to upgrade an
                    //existing DNN installation
                    int    majVersion         = Convert.ToInt32(dr["Major"]);
                    int    minVersion         = Convert.ToInt32(dr["Minor"]);
                    int    buildVersion       = Convert.ToInt32(dr["Build"]);
                    string strDatabaseVersion = String.Format(majVersion.ToString(), "00") + "." + String.Format(minVersion.ToString(), "00") + "." + String.Format(buildVersion.ToString(), "00");

                    Response.Write("<h2>Current Database Version: " + strDatabaseVersion + "</h2>");
                    Response.Flush();

                    string ignoreWarning = Null.NullString;
                    string strWarning    = Null.NullString;
                    if ((majVersion == 3 && minVersion < 3) || (majVersion == 4 && minVersion < 3))
                    {
                        //Users and profile have not been transferred

                        // Get the name of the data provider
                        ProviderConfiguration providerConfiguration = ProviderConfiguration.GetProviderConfiguration("data");

                        //Execute Special Script
                        Upgrade.ExecuteScript(providerPath + "Upgrade." + providerConfiguration.DefaultProvider);

                        if ((Request.QueryString["ignoreWarning"] != null))
                        {
                            ignoreWarning = Request.QueryString["ignoreWarning"].ToLower();
                        }

                        strWarning = Upgrade.CheckUpgrade();
                    }
                    else
                    {
                        ignoreWarning = "true";
                    }

                    //Check whether Upgrade is ok
                    if (strWarning == Null.NullString || ignoreWarning == "true")
                    {
                        Response.Write("<br><br>");
                        Response.Write("<h2>Upgrade Status Report</h2>");
                        Response.Flush();
                        Upgrade.UpgradeDNN(providerPath, strDatabaseVersion.Replace(".", ""));

                        //Install Resources
                        ResourceInstaller objResourceInstaller = new ResourceInstaller();
                        objResourceInstaller.Install(true, 0);

                        Response.Write("<h2>Upgrade Complete</h2>");
                        Response.Write("<br><br><h2><a href='../Default.aspx'>Click Here To Access Your Portal</a></h2><br><br>");
                    }
                    else
                    {
                        Response.Write("<h2>Warning:</h2>" + strWarning.Replace("\r\n", "<br />"));

                        Response.Write("<br><br><a href='Install.aspx?mode=Install&ignoreWarning=true'>Click Here To Proceed With The Upgrade.</a>");
                    }
                    Response.Flush();
                }
                dr.Close();
            }
            else
            {
                Response.Write("<h2>Upgrade Error: " + providerPath + "</h2>");
                Response.Flush();
            }

            //Write out Footer
            HtmlUtils.WriteFooter(Response);
        }