public void DiskSyncUpdate(ApiCall call) { Data.Models.WebSite website = null; Guid SiteId = call.GetGuidValue("SiteId"); website = Kooboo.Data.GlobalDb.WebSites.Get(SiteId); if (SiteId == default(Guid) || website == null) { return; } bool enable = call.GetBoolValue("EnableDiskSync"); string path = call.GetValue("localpath"); bool hasSamePath = Lib.Helper.StringHelper.IsSameValue(website.DiskSyncFolder, path); if (website.EnableDiskSync != enable || Lib.Helper.StringHelper.IsSameValue(website.DiskSyncFolder, path) == false) { website.EnableDiskSync = enable; website.DiskSyncFolder = path; GlobalDb.WebSites.AddOrUpdate(website); } if (enable) { // init disk.. if (!hasSamePath) { } WebSiteService.InitDiskSync(website, true); } }
public void Post(ApiCall call) { var siteid = call.GetValue <Guid>("siteid"); var currentsite = Kooboo.Data.GlobalDb.WebSites.Get(siteid); bool shouldinitDisk = false; if (currentsite != null) { var newinfo = call.Context.Request.Model as SiteUpdate; if (!currentsite.EnableDiskSync && newinfo.EnableDiskSync) { shouldinitDisk = true; } currentsite.DiskSyncFolder = newinfo.DiskSyncFolder; currentsite.DisplayName = newinfo.DisplayName; currentsite.EnableVisitorLog = newinfo.EnableVisitorLog; currentsite.EnableConstraintFixOnSave = newinfo.EnableConstraintFixOnSave; currentsite.EnableFrontEvents = newinfo.EnableFrontEvents; currentsite.EnableDiskSync = newinfo.EnableDiskSync; currentsite.EnableMultilingual = newinfo.EnableMultilingual; currentsite.CustomSettings = newinfo.CustomSettings; currentsite.Culture = newinfo.Culture; currentsite.SitePath = newinfo.SitePath; currentsite.EnableSitePath = newinfo.EnableSitePath; currentsite.DefaultCulture = newinfo.DefaultCulture; currentsite.AutoDetectCulture = newinfo.AutoDetectCulture; currentsite.ForceSSL = newinfo.ForceSSL; currentsite.EnableJsCssBrowerCache = newinfo.EnableJsCssBrowerCache; currentsite.EnableImageBrowserCache = newinfo.EnableImageBrowserCache; currentsite.ImageCacheDays = newinfo.ImageCacheDays; currentsite.EnableSPA = newinfo.EnableSPA; currentsite.EnableVideoBrowserCache = newinfo.EnableVideoBrowserCache; currentsite.EnableJsCssCompress = newinfo.EnableJsCssCompress; currentsite.SiteType = newinfo.SiteType; currentsite.EnableCORS = newinfo.EnableCORS; currentsite.EnableSqlLog = newinfo.EnableSqlLog; currentsite.PreviewUrl = newinfo.PreviewUrl; // the cluster... GlobalDb.WebSites.AddOrUpdate(currentsite); } if (shouldinitDisk) { WebSiteService.InitDiskSync(currentsite, true); } }