protected void ClearCache(object sender = null, EventArgs args = null) { if (StopProcessing) { return; } // Clear the cache CacheHelper.ClearCache(null, true); Functions.ClearHashtables(); // Drop the routes CMSDocumentRouteHelper.DropAllRoutes(); // Disposes all zip files ZipStorageProvider.DisposeAll(); // Collect the memory GC.Collect(); GC.WaitForPendingFinalizers(); // Log event EventLogProvider.LogEvent(EventType.INFORMATION, "System", "CLEARCACHE", GetString("Administration-System.ClearCacheSuccess")); ShowConfirmation(GetString("Administration-System.ClearCacheSuccess")); LoadData(); }
private static void UpgradeApplication(Func <bool> versionSpecificMethod, string newVersion, string packageName) { // Increase the timeout for upgrade request due to expensive operations like macro signing and conversion (needed for large DBs) HttpContext.Current.Server.ScriptTimeout = 14400; EventLogProvider.LogInformation(EVENT_LOG_INFO, "Upgrade - Start"); // Set the path to the upgrade package (this has to be done here, not in the Import method, because it's an async procedure without HttpContext) mUpgradePackagePath = HttpContext.Current.Server.MapPath("~/CMSSiteUtils/Import/" + packageName); mWebsitePath = HttpContext.Current.Server.MapPath("~/"); using (var context = new CMSActionContext()) { context.DisableLogging(); context.CreateVersion = false; context.LogIntegration = false; UpdateClasses(); UpdateAlternativeForms(); } // Update all views var dtm = new TableManager(null); dtm.RefreshDocumentViews(); RefreshCustomViews(dtm); // Set data version SettingsKeyInfoProvider.SetValue("CMSDataVersion", newVersion); SettingsKeyInfoProvider.SetValue("CMSDBVersion", newVersion); // Clear hashtables ModuleManager.ClearHashtables(); // Clear the cache CacheHelper.ClearCache(null, true); // Drop the routes CMSDocumentRouteHelper.DropAllRoutes(); // Init the Mimetype helper (required for the Import) MimeTypeHelper.LoadMimeTypes(); // Call version specific operations if (versionSpecificMethod != null) { using (var context = new CMSActionContext()) { context.DisableLogging(); context.CreateVersion = false; context.LogIntegration = false; versionSpecificMethod.Invoke(); } } UpgradeImportPackage(); }
private static void UpgradeApplication(Func <bool> versionSpecificMethod, string newVersion, string packageName) { // Increase the timeout for upgrade request due to expensive operations like macro signing and conversion (needed for large DBs) HttpContext.Current.Server.ScriptTimeout = 14400; // CI can't be enabled during (and after) upgrade because repository won't be consistent with actual data on the database SettingsKeyInfoProvider.SetGlobalValue("CMSEnableCI", false); EventLogProvider.LogInformation(EventLogSource, "START"); // Set the path to the upgrade package (this has to be done here, not in the Import method, because it's an async procedure without HttpContext) mUpgradePackagePath = HttpContext.Current.Server.MapPath("~/CMSSiteUtils/Import/" + packageName); mWebsitePath = HttpContext.Current.Server.MapPath("~/"); // Update class form and alt.form definitions var classFormDefinitionUpdateHelper = new ClassFormDefinitionUpdateHelper(EventLogSource); classFormDefinitionUpdateHelper.UpdateClassFormDefinitions(); // Set data version SettingsKeyInfoProvider.SetGlobalValue("CMSDataVersion", newVersion); SettingsKeyInfoProvider.SetGlobalValue("CMSDBVersion", newVersion); // Clear hashtables ModuleManager.ClearHashtables(); // Clear the cache CacheHelper.ClearCache(null, true); // Drop the routes CMSDocumentRouteHelper.DropAllRoutes(); // Call version specific operations if (versionSpecificMethod != null) { using (var context = new CMSActionContext()) { context.DisableLogging(); context.CreateVersion = false; context.LogIntegration = false; versionSpecificMethod.Invoke(); } } // Import upgrade package with webparts, widgets... UpgradeImportPackage(); RefreshMacroSignatures(); EventLogProvider.LogInformation(EventLogSource, "FINISH"); }