/// <summary>
        /// This is part of the IUpgradeable of DNN
        /// </summary>
        /// <param name="version"></param>
        /// <returns></returns>
        public string UpgradeModule(string version)
        {
            Log.Add($"upgrade module - start for v:{version}");
            var res = new InstallationController().UpgradeModule(version);

            Log.Add($"result:{res}");
            Logging.LogToDnn("Upgrade", "ok", Log, force: true); // always log, this often causes hidden problems
            return(res);
        }
示例#2
0
        // had to disable this, as most requests now come from a lone page [ValidateAntiForgeryToken]
        public bool FinishInstallation()
        {
            var ic = new InstallationController();

            if (ic.IsUpgradeRunning)
            {
                throw new Exception("There seems to be an upgrade running - please wait. If you still see this message after 10 minutes, please restart the web application.");
            }

            ic.FinishAbortedUpgrade();

            return(true);
        }
 private static void UpdateUpgradeCompleteStatus()
 => UpgradeComplete = new InstallationController()
                      .IsUpgradeComplete(Settings.Installation.LastVersionWithServerChanges, "- static check");
示例#4
0
        public HtmlString Render()
        {
            var renderHelp = new RenderingHelpers(this);

            try
            {
                string innerContent = null;

                #region do pre-check to see if system is stable & ready
                var notReady = new InstallationController().CheckUpgradeMessage(PortalSettings.Current.UserInfo.IsSuperUser);
                if (!string.IsNullOrEmpty(notReady))
                {
                    innerContent = renderHelp.DesignErrorMessage(new Exception(notReady), true, "Error - needs admin to fix this", false, false);
                }

                #endregion

                #region check if the content-group exists (sometimes it's missing if a site is being imported and the data isn't in yet

                if (ContentBlock.DataIsMissing)
                {
                    if (Environment.Permissions.UserMayEditContent)
                    {
                        innerContent = ""; // stop further processing
                    }
                    else // end users should see server error as no js-side processing will happen
                    {
                        var ex =
                            new Exception(
                                "Data is missing - usually when a site is copied but the content / apps have not been imported yet - check 2sxc.org/help?tag=export-import");
                        innerContent = renderHelp.DesignErrorMessage(ex, true,
                                                                     "Error - needs admin to fix", false, true);
                    }
                }
                #endregion

                #region try to render the block or generate the error message
                if (innerContent == null)
                {
                    try
                    {
                        if (Template != null) // when a content block is still new, there is no definition yet
                        {
                            var engine = GetRenderingEngine(InstancePurposes.WebView);
                            innerContent = engine.Render();
                        }
                        else
                        {
                            innerContent = "";
                        }
                    }
                    catch (Exception ex)
                    {
                        innerContent = renderHelp.DesignErrorMessage(ex, true, "Error rendering template", false, true);
                    }
                }
                #endregion

                #region Wrap it all up into a nice wrapper tag
                var editInfos = JsonConvert.SerializeObject(renderHelp.GetClientInfosAll());
                var startTag  = (RenderWithDiv
                    ? $"<div class=\"sc-viewport sc-content-block\" data-cb-instance=\"{ContentBlock.ParentId}\" " +
                                 $" data-cb-id=\"{ContentBlock.ContentBlockId}\""
                                 +
                                 (RenderWithEditMetadata
                          ? " data-edit-context=\'" + editInfos + "'"
                          : "")
                                 + ">\n"
                    : "");
                var    endTag = (RenderWithDiv ? "\n</div>" : "");
                string result = startTag + innerContent + endTag;
                #endregion

                return(new HtmlString(result));
            }
            catch (Exception ex)
            {
                // todo: i18n
                return(new HtmlString(renderHelp.DesignErrorMessage(ex, true, null, true, true)));
            }
        }
示例#5
0
        public HtmlString Render()
        {
            var renderHelp = new RenderingHelpers(this);

            try
            {
                string innerContent = null;

                #region do pre-check to see if system is stable & ready
                var notReady = new InstallationController().CheckUpgradeMessage(PortalSettings.Current.UserInfo.IsSuperUser);
                if (!string.IsNullOrEmpty(notReady))
                {
                    innerContent = renderHelp.DesignErrorMessage(new Exception(notReady), true, "Error - needs admin to fix this", false, false);
                }

                #endregion

                #region try to render the block or generate the error message
                if (innerContent == null)
                {
                    try
                    {
                        if (Template != null) // when a content block is still new, there is no definition yet
                        {
                            var engine = GetRenderingEngine(InstancePurposes.WebView);
                            innerContent = engine.Render();
                        }
                        else
                        {
                            innerContent = "";
                        }
                    }
                    catch (Exception ex)
                    {
                        innerContent = renderHelp.DesignErrorMessage(ex, true, "Error rendering template", false, true);
                    }
                }
                #endregion

                #region Wrap it all up into a nice wrapper tag
                var editInfos = JsonConvert.SerializeObject(renderHelp.GetClientInfosAll());
                var startTag  = (RenderWithDiv
                    ? $"<div class=\"sc-viewport sc-content-block\" data-cb-instance=\"{ContentBlock.ParentId}\" " +
                                 $" data-cb-id=\"{ContentBlock.ContentBlockId}\""
                                 +
                                 (RenderWithEditMetadata
                          ? " data-edit-context=\'" + editInfos + "'"
                          : "")
                                 + ">\n"
                    : "");
                var    endTag = (RenderWithDiv ? "\n</div>" : "");
                string result = startTag + innerContent + endTag;
                #endregion

                return(new HtmlString(result));
            }
            catch (Exception ex)
            {
                // todo: i18n
                return(new HtmlString(renderHelp.DesignErrorMessage(ex, true, null, true, true)));
            }
        }