Пример #1
0
        private void NoUpgrade()
        {
            // get path to script files
            string strProviderPath = PortalSettings.GetProviderPath();

            if (!strProviderPath.StartsWith("ERROR:"))
            {
                // get current database version
                try
                {
                    IDataReader dr = PortalSettings.GetDatabaseVersion();
                    if (dr.Read())
                    {
                        //Write out Header
                        HtmlUtils.WriteHeader(Response, "none");
                        Response.Write("<h2>Current Assembly Version: " + Globals.glbAppVersion + "</h2>");

                        //Call Upgrade with the current DB Version to upgrade an
                        //existing DNN installation
                        string strDatabaseVersion = String.Format((string)dr["Major"], "00") + "." + String.Format((string)dr["Minor"], "00") + "." + String.Format((string)dr["Build"], "00");

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

                        Response.Write("<br><br><a href='Install.aspx?mode=Install'>Click Here To Upgrade DotNetNuke</a>");
                        Response.Flush();
                    }
                    else
                    {
                        //Write out Header
                        HtmlUtils.WriteHeader(Response, "noDBVersion");
                        Response.Write("<h2>Current Assembly Version: " + Globals.glbAppVersion + "</h2>");

                        Response.Write("<h2>Current Database Version: N/A</h2>");
                        Response.Write("<br><br><h2><a href='Install.aspx?mode=Install'>Click Here To Install DotNetNuke</a></h2>");
                        Response.Flush();
                    }
                    dr.Close();
                }
                catch (Exception ex)
                {
                    //Write out Header
                    HtmlUtils.WriteHeader(Response, "error");
                    Response.Write("<h2>Current Assembly Version: " + Globals.glbAppVersion + "</h2>");

                    Response.Write("<h2>" + ex.Message + "</h2>");
                    Response.Flush();
                }
            }
            else
            {
                //Write out Header
                HtmlUtils.WriteHeader(Response, "error");
                Response.Write("<h2>Current Assembly Version: " + Globals.glbAppVersion + "</h2>");

                Response.Write("<h2>" + strProviderPath + "</h2>");
                Response.Flush();
            }
            //Write out Footer
            HtmlUtils.WriteFooter(Response);
        }
