Browse Source

Reset blocks cache on CP action

Vova Tkach 5 years ago
parent
commit
6631a617e2

+ 1 - 1
engine/wrapper/wrapper.go

@@ -273,7 +273,7 @@ func (this *Wrapper) ConfigSave() error {
 	return this.Config.configWrite(this.DConfig + string(os.PathSeparator) + "config.json")
 }
 
-func (this *Wrapper) ResetBlocks() {
+func (this *Wrapper) ResetCacheBlocks() {
 	this.c.Reset(this.Host)
 }
 

+ 2 - 0
modules/module_blog_act_delete.go

@@ -40,6 +40,8 @@ func (this *Modules) RegisterAction_BlogDelete() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_blog_act_modify.go

@@ -130,6 +130,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 				wrap.MsgError(err.Error())
 				return
 			}
+			wrap.ResetCacheBlocks()
 			wrap.Write(`window.location='/cp/blog/modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
@@ -205,6 +206,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 				wrap.MsgError(err.Error())
 				return
 			}
+			wrap.ResetCacheBlocks()
 			wrap.Write(`window.location='/cp/blog/modify/` + pf_id + `/';`)
 		}
 	})

+ 2 - 0
modules/module_blog_categories_act_delete.go

@@ -62,6 +62,8 @@ func (this *Modules) RegisterAction_BlogCategoriesDelete() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_blog_categories_act_modify.go

@@ -223,12 +223,14 @@ func (this *Modules) RegisterAction_BlogCategoriesModify() *Action {
 				wrap.MsgError(err.Error())
 				return
 			}
+			wrap.ResetCacheBlocks()
 			wrap.Write(`window.location='/cp/blog/categories-modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 			if err := this.blog_ActionCategoryUpdate(wrap, pf_id, pf_name, pf_alias, pf_parent); err != nil {
 				wrap.MsgError(err.Error())
 				return
 			}
+			wrap.ResetCacheBlocks()
 			wrap.Write(`window.location='/cp/blog/categories-modify/` + pf_id + `/';`)
 		}
 	})

+ 2 - 0
modules/module_index_act_cypress.go

@@ -53,6 +53,8 @@ func (this *Modules) RegisterAction_IndexCypressReset() *Action {
 			;`,
 		)
 
+		wrap.ResetCacheBlocks()
+
 		wrap.Write(`OK`)
 	})
 }

+ 2 - 0
modules/module_index_act_delete.go

@@ -31,6 +31,8 @@ func (this *Modules) RegisterAction_IndexDelete() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_index_act_first_user.go

@@ -70,6 +70,8 @@ func (this *Modules) RegisterAction_IndexFirstUser() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_index_act_modify.go

@@ -82,6 +82,7 @@ func (this *Modules) RegisterAction_IndexModify() *Action {
 				wrap.MsgError(err.Error())
 				return
 			}
+			wrap.ResetCacheBlocks()
 			wrap.Write(`window.location='/cp/index/modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 			// Update page
@@ -115,6 +116,7 @@ func (this *Modules) RegisterAction_IndexModify() *Action {
 				wrap.MsgError(err.Error())
 				return
 			}
+			wrap.ResetCacheBlocks()
 			wrap.Write(`window.location='/cp/index/modify/` + pf_id + `/';`)
 		}
 	})

+ 2 - 0
modules/module_index_act_mysql_setup.go

@@ -907,6 +907,8 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_settings_act_api.go

@@ -30,6 +30,8 @@ func (this *Modules) RegisterAction_SettingsApi() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_settings_act_general.go

@@ -37,6 +37,8 @@ func (this *Modules) RegisterAction_SettingsGeneral() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_settings_act_pagination.go

@@ -82,6 +82,8 @@ func (this *Modules) RegisterAction_SettingsPagination() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_shop_act_delete.go

