protected void btnResetDatabases_Click(object sender, EventArgs e) { PXWeb.DatabasesSettings databases = (PXWeb.DatabasesSettings)PXWeb.Settings.Current.General.Databases; databases.ResetDatabases(); //Reload settings per database PXWeb.Settings.Current.LoadDatabaseSettings(); }
/// <summary> /// Save Paths settings /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void MasterSave_Click(Object sender, System.EventArgs e) { if (Page.IsValid) { if (PXWeb.Settings.BeginUpdate()) { try { PXWeb.PathsSettings paths = (PXWeb.PathsSettings)PXWeb.Settings.NewSettings.General.Paths; paths.LanguagesPath = txtLanguagePath.Text; paths.ImagesPath = txtImagePath.Text; paths.PxDatabasesPath = txtDatabasePath.Text; paths.PxAggregationsPath = txtAggregationPath.Text; PXWeb.Settings.Save(); //Paths have been changed - Reset registry objects PCAxis.Paxiom.GroupRegistry.GetRegistry().ReloadGroupings(); PCAxis.Web.Core.Management.LocalizationManager.ResetResourceManager(); PXWeb.DatabasesSettings databases = (PXWeb.DatabasesSettings)PXWeb.Settings.Current.General.Databases; databases.ResetDatabases(); } finally { PXWeb.Settings.EndUpdate(); } } } }
public HttpResponseMessage RebuildMenu(string database, bool languageDependent = true, string sortBy = "Title", bool buildSearchIndex = true) { var statusCode = HttpStatusCode.Created; List <DatabaseMessage> result = null; _logger.Info("RebuildMenu - started"); try { string path; path = System.Web.HttpContext.Current.Server.MapPath(Settings.Current.General.Paths.PxDatabasesPath); path = System.IO.Path.Combine(path, database); result = AdminTool.GenerateDatabase(path, languageDependent, sortBy); // Clear all caches PXWeb.Management.PxContext.CacheController.Clear(); //Force that databases are read again PXWeb.DatabasesSettings databases = (PXWeb.DatabasesSettings)PXWeb.Settings.Current.General.Databases; databases.ResetDatabases(); if (PXWeb.Settings.Current.Features.General.SearchEnabled && buildSearchIndex) { PXWeb.DatabaseSettings db = (PXWeb.DatabaseSettings)PXWeb.Settings.Current.GetDatabase(database); PXWeb.SearchIndexSettings searchIndex = (PXWeb.SearchIndexSettings)db.SearchIndex; // Check that the status has not been changed by another system before updating it if (searchIndex.Status != SearchIndexStatusType.Indexing) { searchIndex.Status = SearchIndexStatusType.WaitingCreate; db.Save(); BackgroundWorker.PxWebBackgroundWorker.HandleSearchIndex(database); } } _logger.Info("RebuildMenu - finished without error"); } catch (Exception e) { statusCode = HttpStatusCode.InternalServerError; _logger.Error(e.Message); } return(Request.CreateResponse(statusCode, result)); }
/// <summary> /// Resets Language, Px databases and aggregation files currently cached in memmory. /// </summary> public static void ResetAll() { //resets the languages PCAxis.Paxiom.Localization.PxResourceManager.ResetResourceManager(); PXWeb.LanguagesSettings langs = (PXWeb.LanguagesSettings)PXWeb.Settings.Current.General.Language; langs.ResetLanguages(); //resets the databases PXWeb.DatabasesSettings databases = (PXWeb.DatabasesSettings)PXWeb.Settings.Current.General.Databases; databases.ResetDatabases(); //Reload settings per database PXWeb.Settings.Current.LoadDatabaseSettings(); //resets aggregation information PCAxis.Paxiom.GroupRegistry.GetRegistry().ReloadGroupingsAsync(); // Clear all caches PXWeb.Management.PxContext.CacheController.Clear(); }
protected void btnGenerate_Click(object sender, EventArgs e) { string path; path = Server.MapPath(Settings.Current.General.Paths.PxDatabasesPath); path = System.IO.Path.Combine(path, cboSelectDb.SelectedValue); bool langDependent = false; if (string.Compare(cboLanguageDependent.SelectedValue, "true", StringComparison.InvariantCultureIgnoreCase) == 0) { langDependent = true; } // Clear all caches PXWeb.Management.PxContext.CacheController.Clear(); grdResult.DataSource = AdminTool.GenerateDatabase(path, langDependent, cboSortOrder.SelectedValue); grdResult.DataBind(); //Force that databases are read again PXWeb.DatabasesSettings databases = (PXWeb.DatabasesSettings)PXWeb.Settings.Current.General.Databases; databases.ResetDatabases(); if (PXWeb.Settings.Current.Features.General.SearchEnabled) { if (chkCreateIndex.Checked) { PXWeb.DatabaseSettings db = (PXWeb.DatabaseSettings)PXWeb.Settings.Current.GetDatabase(cboSelectDb.SelectedValue); PXWeb.SearchIndexSettings searchIndex = (PXWeb.SearchIndexSettings)db.SearchIndex; // Check that the status has not been changed by another system before updating it if (searchIndex.Status != SearchIndexStatusType.Indexing) { searchIndex.Status = SearchIndexStatusType.WaitingCreate; db.Save(); } InfoBox.Visible = true; } } }