Пример #2
0
        /// <summary>
        /// cmdUpgrade_Click runs when the Upgrade Log Go button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	9/27/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdUpgrade_Click(object sender, EventArgs e)
        {
            try
            {
                // get path to provider
                string strProviderPath = PortalSettings.GetProviderPath();

                if (File.Exists(strProviderPath + cboUpgrade.SelectedItem.Text + ".log"))
                {
                    StreamReader objStreamReader;
                    objStreamReader = File.OpenText(strProviderPath + cboUpgrade.SelectedItem.Text + ".log");
                    lblUpgrade.Text = objStreamReader.ReadToEnd().Replace("\n", "<br>");
                    objStreamReader.Close();
                }
                else
                {
                    lblUpgrade.Text = Localization.GetString("ScriptFailure", this.LocalResourceFile);
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #3
0
        private void ExecuteScripts()
        {
            //Start Timer
            Upgrade.StartTimer();

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

            Response.Write("<h2>Execute Scripts Status Report</h2>");
            Response.Flush();

            string strProviderPath = PortalSettings.GetProviderPath();

            if (!strProviderPath.StartsWith("ERROR:"))
            {
                Upgrade.ExecuteScripts(strProviderPath);
            }

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

            //Write out Footer
            HtmlUtils.WriteFooter(Response);
        }
Пример #4
0
        /// <summary>
        /// BindData fetches the data from the database and updates the controls
        /// </summary>
        /// <history>
        ///     [cnurse]	9/27/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        private void BindData()
        {
            lblVersion.Text = Globals.glbAppVersion;
            switch (Convert.ToString(Globals.HostSettings["CheckUpgrade"]))
            {
            case "":
                chkUpgrade.Checked = true;
                break;

            case "Y":

                chkUpgrade.Checked = true;
                break;

            case "N":

                chkUpgrade.Checked = false;
                break;
            }
            if (chkUpgrade.Checked)
            {
                hypUpgrade.ImageUrl    = string.Format("{0}/update.aspx?version={1}", Globals.glbUpgradeUrl, lblVersion.Text.Replace(".", ""));
                hypUpgrade.NavigateUrl = string.Format("{0}/redirect.aspx?version={1}", Globals.glbUpgradeUrl, lblVersion.Text.Replace(".", ""));
            }
            else
            {
                hypUpgrade.Visible = false;
            }
            lblDataProvider.Text = ProviderConfiguration.GetProviderConfiguration("data").DefaultProvider;
            lblFramework.Text    = Environment.Version.ToString();
            lblIdentity.Text     = WindowsIdentity.GetCurrent().Name;
            lblHostName.Text     = Dns.GetHostName();

            PortalController objPortals = new PortalController();

            cboHostPortal.DataSource = objPortals.GetPortals();
            cboHostPortal.DataBind();
            if (Convert.ToString(Globals.HostSettings["HostPortalId"]) != "")
            {
                if (cboHostPortal.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostPortalId"])) != null)
                {
                    cboHostPortal.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostPortalId"])).Selected = true;
                }
            }
            txtHostTitle.Text = Convert.ToString(Globals.HostSettings["HostTitle"]);
            txtHostURL.Text   = Convert.ToString(Globals.HostSettings["HostURL"]);
            txtHostEmail.Text = Convert.ToString(Globals.HostSettings["HostEmail"]);

            //SkinController objSkins = new SkinController();
            SkinInfo objSkin;

            ctlHostSkin.Width    = "252px";
            ctlHostSkin.SkinRoot = SkinInfo.RootSkin;
            objSkin = SkinController.GetSkin(SkinInfo.RootSkin, Null.NullInteger, SkinType.Portal);
            if (objSkin != null)
            {
                if (Null.IsNull(objSkin.PortalId))
                {
                    ctlHostSkin.SkinSrc = objSkin.SkinSrc;
                }
            }
            ctlHostContainer.Width    = "252px";
            ctlHostContainer.SkinRoot = SkinInfo.RootContainer;
            objSkin = SkinController.GetSkin(SkinInfo.RootContainer, Null.NullInteger, SkinType.Portal);
            if (objSkin != null)
            {
                if (Null.IsNull(objSkin.PortalId))
                {
                    ctlHostContainer.SkinSrc = objSkin.SkinSrc;
                }
            }

            ctlAdminSkin.Width    = "252px";
            ctlAdminSkin.SkinRoot = SkinInfo.RootSkin;
            objSkin = SkinController.GetSkin(SkinInfo.RootSkin, Null.NullInteger, SkinType.Admin);
            if (objSkin != null)
            {
                if (Null.IsNull(objSkin.PortalId))
                {
                    ctlAdminSkin.SkinSrc = objSkin.SkinSrc;
                }
            }
            ctlAdminContainer.Width    = "252px";
            ctlAdminContainer.SkinRoot = SkinInfo.RootContainer;
            objSkin = SkinController.GetSkin(SkinInfo.RootContainer, Null.NullInteger, SkinType.Admin);
            if (objSkin != null)
            {
                if (Null.IsNull(objSkin.PortalId))
                {
                    ctlAdminContainer.SkinSrc = objSkin.SkinSrc;
                }
            }
            ModuleControlController objModuleControls = new ModuleControlController();
            ArrayList arrModuleControls = objModuleControls.GetModuleControls(Null.NullInteger);
            int       intModuleControl;

            for (intModuleControl = 0; intModuleControl <= arrModuleControls.Count - 1; intModuleControl++)
            {
                ModuleControlInfo objModuleControl = (ModuleControlInfo)arrModuleControls[intModuleControl];
                if (objModuleControl.ControlType == SecurityAccessLevel.ControlPanel)
                {
                    cboControlPanel.Items.Add(new ListItem(objModuleControl.ControlKey.Replace("CONTROLPANEL:", ""), objModuleControl.ControlSrc));
                }
            }
            if (Convert.ToString(Globals.HostSettings["ControlPanel"]) != "")
            {
                if (cboControlPanel.Items.FindByValue(Convert.ToString(Globals.HostSettings["ControlPanel"])) != null)
                {
                    cboControlPanel.Items.FindByValue(Convert.ToString(Globals.HostSettings["ControlPanel"])).Selected = true;
                }
            }
            else
            {
                if (cboControlPanel.Items.FindByValue(Globals.glbDefaultControlPanel) != null)
                {
                    cboControlPanel.Items.FindByValue(Globals.glbDefaultControlPanel).Selected = true;
                }
            }

            ListController          ctlList      = new ListController();
            ListEntryInfoCollection colProcessor = ctlList.GetListEntryInfoCollection("Processor", "");

            cboProcessor.DataSource = colProcessor;
            cboProcessor.DataBind();
            cboProcessor.Items.Insert(0, new ListItem("<" + Localization.GetString("None_Specified") + ">", ""));

            if (cboProcessor.Items.FindByText(Globals.HostSettings["PaymentProcessor"].ToString()) != null)
            {
                cboProcessor.Items.FindByText(Globals.HostSettings["PaymentProcessor"].ToString()).Selected = true;
            }
            txtUserId.Text = Convert.ToString(Globals.HostSettings["ProcessorUserId"]);
            txtPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["ProcessorPassword"]));

            txtHostFee.Text = Convert.ToString(Globals.HostSettings["HostFee"]);

            ListEntryInfoCollection colCurrency = ctlList.GetListEntryInfoCollection("Currency", "");

            cboHostCurrency.DataSource = colCurrency;
            cboHostCurrency.DataBind();
            if (cboHostCurrency.Items.FindByValue(Convert.ToString(Globals.HostSettings["HostCurrency"])) != null)
            {
                cboHostCurrency.Items.FindByValue(Globals.HostSettings["HostCurrency"].ToString()).Selected = true;
            }
            else
            {
                cboHostCurrency.Items.FindByValue("USD").Selected = true;
            }

            if (cboSchedulerMode.Items.FindByValue(Convert.ToString(Globals.HostSettings["SchedulerMode"])) != null)
            {
                cboSchedulerMode.Items.FindByValue(Globals.HostSettings["SchedulerMode"].ToString()).Selected = true;
            }
            else
            {
                cboSchedulerMode.Items.FindByValue("1").Selected = true;
            }

            txtHostSpace.Text = Convert.ToString(Globals.HostSettings["HostSpace"]);
            txtPageQuota.Text = Convert.ToString(Globals.HostSettings["PageQuota"]);
            txtUserQuota.Text = Convert.ToString(Globals.HostSettings["UserQuota"]);

            if (Convert.ToString(Globals.HostSettings["SiteLogStorage"]) == "")
            {
                optSiteLogStorage.Items.FindByValue("D").Selected = true;
            }
            else
            {
                optSiteLogStorage.Items.FindByValue(Convert.ToString(Globals.HostSettings["SiteLogStorage"])).Selected = true;
            }
            if (Convert.ToString(Globals.HostSettings["SiteLogBuffer"]) == "")
            {
                txtSiteLogBuffer.Text = "1";
            }
            else
            {
                txtSiteLogBuffer.Text = Convert.ToString(Globals.HostSettings["SiteLogBuffer"]);
            }
            txtSiteLogHistory.Text = Convert.ToString(Globals.HostSettings["SiteLogHistory"]);

            if (Convert.ToString(Globals.HostSettings["PageStatePersister"]) == "")
            {
                cboPageState.Items.FindByValue("P").Selected = true;
            }
            else
            {
                cboPageState.Items.FindByValue(Convert.ToString(Globals.HostSettings["PageStatePersister"])).Selected = true;
            }

            if (Convert.ToString(Globals.HostSettings["ModuleCaching"]) == "")
            {
                cboCacheMethod.Items.FindByValue("M").Selected = true;
            }
            else
            {
                cboCacheMethod.Items.FindByValue(Convert.ToString(Globals.HostSettings["ModuleCaching"])).Selected = true;
            }

            if (cboPerformance.Items.FindByValue(Convert.ToString(Globals.HostSettings["PerformanceSetting"])) != null)
            {
                cboPerformance.Items.FindByValue(Globals.HostSettings["PerformanceSetting"].ToString()).Selected = true;
            }
            else
            {
                cboPerformance.Items.FindByValue("3").Selected = true;
            }
            if (cboCacheability.Items.FindByValue(Convert.ToString(Globals.HostSettings["AuthenticatedCacheability"])) != null)
            {
                cboCacheability.Items.FindByValue(Globals.HostSettings["AuthenticatedCacheability"].ToString()).Selected = true;
            }
            else
            {
                cboCacheability.Items.FindByValue("4").Selected = true;
            }
            if (cboCompression.Items.FindByValue(Convert.ToString(Globals.HostSettings["HttpCompression"])) != null)
            {
                cboCompression.Items.FindByValue(Globals.HostSettings["HttpCompression"].ToString()).Selected = true;
            }
            else
            {
                cboCompression.Items.FindByValue("0").Selected = true;
            }
            if (cboLevel.Items.FindByValue(Convert.ToString(Globals.HostSettings["HttpCompressionLevel"])) != null)
            {
                cboLevel.Items.FindByValue(Globals.HostSettings["HttpCompressionLevel"].ToString()).Selected = true;
            }
            else
            {
                cboLevel.Items.FindByValue("0").Selected = true;
            }
            if (Convert.ToString(Globals.HostSettings["WhitespaceFilter"]) == "Y")
            {
                chkWhitespace.Checked = true;
            }
            else
            {
                chkWhitespace.Checked = false;
            }



            string filePath = Globals.ApplicationMapPath + "\\Compression.config";

            if (File.Exists(filePath))
            {
                FileStream    fileReader = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                XPathDocument doc        = new XPathDocument(fileReader);
                foreach (XPathNavigator nav in doc.CreateNavigator().Select("compression/excludedMimeTypes/mimeType"))
                {
                    txtExcludedMimeTypes.Text += nav.Value.ToLower() + Environment.NewLine;
                }
                foreach (XPathNavigator nav in doc.CreateNavigator().Select("compression/excludedPaths/path"))
                {
                    txtExcludedPaths.Text += nav.Value.ToLower() + Environment.NewLine;
                }
                txtWhitespaceFilter.Text = doc.CreateNavigator().SelectSingleNode("compression/whitespace").Value;
            }



            txtDemoPeriod.Text = Convert.ToString(Globals.HostSettings["DemoPeriod"]);
            if (Convert.ToString(Globals.HostSettings["DemoSignup"]) == "Y")
            {
                chkDemoSignup.Checked = true;
            }
            else
            {
                chkDemoSignup.Checked = false;
            }
            if (Globals.GetHashValue(Globals.HostSettings["Copyright"], "Y") == "Y")
            {
                chkCopyright.Checked = true;
            }
            else
            {
                chkCopyright.Checked = false;
            }
            if (Globals.HostSettings.ContainsKey("DisableUsersOnline"))
            {
                if (Globals.HostSettings["DisableUsersOnline"].ToString() == "Y")
                {
                    chkUsersOnline.Checked = true;
                }
                else
                {
                    chkUsersOnline.Checked = false;
                }
            }
            else
            {
                chkUsersOnline.Checked = false;
            }
            txtUsersOnlineTime.Text   = Convert.ToString(Globals.HostSettings["UsersOnlineTime"]);
            txtAutoAccountUnlock.Text = Convert.ToString(Globals.HostSettings["AutoAccountUnlockDuration"]);
            txtProxyServer.Text       = Convert.ToString(Globals.HostSettings["ProxyServer"]);
            txtProxyPort.Text         = Convert.ToString(Globals.HostSettings["ProxyPort"]);
            txtProxyUsername.Text     = Convert.ToString(Globals.HostSettings["ProxyUsername"]);
            txtProxyPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["ProxyPassword"]));
            txtSMTPServer.Text = Convert.ToString(Globals.HostSettings["SMTPServer"]);
            if (Convert.ToString(Globals.HostSettings["SMTPAuthentication"]) != "")
            {
                optSMTPAuthentication.Items.FindByValue(Globals.HostSettings["SMTPAuthentication"].ToString()).Selected = true;
            }
            else
            {
                optSMTPAuthentication.Items.FindByValue("0").Selected = true;
            }

            if (Convert.ToString(Globals.HostSettings["SMTPEnableSSL"]) == "Y")
            {
                chkSMTPEnableSSL.Checked = true;
            }
            else
            {
                chkSMTPEnableSSL.Checked = false;
            }

            txtSMTPUsername.Text = Convert.ToString(Globals.HostSettings["SMTPUsername"]);
            txtSMTPPassword.Attributes.Add("value", Convert.ToString(Globals.HostSettings["SMTPPassword"]));
            txtFileExtensions.Text = Convert.ToString(Globals.HostSettings["FileExtensions"]);

            if (Globals.HostSettings.ContainsKey("UseCustomErrorMessages"))
            {
                if (Globals.HostSettings["UseCustomErrorMessages"].ToString() == "Y")
                {
                    chkUseCustomErrorMessages.Checked = true;
                }
                else
                {
                    chkUseCustomErrorMessages.Checked = false;
                }
            }
            else
            {
                chkUseCustomErrorMessages.Checked = false;
            }

            if (Globals.HostSettings.ContainsKey("UseFriendlyUrls"))
            {
                if (Globals.HostSettings["UseFriendlyUrls"].ToString() == "Y")
                {
                    chkUseFriendlyUrls.Checked = true;
                }
                else
                {
                    chkUseFriendlyUrls.Checked = false;
                }
            }
            else
            {
                chkUseFriendlyUrls.Checked = false;
            }
            rowFriendlyUrls.Visible = chkUseFriendlyUrls.Checked;

            if (Globals.HostSettings.ContainsKey("EventLogBuffer"))
            {
                if (Globals.HostSettings["EventLogBuffer"].ToString() == "Y")
                {
                    chkLogBuffer.Checked = true;
                }
                else
                {
                    chkLogBuffer.Checked = false;
                }
            }
            else
            {
                chkLogBuffer.Checked = false;
            }

            if (Convert.ToString(Globals.HostSettings["SkinUpload"]) != "")
            {
                optSkinUpload.Items.FindByValue(Globals.HostSettings["SkinUpload"].ToString()).Selected = true;
            }
            else
            {
                optSkinUpload.Items.FindByValue("G").Selected = true;
            }

            txtHelpURL.Text = Convert.ToString(Globals.HostSettings["HelpURL"]);
            if (Globals.HostSettings.ContainsKey("EnableModuleOnLineHelp"))
            {
                if (Globals.HostSettings["EnableModuleOnLineHelp"].ToString() == "Y")
                {
                    chkEnableHelp.Checked = true;
                }
                else
                {
                    chkEnableHelp.Checked = false;
                }
            }
            else
            {
                chkEnableHelp.Checked = true;
            }

            if (Globals.HostSettings.ContainsKey("EnableFileAutoSync"))
            {
                if (Globals.HostSettings["EnableFileAutoSync"].ToString() == "Y")
                {
                    chkAutoSync.Checked = true;
                }
                else
                {
                    chkAutoSync.Checked = false;
                }
            }
            else
            {
                chkAutoSync.Checked = false;
            }


            ViewState["SelectedSchedulerMode"]      = cboSchedulerMode.SelectedItem.Value;
            ViewState["SelectedLogBufferEnabled"]   = chkLogBuffer.Checked;
            ViewState["SelectedUsersOnlineEnabled"] = chkUsersOnline.Checked;

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

            // get list of script files
            string    strProviderPath = PortalSettings.GetProviderPath();
            ArrayList arrScriptFiles  = new ArrayList();

            string[] arrFiles = Directory.GetFiles(strProviderPath, "*." + objProviderConfiguration.DefaultProvider);
            foreach (string strFile in arrFiles)
            {
                arrScriptFiles.Add(Path.GetFileNameWithoutExtension(strFile));
            }
            arrScriptFiles.Sort();

            cboUpgrade.DataSource = arrScriptFiles;
            cboUpgrade.DataBind();

            ModuleInfo FileManagerModule = (new ModuleController()).GetModuleByDefinition(Null.NullInteger, "File Manager");

            string[] additionalParameters = new string[3];

            additionalParameters[0]   = "mid=" + FileManagerModule.ModuleID;
            additionalParameters[1]   = "ftype=" + UploadType.Skin;
            additionalParameters[2]   = "rtab=" + this.TabId;
            lnkUploadSkin.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", additionalParameters);

            additionalParameters[1]        = "ftype=" + UploadType.Container;
            lnkUploadContainer.NavigateUrl = Globals.NavigateURL(FileManagerModule.TabID, "Edit", additionalParameters);
        }
