Пример #1
0
 private static void UpdateUpgradeCompleteStatus()
 {
     UpgradeComplete = new InstallationController().IsUpgradeComplete(Settings.Installation.LastVersionWithServerChanges, "- static check");
 }
Пример #2
0
 private static void UpdateUpgradeCompleteStatus()
 {
     UpgradeComplete = new InstallationController().IsUpgradeComplete(Settings.Installation.LastVersionWithServerChanges /* Settings.ModuleVersion */, "- static check");
 }
Пример #3
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;
        }
Пример #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 (innerContent == null)
                {
                    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
 /// <summary>
 /// This static initializer will do a one-time check to see if everything is ready,
 /// so subsequent access to this property will not need to do anything any more
 /// </summary>
 static InstallationController()
 {
     UpgradeComplete = new InstallationController().IsUpgradeComplete(Settings.ModuleVersion, "- static check");
 }