protected void btnClearCache_Click(object sender, EventArgs e) { if (StopProcessing) { return; } // Clear the cache CacheHelper.ClearCache(null, true); Functions.ClearHashtables(); // Drop the routes CMSMvcHandler.DropAllRoutes(); // Collect the memory GC.Collect(); GC.WaitForPendingFinalizers(); // Log event EventLogProvider eventLog = new EventLogProvider(); eventLog.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, "System", "CLEARCACHE", null, GetString("Administration-System.ClearCacheSuccess")); lblInfo.Text = GetString("Administration-System.ClearCacheSuccess"); LoadData(); }
public static void Update60() { EventLogProvider evp = new EventLogProvider(); evp.LogEvent("I", DateTime.Now, "Upgrade to 6.0", "Upgrade - Start"); DataClassInfo dci = null; #region "CMS.UserSettings" try { dci = DataClassInfoProvider.GetDataClass("cms.usersettings"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "UserAuthenticationGUID"; ffi.DataType = FormFieldDataTypeEnum.GUID; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "UserBounces"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl; ffi.Visible = false; ffi.Caption = "UserBounces"; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "UserLinkedInID"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 100; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "UserLogActivities"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "UserPasswordRequestHash"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 100; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("CMS_UserSettings"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("CMS_UserSettings"); } } } catch (Exception ex) { evp.LogEvent("CMS.UserSettings - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - Customer" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.customer"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "CustomerSiteID"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl; ffi.Visible = false; fi.AddFormField(ffi); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassFormDefinition = fi.GetXmlDefinition(); dci.ClassXmlSchema = tm.GetXmlSchema("COM_Customer"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_Customer"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.Customer - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - Order" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.order"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "OrderCulture"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 10; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderIsPaid"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderTotalPriceInMainCurrency"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = fi.GetFormField("OrderStatusID"); if (ffi != null) { ffi.AllowEmpty = true; fi.UpdateFormField("OrderStatusID", ffi); } ffi = fi.GetFormField("OrderShippingAddressID"); if (ffi != null) { ffi.AllowEmpty = true; fi.UpdateFormField("OrderShippingAddressID", ffi); } dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("COM_Order"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_Order"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.Order - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - OrderItem" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.orderitem"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "OrderItemBundleGUID"; ffi.DataType = FormFieldDataTypeEnum.GUID; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemIsPrivate"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemPrice"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemSendNotification"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemSKU"; ffi.DataType = FormFieldDataTypeEnum.LongText; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemText"; ffi.DataType = FormFieldDataTypeEnum.LongText; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemTotalPriceInMainCurrency"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "OrderItemValidTo"; ffi.DataType = FormFieldDataTypeEnum.DateTime; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("COM_OrderItem"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_OrderItem"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.OrderItem - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - Shopping cart item" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.shoppingcartitem"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "CartItemBundleGUID"; ffi.DataType = FormFieldDataTypeEnum.GUID; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "CartItemIsPrivate"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "CartItemPrice"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "CartItemText"; ffi.DataType = FormFieldDataTypeEnum.LongText; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "CartItemValidTo"; ffi.DataType = FormFieldDataTypeEnum.DateTime; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = fi.GetFormField("CartItemGuid"); if (ffi != null) { ffi.AllowEmpty = true; fi.UpdateFormField("CartItemGuid", ffi); } dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("COM_ShoppingCartSKU"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_ShoppingCartSKU"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.ShoppingCartItem - Upgrade", "Upgrade", ex); } #endregion #region "Ecommerce - SKU" try { dci = DataClassInfoProvider.GetDataClass("ecommerce.sku"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "SKUBundleInventoryType"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 50; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUConversionName"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 100; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUConversionValue"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 200; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMaxDownloads"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMaxItemsInOrder"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMaxPrice"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMembershipGUID"; ffi.DataType = FormFieldDataTypeEnum.GUID; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUMinPrice"; ffi.DataType = FormFieldDataTypeEnum.Decimal; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUNeedsShipping"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUPrivateDonation"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUProductType"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 50; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUSiteID"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUValidFor"; ffi.DataType = FormFieldDataTypeEnum.Integer; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUValidity"; ffi.DataType = FormFieldDataTypeEnum.Text; ffi.Size = 50; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = new FormFieldInfo(); ffi.Name = "SKUValidUntil"; ffi.DataType = FormFieldDataTypeEnum.DateTime; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); ffi = fi.GetFormField("SKUDepartmentID"); if (ffi != null) { ffi.AllowEmpty = true; fi.UpdateFormField("SKUDepartmentID", ffi); } dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("COM_SKU"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("COM_SKU"); } } } catch (Exception ex) { evp.LogEvent("Ecommerce.SKU - Upgrade", "Upgrade", ex); } #endregion #region "Community - Group" try { dci = DataClassInfoProvider.GetDataClass("Community.Group"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "GroupLogActivity"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.CheckBoxControl; ffi.Visible = true; ffi.DefaultValue = "true"; ffi.Caption = "GroupLogActivity"; fi.AddFormField(ffi); dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("Community_Group"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("Community_Group"); } } } catch (Exception ex) { evp.LogEvent("Community.Group - Upgrade", "Upgrade", ex); } #endregion #region "Newsletter - Subscriber" try { dci = DataClassInfoProvider.GetDataClass("newsletter.subscriber"); if (dci != null) { FormInfo fi = new FormInfo(dci.ClassFormDefinition); if (fi != null) { FormFieldInfo ffi = new FormFieldInfo(); ffi.Name = "SubscriberBounces"; ffi.DataType = FormFieldDataTypeEnum.Boolean; ffi.AllowEmpty = true; ffi.PublicField = false; ffi.System = true; ffi.FieldType = FormFieldControlTypeEnum.LabelControl; ffi.Visible = false; fi.AddFormField(ffi); dci.ClassFormDefinition = fi.GetXmlDefinition(); TableManager tm = new TableManager(dci.ClassConnectionString); dci.ClassXmlSchema = tm.GetXmlSchema("Newsletter_Subscriber"); DataClassInfoProvider.SetDataClass(dci); // Generate queries SqlGenerator.GenerateDefaultQueries(dci, true, false); tm.RefreshCustomViews("Newsletter_Subscriber"); } } } catch (Exception ex) { evp.LogEvent("Newsletter.Subscriber - Upgrade", "Upgrade", ex); } #endregion #region "CMS.Document" try { dci = DataClassInfoProvider.GetDataClass("cms.document"); if (dci != null) { SearchSettings ss = dci.ClassSearchSettingsInfos; SearchSettingsInfo ssi = ss.GetSettingsInfo("42f446ee-9818-4596-8124-54a38f64aa05"); if (ssi != null) { ssi.Searchable = true; ss.SetSettingsInfo(ssi); } DataClassInfoProvider.SetDataClass(dci); } } catch (Exception ex) { evp.LogEvent("CMS.Document - Upgrade", "Upgrade", ex); } #endregion // Set the path to the upgrade package mUpgradePackagePath = HttpContext.Current.Server.MapPath("~/CMSSiteUtils/Import/upgrade_55R2_60.zip"); mWebsitePath = HttpContext.Current.Server.MapPath("~/"); TableManager dtm = new TableManager(null); // Update all views dtm.RefreshDocumentViews(); // Set data version ObjectHelper.SetSettingsKeyValue("CMSDataVersion", "6.0"); // Clear hashtables CMSObjectHelper.ClearHashtables(); // Clear the cache CacheHelper.ClearCache(null, true); // Drop the routes CMSMvcHandler.DropAllRoutes(); // Init the Mimetype helper (required for the Import) MimeTypeHelper.LoadMimeTypes(); CMSThread thread = new CMSThread(Upgrade60Import); thread.Start(); }