Пример #5
0
        private void InstallApplication()
        {
            // the application uses a two step installation process. The first step is used to update
            // the Web.config with any configuration settings - which forces an application restart.
            // The second step finishes the installation process and provisions the site.
            string installationDate = Config.GetSetting("InstallationDate");
            string backupFolder     = Globals.glbConfigFolder + "Backup_" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + "\\";

            if (installationDate == null || installationDate == "")
            {
                XmlDocument xmlConfig = new XmlDocument();
                string      strError  = "";

                //save the current config files
                try
                {
                    if (!Directory.Exists(Globals.ApplicationMapPath + backupFolder))
                    {
                        Directory.CreateDirectory(Globals.ApplicationMapPath + backupFolder);
                    }

                    if (File.Exists(Globals.ApplicationMapPath + "\\web.config"))
                    {
                        File.Copy(Globals.ApplicationMapPath + "\\web.config", Globals.ApplicationMapPath + backupFolder + "web_old.config", true);
                    }
                }
                catch (Exception)
                {
                    //Error backing up old web.config
                    //This error is not critical, so can be ignored
                }

                try
                {
                    // open the web.config
                    xmlConfig = Config.Load();

                    // create random keys for the Membership machine keys
                    xmlConfig = Config.UpdateMachineKey(xmlConfig);
                }
                catch (Exception ex)
                {
                    strError += ex.Message;
                }

                // save a copy of the web.config
                strError += Config.Save(xmlConfig, backupFolder + "web_.config");

                // save the web.config
                strError += Config.Save(xmlConfig);

                if (strError == "")
                {
                    // send a new request to the application to initiate step 2
                    Response.Redirect(HttpContext.Current.Request.RawUrl, true);
                }
                else
                {
                    // error saving web.config
                    StreamReader reader  = File.OpenText(HttpContext.Current.Server.MapPath("~/403-3.htm"));
                    string       strHTML = reader.ReadToEnd();
                    reader.Close();
                    strHTML = strHTML.Replace("[MESSAGE]", strError);
                    HttpContext.Current.Response.Write(strHTML);
                    HttpContext.Current.Response.End();
                }
            }
            else
            {
                //Start Timer
                Upgrade.StartTimer();

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

                // get path to script files
                string providerPath = PortalSettings.GetProviderPath();
                if (!providerPath.StartsWith("ERROR:"))
                {
                    Response.Write("<h2>Version: " + Globals.glbAppVersion + "</h2>");
                    Response.Flush();

                    Response.Write("<br><br>");
                    Response.Write("<h2>Installation Status Report</h2>");
                    Response.Flush();
                    Upgrade.InstallDNN(providerPath);

                    Response.Write("<h2>Installation Complete</h2>");
                    Response.Write("<br><br><h2><a href='../Default.aspx'>Click Here To Access Your Portal</a></h2><br><br>");
                    Response.Flush();
                }
                else
                {
                    // upgrade error
                    Response.Write("<h2>Upgrade Error: " + providerPath + "</h2>");
                    Response.Flush();
                }

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

                //log APPLICATION_START event
                Global.LogStart();

                //Start Scheduler
                Global.StartScheduler();
            }
        }
Пример #6
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);
        }