/// <summary> /// Finish button click. /// </summary> protected void FinishNextButton_Click(object sender, EventArgs e) { if (SqlInstallationHelper.DatabaseIsSeparated()) { string error = String.Empty; // If it doesn't support OpenQuery command, data could not have been moved so we cannot delete tables. if (SqlServerCapabilities.SupportsOpenQueryCommand) { var separationHelper = new DatabaseSeparationHelper(); separationHelper.InstallationConnStringSeparate = DatabaseSeparationHelper.ConnStringSeparate; separationHelper.InstallScriptsFolder = SqlInstallationHelper.GetSQLInstallPathToObjects(); separationHelper.ScriptsFolder = Server.MapPath("~/App_Data/DBSeparation"); error = separationHelper.DeleteSourceTables(false, true); } if (!String.IsNullOrEmpty(error)) { separationFinished.ErrorLabel.Visible = true; separationFinished.ErrorLabel.Text = error; EventLogProvider.LogEvent(EventType.ERROR, "Contact management database separation", "DELETEOLDDATA", error, RequestContext.CurrentURL); } else { EnableTasks(); TakeSitesOnline(); WebFarmHelper.CreateTask(SystemTaskType.RestartApplication, "RestartApplication"); ScriptHelper.RegisterStartupScript(this, typeof(string), "Close dialog", ScriptHelper.GetScript("RefreshParent(); CloseDialog();")); } } }
/// <summary> /// Finish button click. /// </summary> protected void FinishNextButton_Click(object sender, EventArgs e) { if (!SqlInstallationHelper.DatabaseIsSeparated()) { string error = String.Empty; bool dbEngineSupportsOpenqueryCommand = !DatabaseSeparationHelper.IsUsingAzureDatabase; if (dbEngineSupportsOpenqueryCommand) { var separationHelper = new DatabaseSeparationHelper(); separationHelper.InstallScriptsFolder = SqlInstallationHelper.GetSQLInstallPathToObjects(); separationHelper.ScriptsFolder = Server.MapPath("~/App_Data/DBSeparation"); separationHelper.InstallationConnStringSeparate = EncryptionHelper.DecryptData(hdnConnString.Value); error = separationHelper.DeleteSourceTables(separationFinished.DeleteOldDB, false); } if (!String.IsNullOrEmpty(error)) { separationFinished.ErrorLabel.Visible = true; separationFinished.ErrorLabel.Text = error; EventLogProvider.LogEvent(EventType.ERROR, "Contact management database join", "DELETEOLDDATA", error, RequestContext.CurrentURL); } else { EnableTasks(); TakeSitesOnline(); WebFarmHelper.CreateTask(SystemTaskType.RestartApplication, "RestartApplication", "", null); ScriptHelper.RegisterStartupScript(this, typeof(string), "Close dialog", ScriptHelper.GetScript("RefreshParent(); CloseDialog();")); } } }
protected override void OnInit() { base.OnInit(); WebFarmHelper.RegisterTask <UserWidgetWebFarmTask>(true); UserWidgetInfo.TYPEINFO.Events.Insert.Before += (_, eventArgs) => UpdateUserWidget(nameof(UserWidgetInfo.TYPEINFO.Events.Insert), eventArgs); UserWidgetInfo.TYPEINFO.Events.Update.Before += (_, eventArgs) => UpdateUserWidget(nameof(UserWidgetInfo.TYPEINFO.Events.Update), eventArgs); UserWidgetInfo.TYPEINFO.Events.Delete.Before += (_, eventArgs) => UpdateUserWidget(nameof(UserWidgetInfo.TYPEINFO.Events.Delete), eventArgs); }
private void UpdateUserWidget(string type, ObjectEventArgs eventArgs) { if (eventArgs.Object is UserWidgetInfo userWidgetInfo) { WebFarmHelper.CreateTask(new UserWidgetWebFarmTask { Type = type, CodeName = userWidgetInfo.UserWidgetCodeName }); } }
public void SaveFileToDisk(HttpPostedFile postedFile, string fileName, string filesFolderPath) { string path = filesFolderPath + fileName; DirectoryHelper.EnsureDiskPath(path, SystemContext.WebApplicationPhysicalPath); StorageHelper.SaveFileToDisk(path, (BinaryData)postedFile.InputStream, false); if (!WebFarmHelper.WebFarmEnabled) { WebFarmHelper.CreateIOTask("UPDATEBIZFORMFILE", path, (BinaryData)postedFile.InputStream, "updatebizformfile", SiteContext.CurrentSiteName, fileName); } }
/// <summary> /// Creates web farm server. Called when the "Create server" button is pressed. /// </summary> private bool CreateTask() { // Set the properties string taskTarget = ""; string taskTextData = "MyWebFarmTask"; byte[] taskBinaryData = null; // Create the web farm task WebFarmHelper.CreateTask(DataTaskType.ClearHashtables, taskTarget, taskTextData, taskBinaryData); return(true); }
/// <summary> /// Finish button click. /// </summary> protected void FinishNextButton_Click(object sender, EventArgs e) { if (!SqlInstallationHelper.DatabaseIsSeparated()) { string error = String.Empty; // If it doesn't support OpenQuery command, data could not have been moved so we cannot delete tables. if (SqlServerCapabilities.SupportsOpenQueryCommand) { var separationHelper = new DatabaseSeparationHelper(); separationHelper.InstallScriptsFolder = SqlInstallationHelper.GetSQLInstallPathToObjects(); separationHelper.ScriptsFolder = Server.MapPath("~/App_Data/DBSeparation"); separationHelper.InstallationConnStringSeparate = UnprotectConnectionString(); error = separationHelper.DeleteSourceTables(separationFinished.DeleteOldDB, false); } if (!String.IsNullOrEmpty(error)) { separationFinished.ErrorLabel.Visible = true; separationFinished.ErrorLabel.Text = error; var logData = new EventLogData(EventTypeEnum.Error, "Contact management database join", "DELETEOLDDATA") { EventDescription = error, EventUrl = RequestContext.CurrentURL }; Service.Resolve <IEventLogService>().LogEvent(logData); } else { EnableTasks(); WebFarmHelper.CreateTask(new RestartApplicationWebFarmTask()); ScriptHelper.RegisterStartupScript(this, typeof(string), "Close dialog", ScriptHelper.GetScript("RefreshParent(); CloseDialog();")); } } }
protected void Page_Load(object sender, EventArgs e) { // Init actions // Page view if (HeaderActions != null) { HeaderActions.ActionPerformed += HeaderActionsOnActionPerformed; InitHeaderActions(); } // Widget view else { InitButtons(); } timRefresh.Interval = 1000 * ValidationHelper.GetInteger(drpRefresh.SelectedValue, 0); isSeparatedDB = SqlInstallationHelper.DatabaseIsSeparated(); // Check permissions RaiseOnCheckPermissions("READ", this); if (StopProcessing) { return; } Statistics.EvaluateRequests(); // Do not count this page with async postback if (RequestHelper.IsAsyncPostback()) { RequestHelper.TotalSystemPageRequests.Decrement(null); } lblServerName.Text = GetString("Administration-System.ServerName"); lblServerVersion.Text = GetString("Administration-System.ServerVersion"); lblDBName.Text = GetString("Administration-System.DatabaseName"); lblDBSize.Text = GetString("Administration-System.DatabaseSize"); lblMachineName.Text = GetString("Administration-System.MachineName"); lblMachineNameValue.Text = HTMLHelper.HTMLEncode(SystemContext.MachineName); lblAspAccount.Text = GetString("Administration-System.Account"); lblValueAspAccount.Text = HTMLHelper.HTMLEncode(WindowsIdentity.GetCurrent().Name); lblPool.Text = GetString("Administration-System.Pool"); lblValuePool.Text = GetString("General.NA"); plcSeparatedName.Visible = isSeparatedDB; plcSeparatedServerName.Visible = isSeparatedDB; plcSeparatedSize.Visible = isSeparatedDB; plcSeparatedVersion.Visible = isSeparatedDB; plcSeparatedHeader.Visible = isSeparatedDB; lblValuePool.Text = HTMLHelper.HTMLEncode(SystemContext.ApplicationPoolName); // Get application trust level lblTrustLevel.Text = GetString("Administration-System.TrustLevel"); lblValueTrustLevel.Text = GetString("General.NA"); lblValueTrustLevel.Text = HTMLHelper.HTMLEncode(SystemContext.CurrentTrustLevel.ToString()); lblAspVersion.Text = GetString("Administration-System.Version"); lblValueAspVersion.Text = HTMLHelper.HTMLEncode(Environment.Version.ToString()); lblAlocatedMemory.Text = GetString("Administration-System.Memory"); lblPeakMemory.Text = GetString("Administration-System.PeakMemory"); lblVirtualMemory.Text = GetString("Administration-System.VirtualMemory"); lblPhysicalMemory.Text = GetString("Administration-System.PhysicalMemory"); lblIP.Text = GetString("Administration-System.IP"); lblPageViewsValues.Text = GetString("Administration-System.PageViewsValues"); lblPages.Text = GetString("Administration-System.Pages"); lblSystemPages.Text = GetString("Administration-System.SystemPages"); lblNonPages.Text = GetString("Administration-System.NonPages"); lblGetFilePages.Text = GetString("Administration-System.GetFilePages"); lblPagesNotFound.Text = GetString("Administration-System.PagesNotFound"); lblPending.Text = GetString("Administration-System.Pending"); lblCacheExpired.Text = GetString("Administration-System.CacheExpired"); lblCacheRemoved.Text = GetString("Administration-System.CacheRemoved"); lblCacheUnderused.Text = GetString("Administration-System.CacheUnderused"); lblCacheItems.Text = GetString("Administration-System.CacheItems"); lblCacheDependency.Text = GetString("Administration-System.CacheDependency"); LoadData(); if (!RequestHelper.IsPostBack()) { switch (QueryHelper.GetString("lastaction", String.Empty).ToLowerCSafe()) { case "restarted": ShowConfirmation(GetString("Administration-System.RestartSuccess")); break; case "webfarmrestarted": if (ValidationHelper.ValidateHash("WebfarmRestarted", QueryHelper.GetString("restartedhash", String.Empty))) { ShowConfirmation(GetString("Administration-System.WebframRestarted")); // Restart other servers - create webfarm task for application restart WebFarmHelper.CreateTask(SystemTaskType.RestartApplication, "RestartApplication"); } else { ShowError(GetString("general.actiondenied")); } break; case "countercleared": ShowConfirmation(GetString("Administration-System.CountersCleared")); break; case "winservicesrestarted": ShowConfirmation(GetString("Administration-System.WinServicesRestarted")); break; } } lblRunTime.Text = GetString("Administration.System.RunTime"); lblServerTime.Text = GetString("Administration.System.ServerTime"); // Remove milliseconds from the end of the time string string timeSpan = (DateTime.Now - CMSApplication.ApplicationStart).ToString(); int index = timeSpan.LastIndexOfCSafe('.'); if (index >= 0) { timeSpan = timeSpan.Remove(index); } // Display application run time lblRunTimeValue.Text = timeSpan; lblServerTimeValue.Text = Convert.ToString(DateTime.Now) + " " + TimeZoneHelper.GetUTCStringOffset(TimeZoneHelper.ServerTimeZone); lblIPValue.Text = HTMLHelper.HTMLEncode(RequestContext.UserHostAddress); }