@@ -58,6 +58,8 @@ func (this *Modules) RegisterAction_ShopDelete() *Action {
 		// Delete products XML cache
 		wrap.RemoveProductXmlCacheFile()
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 4 - 0
modules/module_shop_act_modify.go

@@ -187,6 +187,8 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 			// Delete products XML cache
 			wrap.RemoveProductXmlCacheFile()
 
+			wrap.ResetCacheBlocks()
+
 			wrap.Write(`window.location='/cp/shop/modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
@@ -302,6 +304,8 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 			// Delete products XML cache
 			wrap.RemoveProductXmlCacheFile()
 
+			wrap.ResetCacheBlocks()
+
 			wrap.Write(`window.location='/cp/shop/modify/` + pf_id + `/';`)
 		}
 	})

+ 2 - 0
modules/module_shop_act_upload_delete.go

@@ -60,6 +60,8 @@ func (this *Modules) RegisterAction_ShopUploadDelete() *Action {
 		// Delete products XML cache
 		wrap.RemoveProductXmlCacheFile()
 
+		wrap.ResetCacheBlocks()
+
 		wrap.Write(`$('#list-images a').each(function(i, e) { if($(e).attr('title') == '` + pf_file + `') { $(e).parent().remove(); return; } });`)
 	})
 }

+ 2 - 0
modules/module_shop_act_upload_image.go

@@ -95,6 +95,8 @@ func (this *Modules) RegisterAction_ShopUploadImage() *Action {
 		// Delete products XML cache
 		wrap.RemoveProductXmlCacheFile()
 
+		wrap.ResetCacheBlocks()
+
 		wrap.Write(`$('#list-images').append('<div class="attached-img"><a href="/products/images/` + pf_id + `/` + target_file_name + `" title="` + target_file_name + `" target="_blank"><img src="/products/images/` + pf_id + `/thumb-0-` + target_file_name + `" /></a>, <a href="javascript:fave.ShopProductsDeleteImage(this, ` + pf_id + `, \'` + target_file_name + `\');">Delete</a></div>');`)
 	})
 }

+ 2 - 0
modules/module_shop_attributes_act_delete.go

@@ -79,6 +79,8 @@ func (this *Modules) RegisterAction_ShopAttributesDelete() *Action {
 		// Delete products XML cache
 		wrap.RemoveProductXmlCacheFile()
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 4 - 0
modules/module_shop_attributes_act_modify.go

@@ -93,6 +93,8 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 			// Delete products XML cache
 			wrap.RemoveProductXmlCacheFile()
 
+			wrap.ResetCacheBlocks()
+
 			wrap.Write(`window.location='/cp/shop/attributes-modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
@@ -223,6 +225,8 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 			// Delete products XML cache
 			wrap.RemoveProductXmlCacheFile()
 
+			wrap.ResetCacheBlocks()
+
 			wrap.Write(`window.location='/cp/shop/attributes-modify/` + pf_id + `/';`)
 		}
 	})

+ 2 - 0
modules/module_shop_categories_act_delete.go

@@ -65,6 +65,8 @@ func (this *Modules) RegisterAction_ShopCategoriesDelete() *Action {
 		// Delete products XML cache
 		wrap.RemoveProductXmlCacheFile()
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 4 - 0
modules/module_shop_categories_act_modify.go

@@ -227,6 +227,8 @@ func (this *Modules) RegisterAction_ShopCategoriesModify() *Action {
 			// Delete products XML cache
 			wrap.RemoveProductXmlCacheFile()
 
+			wrap.ResetCacheBlocks()
+
 			wrap.Write(`window.location='/cp/shop/categories-modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 			if err := this.shop_ActionCategoryUpdate(wrap, pf_id, pf_name, pf_alias, pf_parent); err != nil {
@@ -237,6 +239,8 @@ func (this *Modules) RegisterAction_ShopCategoriesModify() *Action {
 			// Delete products XML cache
 			wrap.RemoveProductXmlCacheFile()
 
+			wrap.ResetCacheBlocks()
+
 			wrap.Write(`window.location='/cp/shop/categories-modify/` + pf_id + `/';`)
 		}
 	})

+ 2 - 0
modules/module_shop_currencies_act_delete.go

@@ -37,6 +37,8 @@ func (this *Modules) RegisterAction_ShopCurrenciesDelete() *Action {
 		// Delete products XML cache
 		wrap.RemoveProductXmlCacheFile()
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 4 - 0
modules/module_shop_currencies_act_modify.go

@@ -77,6 +77,8 @@ func (this *Modules) RegisterAction_ShopCurrenciesModify() *Action {
 			// Delete products XML cache
 			wrap.RemoveProductXmlCacheFile()
 
+			wrap.ResetCacheBlocks()
+
 			wrap.Write(`window.location='/cp/shop/currencies-modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 			if err := wrap.DB.Transaction(func(tx *wrapper.Tx) error {
@@ -112,6 +114,8 @@ func (this *Modules) RegisterAction_ShopCurrenciesModify() *Action {
 			// Delete products XML cache
 			wrap.RemoveProductXmlCacheFile()
 
+			wrap.ResetCacheBlocks()
+
 			wrap.Write(`window.location='/cp/shop/currencies-modify/` + pf_id + `/';`)
 		}
 	})

+ 2 - 0
modules/module_template_act_edit_theme_file.go

@@ -50,6 +50,8 @@ func (this *Modules) RegisterAction_TemplateEditThemeFile() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_template_act_restore_file.go

@@ -33,6 +33,8 @@ func (this *Modules) RegisterAction_TemplateRestoreFile() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_users_act_delete.go

@@ -54,6 +54,8 @@ func (this *Modules) RegisterAction_UsersDelete() *Action {
 			return
 		}
 
+		wrap.ResetCacheBlocks()
+
 		// Reload current page
 		wrap.Write(`window.location.reload(false);`)
 	})

+ 2 - 0
modules/module_users_act_modify.go

@@ -87,6 +87,7 @@ func (this *Modules) RegisterAction_UsersModify() *Action {
 				wrap.MsgError(err.Error())
 				return
 			}
+			wrap.ResetCacheBlocks()
 			wrap.Write(`window.location='/cp/users/modify/` + utils.Int64ToStr(lastID) + `/';`)
 		} else {
 			// Update user
@@ -143,6 +144,7 @@ func (this *Modules) RegisterAction_UsersModify() *Action {
 					return
 				}
 			}
+			wrap.ResetCacheBlocks()
 			wrap.Write(`window.location='/cp/users/modify/` + pf_id + `/';`)
 		}
 	})