private void ProcessVocabularies(ExportImportJob importJob, ImportDto importDto, IList <TaxonomyScopeType> otherScopeTypes, IEnumerable <TaxonomyVocabulary> otherVocabularies) { var changed = false; var dataService = Util.GetDataService(); var localVocabularies = GetTaxonomyVocabularies(importDto.PortalId, DateUtils.GetDatabaseUtcTime().AddYears(1), null); foreach (var other in otherVocabularies) { var createdBy = Common.Util.GetUserIdByName(importJob, other.CreatedByUserID, other.CreatedByUserName); var modifiedBy = Common.Util.GetUserIdByName(importJob, other.LastModifiedByUserID, other.LastModifiedByUserName); var local = localVocabularies.FirstOrDefault(t => t.Name == other.Name); var scope = otherScopeTypes.FirstOrDefault(s => s.ScopeTypeID == other.ScopeTypeID); var scopeId = other.ScopeID ?? Null.NullInteger; if (scope != null && scope.ScopeType.Equals("Application", StringComparison.InvariantCultureIgnoreCase)) { scopeId = Null.NullInteger; } else if (scope != null && scope.ScopeType.Equals("Portal", StringComparison.InvariantCultureIgnoreCase)) { scopeId = importDto.PortalId; } if (local != null) { other.LocalId = local.VocabularyID; switch (importDto.CollisionResolution) { case CollisionResolution.Ignore: Result.AddLogEntry("Ignored vocabulary", other.Name); break; case CollisionResolution.Overwrite: var vocabulary = new Vocabulary(other.Name, other.Description) { IsSystem = other.IsSystem, Weight = other.Weight, ScopeId = scopeId, ScopeTypeId = scope?.LocalId ?? other.ScopeTypeID, }; dataService.UpdateVocabulary(vocabulary, modifiedBy); Result.AddLogEntry("Updated vocabulary", other.Name); changed = true; break; default: throw new ArgumentOutOfRangeException(importDto.CollisionResolution.ToString()); } } else { var vocabulary = new Vocabulary(other.Name, other.Description, (VocabularyType)other.VocabularyTypeID) { IsSystem = other.IsSystem, Weight = other.Weight, ScopeId = scopeId, ScopeTypeId = scope?.LocalId ?? other.ScopeTypeID, }; other.LocalId = dataService.AddVocabulary(vocabulary, createdBy); Result.AddLogEntry("Added vocabulary", other.Name); changed = true; } } if (changed) { DataCache.ClearCache(DataCache.VocabularyCacheKey); } }
/// <summary> /// Update the file to use for a favIcon /// </summary> /// <param name="fileId">The file id or Null.NullInteger for none</param> public void Update(int fileId) { PortalController.UpdatePortalSetting(_portalId, SettingName, fileId != Null.NullInteger ? string.Format("FileID={0}", fileId) : "", /*clearCache*/ true); DataCache.ClearCache(GetCacheKey(_portalId)); }
internal static void ClearCustomAliasesCache() { DataCache.ClearCache(CustomPortalAliasesKey); }
private void DoClearDown() { var pass = GenXmlFunctions.GetField(rpData, "txtclearpass"); if (pass == StoreSettings.Current.Get("adminpin") && pass != "") { var done = false; var objCtrl = new NBrightBuyController(); var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier; var dbOwner = DotNetNuke.Data.DataProvider.Instance().DatabaseOwner; var stmt = ""; if (GenXmlFunctions.GetField(rpData, "clearproducts") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'PRD' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'PRDLANG' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'AMY' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'AMYLANG' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'PRDXREF' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'USERPRDXREF' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATCASCADE' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATXREF' "; objCtrl.ExecSql(stmt); done = true; } if (GenXmlFunctions.GetField(rpData, "clearcategories") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY' and [XMLData].value('(genxml/dropdownlist/ddlgrouptype)[1]','nvarchar(max)') = 'cat' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORYLANG' and ParentItemId not in (Select itemid from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY') "; objCtrl.ExecSql(stmt); done = true; } if (GenXmlFunctions.GetField(rpData, "clearpropertiesonly") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY' and [XMLData].value('(genxml/dropdownlist/ddlgrouptype)[1]','nvarchar(max)') != 'cat' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORYLANG' and ParentItemId not in (Select itemid from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY') "; objCtrl.ExecSql(stmt); done = true; } if (GenXmlFunctions.GetField(rpData, "clearproperties") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY' and [XMLData].value('(genxml/dropdownlist/ddlgrouptype)[1]','nvarchar(max)') != 'cat' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORYLANG' and ParentItemId not in (Select itemid from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'CATEGORY') "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'GROUP' "; objCtrl.ExecSql(stmt); stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'GROUPLANG' "; objCtrl.ExecSql(stmt); done = true; } if (GenXmlFunctions.GetField(rpData, "clearorders") == "True") { stmt = "delete from " + dbOwner + "[" + objQual + "NBrightBuy] where PortalId = " + PortalId.ToString("") + " and typecode = 'ORDER' "; objCtrl.ExecSql(stmt); done = true; } DataCache.ClearCache(); if (done) { NBrightBuyUtils.SetNotfiyMessage(ModuleId, "deletecompleted", NotifyCode.ok); } } else { NBrightBuyUtils.SetNotfiyMessage(ModuleId, "nopin", NotifyCode.fail); } }
/// ----------------------------------------------------------------------------- /// <summary> /// ClearCache runs when the clear cache button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/27/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected void ClearCache(object sender, EventArgs e) { DataCache.ClearCache(); ClientResourceManager.ClearCache(); Response.Redirect(Request.RawUrl, true); }
protected void SaveMeta_Click(object sender, EventArgs e) { UrlRewiterSettings.SetDisableSiteIndex(PortalId, cbDisableSiteIndex.Checked); UrlRewiterSettings.SetDisableTermsIndex(PortalId, cbDisableTermsIndex.Checked); UrlRewiterSettings.SetDisablePrivacyIndex(PortalId, cbDisablePivacyIndex.Checked); UrlRewiterSettings.SetLogAuthentificatedUsers(PortalId, cbLogAuthentificatedUsers.Checked); UrlRewiterSettings.SetLogEachUrlOneTime(PortalId, cbLogEachUrlOneTime.Checked); UrlRewiterSettings.SetLogStatusCode200(PortalId, cbLogStatusCode200.Checked); UrlRewiterSettings.SetLogEnabled(PortalId, cbLogEnabled.Checked); UrlRewiterSettings.SetW3C(PortalId, cbW3C.Checked); UrlRewiterSettings.SetManage404(PortalId, cbEnhanced404.Checked); PortalController.UpdatePortalSetting(PortalId, UrlRewiterSettings.ErrorPage404Setting, ddlTab.SelectedValue); foreach (GridViewRow row in gvProviders.Rows) { CheckBox cbEnabled = (CheckBox)row.FindControl("cbEnabled"); PortalController.UpdatePortalSetting(PortalId, row.Cells[1].Text + "_Enabled", cbEnabled.Checked.ToString()); CheckBoxList cblSettings = (CheckBoxList)row.FindControl("cblSettings"); foreach (ListItem li in cblSettings.Items) { PortalController.UpdatePortalSetting(PortalId, row.Cells[1].Text + "_" + li.Value, li.Selected.ToString()); } } /* * XmlDocument xmlConfig = Config.Load(); * XmlNode xmlSitemap = xmlConfig.SelectSingleNode("/configuration/dotnetnuke/sitemap/providers/add[@name='openUrlRewriterSitemapProvider']"); * if (cbSitemapProvider.Checked && xmlSitemap == null) { * * string install = * @"<configuration> * <nodes> * <node path=""/configuration/dotnetnuke/sitemap/providers"" * action=""update"" key=""name"" collision=""ignore""> * <add name=""openUrlRewriterSitemapProvider"" type=""Satrabel.SitemapProviders.OpenUrlRewriterSitemapProvider, Satrabel.OpenUrlRewriter"" providerPath=""~\Providers\MembershipProviders\Sitemap\OpenUrlRewriterSitemapProvider\""/> * </node> * <node path=""/configuration/dotnetnuke/sitemap"" action=""updateattribute"" name=""defaultProvider"" value=""openUrlRewriterSitemapProvider"" /> * <node path=""/configuration/dotnetnuke/sitemap/providers/add[@name='coreSitemapProvider']"" action=""remove"" /> * </nodes> * </configuration>"; * * XmlDocument doc = new XmlDocument(); * doc.LoadXml(install); * * var app = DotNetNuke.Application.DotNetNukeContext.Current.Application; * var merge = new XmlMerge(doc, Globals.FormatVersion(app.Version), app.Description); * * * * merge.UpdateConfig(xmlConfig); * * * //XmlNode xmlSitemapProviders = xmlConfig.SelectSingleNode("/configuration/dotnetnuke/sitemap/providers"); * //xmlSitemap = xmlConfig.CreateElement("add"); * //XmlUtils.CreateAttribute(xmlConfig, xmlSitemap, "name", "openUrlRewriterSitemapProvider"); * //XmlUtils.CreateAttribute(xmlConfig, xmlSitemap, "type", "Satrabel.SitemapProviders.OpenUrlRewriterSitemapProvider, Satrabel.OpenUrlRewriter"); * //XmlUtils.CreateAttribute(xmlConfig, xmlSitemap, "providerPath", @"~\Providers\MembershipProviders\Sitemap\OpenUrlRewriterSitemapProvider\"); * //xmlSitemapProviders.AppendChild(xmlSitemap); * * Config.Save(xmlConfig); * } * else if (!cbSitemapProvider.Checked && xmlSitemap != null) * { * * } */ DataCache.ClearCache(); this.Response.Redirect(Globals.NavigateURL(this.TabId), true); }
public override void PurgeCache(int portalId) { DataCache.ClearCache(cachePrefix); }
private void ProcessRoleGroups(ExportImportJob importJob, ImportDto importDto, IEnumerable <ExportRoleGroup> otherRoleGroups) { var changedGroups = new List <RoleGroupItem>(); var portalId = importJob.PortalId; var localRoleGroups = CBO.FillCollection <ExportRoleGroup>(DataProvider.Instance().GetAllRoleGroups(portalId, DateUtils.GetDatabaseUtcTime().AddYears(1), null)); foreach (var other in otherRoleGroups) { if (this.CheckCancelled(importJob)) { return; } var createdBy = Util.GetUserIdByName(importJob, other.CreatedByUserID, other.CreatedByUserName); var modifiedBy = Util.GetUserIdByName(importJob, other.LastModifiedByUserID, other.LastModifiedByUserName); var local = localRoleGroups.FirstOrDefault(t => t.RoleGroupName == other.RoleGroupName); if (local != null) { other.LocalId = local.RoleGroupID; switch (importDto.CollisionResolution) { case CollisionResolution.Ignore: this.Result.AddLogEntry("Ignored role group", other.RoleGroupName); break; case CollisionResolution.Overwrite: var roleGroup = new RoleGroupInfo(local.RoleGroupID, portalId, false) { RoleGroupName = other.RoleGroupName, Description = other.Description, }; RoleController.UpdateRoleGroup(roleGroup, false); changedGroups.Add(new RoleGroupItem(roleGroup.RoleGroupID, createdBy, modifiedBy)); DataCache.ClearCache(string.Format(DataCache.RoleGroupsCacheKey, local.RoleGroupID)); this.Result.AddLogEntry("Updated role group", other.RoleGroupName); break; default: throw new ArgumentOutOfRangeException(importDto.CollisionResolution.ToString()); } } else { var roleGroup = new RoleGroupInfo() { PortalID = portalId, RoleGroupName = other.RoleGroupName, Description = other.Description, }; other.LocalId = RoleController.AddRoleGroup(roleGroup); changedGroups.Add(new RoleGroupItem(roleGroup.RoleGroupID, createdBy, modifiedBy)); this.Result.AddLogEntry("Added role group", other.RoleGroupName); } } if (changedGroups.Count > 0) { RefreshRecordsUserIds(changedGroups); } }
public static void Clear() { DataCache.ClearCache(Keys.Prefix); }
internal static void Clear() { DataCache.ClearCache(Keys.Prefix); }
internal static void Clear(string Prefix) { DataCache.ClearCache(Prefix); }
public void Execute(BasePage Context) { Dictionary <String, Object> jsonDicts = new Dictionary <String, Object>(); JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); Common.UpdateDictionary(jsonDicts, "Message", ""); Boolean Result = false; int UpdateResult = 0; var json = WebHelper.GetStringParam(Context.Request, "json", ""); var UserItem = Context.UserInfo; if (UserItem != null && UserItem.UserID > 0) { ProfilePropertyDefinitionCollection profileProperties = new ProfilePropertyDefinitionCollection(); var FirstName = WebHelper.GetStringParam(Context.Request, "FirstName", ""); if (!String.IsNullOrEmpty(FirstName) && FirstName != UserItem.Profile.FirstName) { UserItem.FirstName = FirstName; UpdateResult++; } var LastName = WebHelper.GetStringParam(Context.Request, "LastName", ""); if (!String.IsNullOrEmpty(LastName) && LastName != UserItem.Profile.LastName) { UserItem.LastName = LastName; UpdateResult++; } var Company = WebHelper.GetStringParam(Context.Request, "Company", ""); if (!String.IsNullOrEmpty(Company) && Company != UserItem.Profile.GetPropertyValue("Company")) { //DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile() //UserItem.Profile["Company"] = Company; UserItem.Profile.SetProfileProperty("Company", Company); UpdateResult++; } var Newsletter_GameSheets = WebHelper.GetStringParam(Context.Request, "Newsletter_GameSheets", ""); if (Newsletter_GameSheets != UserItem.Profile.GetPropertyValue("Newsletter_GameSheets").ToLower()) { UserItem.Profile.SetProfileProperty("Newsletter_GameSheets", ConvertBool(Newsletter_GameSheets)); UpdateResult++; } var Newsletter_Downloads = WebHelper.GetStringParam(Context.Request, "Newsletter_Downloads", ""); if (Newsletter_Downloads != UserItem.Profile.GetPropertyValue("Newsletter_Downloads").ToLower()) { UserItem.Profile.SetProfileProperty("Newsletter_Downloads", ConvertBool(Newsletter_Downloads)); UpdateResult++; } var Newsletter_Campaigns = WebHelper.GetStringParam(Context.Request, "Newsletter_Campaigns", ""); if (Newsletter_Campaigns != UserItem.Profile.GetPropertyValue("Newsletter_Campaigns").ToLower()) { UserItem.Profile.SetProfileProperty("Newsletter_Campaigns", ConvertBool(Newsletter_Campaigns)); UpdateResult++; } var Newsletter_Events = WebHelper.GetStringParam(Context.Request, "Newsletter_Events", ""); if (Newsletter_Events != UserItem.Profile.GetPropertyValue("Newsletter_Events").ToLower()) { UserItem.Profile.SetProfileProperty("Newsletter_Events", ConvertBool(Newsletter_Events)); UpdateResult++; } if (UpdateResult > 0) { DataCache.ClearPortalCache(Context.PortalId, true); DataCache.ClearCache(); UserController.UpdateUser(Context.PortalId, UserItem); ProfileController.UpdateUserProfile(UserItem); Common.UpdateDictionary(jsonDicts, "Message", "Update user account success!"); Result = true; } else { Result = false; Common.UpdateDictionary(jsonDicts, "Message", "User Profile no change."); } var Password = WebHelper.GetStringParam(Context.Request, "Password", ""); if (!String.IsNullOrEmpty(Password)) { if (UserController.ValidatePassword(Password)) { string resetPassword = UserController.ResetPassword(UserItem, String.Empty); if (UserController.ChangePassword(UserItem, resetPassword, Password)) { //DataCache.ClearPortalCache(UserItem.PortalID, false); //DataCache.ClearUserCache(UserItem.PortalID, UserItem.Username); Common.UpdateDictionary(jsonDicts, "Message", "Update user account success!"); Result = true; } else { Common.UpdateDictionary(jsonDicts, "Message", Localization.GetString("PasswordResetFailed")); Result = false; } } else { Common.UpdateDictionary(jsonDicts, "Message", Localization.GetString("PasswordInvalid")); Result = false; } } } jsonDicts.Add("UserItem", UserItem); jsonDicts.Add("UpdateResult", UpdateResult); jsonDicts.Add("Result", Result); //转换数据为json ResponseString = jsSerializer.Serialize(jsonDicts); }
/// ----------------------------------------------------------------------------- /// <summary> /// Clear profiles of all users by portal Id. /// </summary> /// ----------------------------------------------------------------------------- public static void ClearAllUsersInfoProfileCacheByPortal(int portalId) { DataCache.ClearCache(string.Format(DataCache.UserCacheKey, portalId, string.Empty)); DataCache.ClearCache(string.Format(DataCache.UserProfileCacheKey, portalId, string.Empty)); }
private void ProcessTaxonomyTerms(ExportImportJob importJob, ImportDto importDto, IList <TaxonomyVocabulary> otherVocabularies, IList <TaxonomyTerm> otherTaxonomyTerms) { var dataService = Util.GetDataService(); //var vocabularyController = new VocabularyController(); var localTaxonomyTerms = GetTaxonomyTerms(importDto.PortalId, DateUtils.GetDatabaseUtcTime().AddYears(1), null); foreach (var other in otherTaxonomyTerms) { var createdBy = Common.Util.GetUserIdByName(importJob, other.CreatedByUserID, other.CreatedByUserName); var modifiedBy = Common.Util.GetUserIdByName(importJob, other.LastModifiedByUserID, other.LastModifiedByUserName); var vocabulary = otherVocabularies.FirstOrDefault(v => v.VocabularyID == other.VocabularyID); var vocabularyId = vocabulary?.LocalId ?? 0; var local = localTaxonomyTerms.FirstOrDefault(t => t.Name == other.Name && t.VocabularyID == vocabularyId); if (local != null) { other.LocalId = local.TermID; switch (importDto.CollisionResolution) { case CollisionResolution.Ignore: Result.AddLogEntry("Ignored taxonomy", other.Name); break; case CollisionResolution.Overwrite: var parent = other.ParentTermID.HasValue ? otherTaxonomyTerms.FirstOrDefault(v => v.TermID == other.ParentTermID.Value) : null; var term = new Term(other.Name, other.Description, vocabularyId) { TermId = local.TermID, ParentTermId = parent?.LocalId, Weight = other.Weight, }; if (term.ParentTermId.HasValue) { dataService.UpdateHeirarchicalTerm(term, modifiedBy); } else { dataService.UpdateSimpleTerm(term, modifiedBy); } DataCache.ClearCache(string.Format(DataCache.TermCacheKey, term.TermId)); Result.AddLogEntry("Updated taxonomy", other.Name); break; default: throw new ArgumentOutOfRangeException(importDto.CollisionResolution.ToString()); } } else { var parent = other.ParentTermID.HasValue ? otherTaxonomyTerms.FirstOrDefault(v => v.TermID == other.ParentTermID.Value) : null; var term = new Term(other.Name, other.Description, vocabularyId) { ParentTermId = parent?.LocalId, Weight = other.Weight, }; other.LocalId = term.ParentTermId.HasValue ? dataService.AddHeirarchicalTerm(term, createdBy) : dataService.AddSimpleTerm(term, createdBy); Result.AddLogEntry("Added taxonomy", other.Name); } } }
public void RemoveModuleCache(int moduleId) { DataCache.ClearCache(NewsCacheKeyPrefix + "ModuleId=" + moduleId); }
public static void Clear(string Prefix) { DataCache.ClearCache(Prefix); }
public void ClearBannerCache() { //Clear all cached Banners collections DataCache.ClearCache("Banners:"); }
/// <summary> /// Imports the users. /// </summary> /// <param name="boardId">The board id.</param> /// <param name="portalId">The portal id.</param> /// <param name="info">The information text.</param> /// <returns> /// Returns the Number of Users that where imported /// </returns> public static int ImportUsers(int boardId, int portalId, out string info) { var newUserCount = 0; var users = UserController.GetUsers(portalId); // Inject SU here users.AddRange(UserController.GetUsers(false, true, Null.NullInteger)); users.Sort(new UserComparer()); // Load Yaf Board Settings if needed var boardSettings = BoardContext.Current == null ? new LoadBoardSettings(boardId) : BoardContext.Current.Get <BoardSettings>(); var rolesChanged = false; try { foreach (UserInfo dnnUserInfo in users) { var dnnUser = Membership.GetUser(dnnUserInfo.Username, true); if (dnnUser == null) { continue; } // un-approve soft deleted user in yaf if (dnnUserInfo.IsDeleted && dnnUser.IsApproved) { dnnUser.IsApproved = false; Membership.UpdateUser(dnnUser); continue; } if (!dnnUserInfo.IsDeleted && !dnnUser.IsApproved) { dnnUser.IsApproved = true; Membership.UpdateUser(dnnUser); } var yafUserId = BoardContext.Current.GetRepository <User>().GetUserId(boardId, dnnUser.ProviderUserKey.ToString()); if (yafUserId.Equals(0)) { // Create user if Not Exist yafUserId = CreateYafUser(dnnUserInfo, dnnUser, boardId, portalId, boardSettings); newUserCount++; } else { ProfileSyncronizer.UpdateUserProfile( yafUserId, YAF.Utils.UserProfile.GetProfile(dnnUser.UserName), new CustomCombinedUserDataHelper(dnnUser, yafUserId, boardId), dnnUserInfo, boardSettings, true); } rolesChanged = RoleSyncronizer.SynchronizeUserRoles(boardId, portalId, yafUserId, dnnUserInfo); // super admin check... if (dnnUserInfo.IsSuperUser) { SetYafHostUser(yafUserId, boardId); } } BoardContext.Current.Get <IDataCache>().Clear(); DataCache.ClearCache(); } catch (Exception ex) { Exceptions.LogException(ex); } info = $"{newUserCount} User(s) Imported, all user profiles are synchronized{(rolesChanged ? ", but all User Roles are synchronized!" : ", User Roles already synchronized!")}"; return(newUserCount); }
protected virtual void ClearCache() { DataCache.ClearCache(); }
public void ClearCache(string cacheKeyOrPrefix) { DataCache.ClearCache(PrefixCacheKey(cacheKeyOrPrefix)); }
public override void Remove(int tabModuleId) { DataCache.ClearCache(string.Concat(cachePrefix, "|", tabModuleId.ToString())); }
public override void DoWork() { try { // TODO: do some clean-up for very old import/export jobs/logs var job = EntitiesController.Instance.GetFirstActiveJob(); if (job == null) { this.ScheduleHistoryItem.Succeeded = true; this.ScheduleHistoryItem.AddLogNote("<br/>No Site Export/Import jobs queued for processing."); } else if (job.IsCancelled) { job.JobStatus = JobStatus.Cancelled; EntitiesController.Instance.UpdateJobStatus(job); this.ScheduleHistoryItem.Succeeded = true; this.ScheduleHistoryItem.AddLogNote("<br/>Site Export/Import jobs was previously cancelled."); } else { job.JobStatus = JobStatus.InProgress; EntitiesController.Instance.UpdateJobStatus(job); var result = new ExportImportResult { JobId = job.JobId, }; var engine = new ExportImportEngine(); var succeeded = true; switch (job.JobType) { case JobType.Export: try { engine.Export(job, result, this.ScheduleHistoryItem); } catch (Exception ex) { result.AddLogEntry("EXCEPTION exporting job #" + job.JobId, ex.Message, ReportLevel.Error); engine.AddLogsToDatabase(job.JobId, result.CompleteLog); throw; } EntitiesController.Instance.UpdateJobStatus(job); break; case JobType.Import: try { engine.Import(job, result, this.ScheduleHistoryItem); } catch (ThreadAbortException) { this.ScheduleHistoryItem.TimeLapse = EmergencyScheduleFrequency; this.ScheduleHistoryItem.TimeLapseMeasurement = EmergencyScheduleFrequencyUnit; this.ScheduleHistoryItem.RetryTimeLapse = EmergencyScheduleRetry; this.ScheduleHistoryItem.RetryTimeLapseMeasurement = EmergencyScheduleRetryUnit; this.ScheduleHistoryItem.RetainHistoryNum = EmergencyHistoryNumber; SchedulingController.UpdateSchedule(this.ScheduleHistoryItem); SchedulingController.PurgeScheduleHistory(); Logger.Error("The Schduler item stopped because main thread stopped, set schedule into emergency mode so it will start after app restart."); succeeded = false; } catch (Exception ex) { result.AddLogEntry("EXCEPTION importing job #" + job.JobId, ex.Message, ReportLevel.Error); engine.AddLogsToDatabase(job.JobId, result.CompleteLog); throw; } EntitiesController.Instance.UpdateJobStatus(job); if (job.JobStatus == JobStatus.Successful || job.JobStatus == JobStatus.Cancelled) { // clear everything to be sure imported items take effect DataCache.ClearCache(); } break; default: throw new Exception("Unknown job type: " + job.JobType); } this.ScheduleHistoryItem.Succeeded = true; // restore schedule item running timelapse to default. if (succeeded && this.ScheduleHistoryItem.TimeLapse == EmergencyScheduleFrequency && this.ScheduleHistoryItem.TimeLapseMeasurement == EmergencyScheduleFrequencyUnit) { this.ScheduleHistoryItem.TimeLapse = DefaultScheduleFrequency; this.ScheduleHistoryItem.TimeLapseMeasurement = DefaultScheduleFrequencyUnit; this.ScheduleHistoryItem.RetryTimeLapse = DefaultScheduleRetry; this.ScheduleHistoryItem.RetryTimeLapseMeasurement = DefaultScheduleRetryUnit; this.ScheduleHistoryItem.RetainHistoryNum = DefaultHistoryNumber; SchedulingController.UpdateSchedule(this.ScheduleHistoryItem); } var sb = new StringBuilder(); var jobType = Localization.GetString("JobType_" + job.JobType, Constants.SharedResources); var jobStatus = Localization.GetString("JobStatus_" + job.JobStatus, Constants.SharedResources); sb.AppendFormat("<br/><b>{0} {1}</b>", jobType, jobStatus); var summary = result.Summary; if (summary.Count > 0) { sb.Append("<br/><b>Summary:</b><ul>"); foreach (var entry in summary) { sb.Append($"<li>{entry.Name}: {entry.Value}</li>"); } sb.Append("</ul>"); } this.ScheduleHistoryItem.AddLogNote(sb.ToString()); engine.AddLogsToDatabase(job.JobId, result.CompleteLog); Logger.Trace("Site Export/Import: Job Finished"); } // SetLastSuccessfulIndexingDateTime(ScheduleHistoryItem.ScheduleID, ScheduleHistoryItem.StartDate); } catch (Exception ex) { this.ScheduleHistoryItem.Succeeded = false; this.ScheduleHistoryItem.AddLogNote("<br/>Export/Import EXCEPTION: " + ex.Message); this.Errored(ref ex); // this duplicates the logging // if (ScheduleHistoryItem.ScheduleSource != ScheduleSource.STARTED_FROM_BEGIN_REQUEST) // { // Exceptions.LogException(ex); // } } }
private void Update() { var settings = ModCtrl.GetByGuidKey(PortalSettings.Current.PortalId, 0, "SETTINGS", "NBrightBuySettings"); if (settings == null) { settings = new NBrightInfo(true); settings.PortalId = PortalId; // use zero as moduleid so it's not picked up by the modules for their settings. // The normal GetList will get all moduleid OR moduleid=-1 settings.ModuleId = 0; settings.ItemID = -1; settings.TypeCode = "SETTINGS"; settings.GUIDKey = "NBrightBuySettings"; } settings.XMLData = GenXmlFunctions.GetGenXml(rpData, "", StoreSettings.Current.FolderImagesMapPath); if (settings.GetXmlProperty("genxml/hidden/hidemaillogo") != "") { settings.SetXmlProperty("genxml/hidden/emaillogourl", StoreSettings.Current.FolderImages + "/" + settings.GetXmlProperty("genxml/hidden/hidemaillogo")); settings.SetXmlProperty("genxml/hidden/emaillogopath", StoreSettings.Current.FolderImagesMapPath + "\\" + settings.GetXmlProperty("genxml/hidden/hidemaillogo")); } settings.SetXmlProperty("genxml/hidden/backofficetabid", PortalSettings.Current.ActiveTab.TabID.ToString("")); ModCtrl.Update(settings); if (StoreSettings.Current.DebugModeFileOut) { settings.XMLDoc.Save(PortalSettings.HomeDirectoryMapPath + "\\debug_Settings.xml"); } // create upload folders var folder = StoreSettings.Current.FolderNBStore; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } folder = StoreSettings.Current.FolderImagesMapPath; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } folder = StoreSettings.Current.FolderDocumentsMapPath; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } folder = StoreSettings.Current.FolderUploadsMapPath; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } folder = StoreSettings.Current.FolderTempMapPath; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } //Create default category grouptype var l = NBrightBuyUtils.GetCategoryGroups(EditLanguage, true); var g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "cat" select i; if (!g.Any()) { CreateGroup("cat", "Categories", "2"); } if (l.Count == 0) { g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "promo" select i; if (!g.Any()) { CreateGroup("promo", "Promotions", "1"); } g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "man" select i; if (!g.Any()) { CreateGroup("man", "Manufacturer", "1"); } g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "supp" select i; if (!g.Any()) { CreateGroup("supp", "Supplier", "1"); } g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "fea" select i; if (!g.Any()) { CreateGroup("fea", "Features", "1"); } g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "spec" select i; if (!g.Any()) { CreateGroup("spec", "Specifications", "1"); } g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "temp" select i; if (!g.Any()) { CreateGroup("temp", "Temp", "1"); } g = from i in l where i.GetXmlProperty("genxml/textbox/groupref") == "searchfilter" select i; if (!g.Any()) { CreateGroup("searchfilter", "Display Search Filter", "3"); } } //update resx fields var resxDic = GenXmlFunctions.GetGenXmlResx(rpData); var genTempl = (GenXmlTemplate)rpData.ItemTemplate; var resxfolders = genTempl.GetResxFolders(); // ideally we'd create the settings resx at the portal level, but can't easily get that to work. var resxUpdate = NBrightBuyUtils.UpdateResxFields(resxDic, resxfolders, StoreSettings.Current.EditLanguage, true); //remove all cahce setting from cache for reload //DNN is sticky with some stuff (had some issues with email addresses not updating), so to be sure clear it all. DataCache.ClearCache(); }
public void Import(string filename, bool importTemplate, bool importData, bool importAdditionalData, bool importSettings) { // unzip all string allStartPath = ModuleImportDirectory; string allZipPath = ImportDirectory + filename; if (Directory.Exists(allStartPath)) { Directory.Delete(allStartPath, true); } ZipFile.ExtractToDirectory(allZipPath, allStartPath); var export = JObject.Parse(File.ReadAllText(ModuleImportDirectory + "export.json")); Files = export["Files"] as JObject; // unzip template if (importTemplate) { string startPath = HostingEnvironment.MapPath("~/" + PortalSettings.HomeDirectory + "OpenContent/Templates/" + export["Name"]); if (!Directory.Exists(startPath)) { Directory.CreateDirectory(startPath); } string zipPath = ModuleImportDirectory + export["Name"] + ".zip"; if (Directory.Exists(startPath)) { Directory.Delete(startPath, true); } ZipFile.ExtractToDirectory(zipPath, startPath); } if (importSettings) { ModuleController mc = new ModuleController(); mc.UpdateModuleSetting(ModuleId, "template", export["Template"].ToString() .Replace("Portals/" + export["PortalId"] + "/", "Portals/" + PortalId + "/")); //.Replace("[PORTALID]", PortalId.ToString())); if (export["Settings"] != null) { mc.UpdateModuleSetting(ModuleId, "data", export["Settings"].ToString()); } mc.UpdateModuleSetting(ModuleId, "query", export["Query"].ToString()); DataCache.ClearCache(); } var module = OpenContentModuleConfig.Create(ModuleId, TabId, PortalSettings); IDataSource ds = DataSourceManager.GetDataSource(module.Settings.Manifest.DataSource); var dsContext = OpenContentUtils.CreateDataContext(module); if (importData) { var alpaca = ds.GetAlpaca(dsContext, true, true, false); var data = JToken.Parse(File.ReadAllText(ModuleImportDirectory + "data.json")); if (module.IsListMode()) { var dataList = ds.GetAll(dsContext, null).Items; foreach (var item in dataList) { ds.Delete(dsContext, item); } if (data is JArray) { foreach (JObject json in data) { ds.Add(dsContext, ImportTraverse(alpaca, json)); } } } else { var dsItem = ds.Get(dsContext, null); data = ImportTraverse(alpaca, data); if (dsItem == null) { ds.Add(dsContext, data); } else { ds.Update(dsContext, dsItem, data); } } } if (importAdditionalData && module.Settings.Manifest.AdditionalDataDefinition != null) { foreach (var item in module.Settings.Manifest.AdditionalDataDefinition) { var alpaca = ds.GetDataAlpaca(dsContext, true, true, false, item.Key); var dataFile = ModuleImportDirectory + item.Key + ".json"; if (File.Exists(dataFile)) { var data = JToken.Parse(File.ReadAllText(dataFile)); var dsItem = ds.GetData(dsContext, item.Value.ScopeType, item.Key); data = ImportTraverse(alpaca, data); if (dsItem == null) { ds.AddData(dsContext, item.Value.ScopeType, item.Key, data); } else { ds.UpdateData(dsContext, dsItem, data); } } } } //Directory.Delete(allStartPath, true); }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Upgrade button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/27/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected void UpdateSettings(object sender, EventArgs e) { if (Page.IsValid) { try { // TODO: Remove after refactor: this code/functionality has been copied to ..\AdvancedSettings\SmtpServerSettings.aspx) //show warning message when set custom smtp port and app running under medium trust, but still can //save the settings because maybe some host providers use a modified medium trusy config and allow //this permission. var smtpServer = txtSMTPServer.Text; var smtpWarning = !string.IsNullOrEmpty(smtpServer) && smtpServer != DotNetNuke.Entities.Host.Host.SMTPServer && smtpServer.Contains(":") && smtpServer.Split(':')[1] != "25" && !SecurityPolicy.HasAspNetHostingPermission(); HostController.Instance.Update("CheckUpgrade", chkUpgrade.Checked ? "Y" : "N", false); HostController.Instance.Update("DisplayBetaNotice", chkBetaNotice.Checked ? "Y" : "N", false); HostController.Instance.Update("HostPortalId", hostPortalsCombo.SelectedValue); HostController.Instance.Update("HostTitle", txtHostTitle.Text, false); HostController.Instance.Update("HostURL", txtHostURL.Text, false); HostController.Instance.Update("HostEmail", txtHostEmail.Text.Trim(), false); HostController.Instance.Update("PaymentProcessor", processorCombo.SelectedItem.Text, false); HostController.Instance.Update("ProcessorUserId", txtUserId.Text, false); HostController.Instance.Update("ProcessorPassword", txtPassword.Text, false); HostController.Instance.Update("HostFee", txtHostFee.Text, false); HostController.Instance.Update("HostCurrency", currencyCombo.SelectedValue, false); HostController.Instance.Update("HostSpace", txtHostSpace.Text, false); HostController.Instance.Update("PageQuota", txtPageQuota.Text, false); HostController.Instance.Update("UserQuota", txtUserQuota.Text, false); HostController.Instance.Update("SiteLogStorage", optSiteLogStorage.SelectedItem.Value, false); HostController.Instance.Update("SiteLogBuffer", txtSiteLogBuffer.Text, false); HostController.Instance.Update("SiteLogHistory", txtSiteLogHistory.Text, false); HostController.Instance.Update("DemoPeriod", txtDemoPeriod.Text, false); HostController.Instance.Update("DemoSignup", chkDemoSignup.Checked ? "Y" : "N", false); HostController.Instance.Update("Copyright", chkCopyright.Checked ? "Y" : "N", false); HostController.Instance.Update("DefaultDocType", docTypeCombo.SelectedValue, false); HostController.Instance.Update("RememberCheckbox", chkRemember.Checked ? "Y" : "N", false); HostController.Instance.Update("EnableCustomModuleCssClass", chkUseCustomModuleCssClass.Checked ? "Y" : "N", false); HostController.Instance.Update("DisableUsersOnline", chkUsersOnline.Checked ? "N" : "Y", false); HostController.Instance.Update("AutoAccountUnlockDuration", txtAutoAccountUnlock.Text, false); HostController.Instance.Update("UsersOnlineTime", txtUsersOnlineTime.Text, false); HostController.Instance.Update("ProxyServer", txtProxyServer.Text, false); HostController.Instance.Update("ProxyPort", txtProxyPort.Text, false); HostController.Instance.Update("ProxyUsername", txtProxyUsername.Text, false); HostController.Instance.Update("ProxyPassword", txtProxyPassword.Text, false); HostController.Instance.Update("WebRequestTimeout", txtWebRequestTimeout.Text, false); // TODO: Refactor: call smtpServerSettings.Update(); This code/functionality has been copied to ..\AdvancedSettings\SmtpServerSettings.aspx) HostController.Instance.Update("SMTPServer", txtSMTPServer.Text, false); HostController.Instance.Update("SMTPAuthentication", optSMTPAuthentication.SelectedItem.Value, false); HostController.Instance.Update("SMTPUsername", txtSMTPUsername.Text, false); HostController.Instance.UpdateEncryptedString("SMTPPassword", txtSMTPPassword.Text, Config.GetDecryptionkey()); HostController.Instance.Update("SMTPEnableSSL", chkSMTPEnableSSL.Checked ? "Y" : "N", false); // end of code copied to smtpServerSettings.Update() HostController.Instance.Update("FileExtensions", txtFileExtensions.Text, false); HostController.Instance.Update("UseCustomErrorMessages", chkUseCustomErrorMessages.Checked ? "Y" : "N", false); HostController.Instance.Update("EnableRequestFilters", chkEnableRequestFilters.Checked ? "Y" : "N", false); HostController.Instance.Update("ControlPanel", cboControlPanel.SelectedItem.Value, false); HostController.Instance.Update("SchedulerMode", cboSchedulerMode.SelectedItem.Value, false); HostController.Instance.Update("PerformanceSetting", cboPerformance.SelectedItem.Value, false); HostController.Instance.Update("AuthenticatedCacheability", cboCacheability.SelectedItem.Value, false); HostController.Instance.Update("PageStatePersister", cboPageState.SelectedItem.Value); HostController.Instance.Update("ModuleCaching", cboModuleCacheProvider.SelectedItem.Value, false); if (PageCacheRow.Visible) { HostController.Instance.Update("PageCaching", cboPageCacheProvider.SelectedItem.Value, false); } HostController.Instance.Update("EnableModuleOnLineHelp", chkEnableHelp.Checked ? "Y" : "N", false); HostController.Instance.Update("EnableFileAutoSync", chkAutoSync.Checked ? "Y" : "N", false); HostController.Instance.Update("HelpURL", txtHelpURL.Text, false); HostController.Instance.Update("EnableContentLocalization", chkEnableContentLocalization.Checked ? "Y" : "N", false); HostController.Instance.Update("DebugMode", chkDebugMode.Checked ? "Y" : "N", false); HostController.Instance.Update("ShowCriticalErrors", chkCriticalErrors.Checked ? "Y" : "N", true); HostController.Instance.Update("MessageSchedulerBatchSize", txtBatch.Text, false); HostController.Instance.Update("EventLogBuffer", chkLogBuffer.Checked ? "Y" : "N", false); HostController.Instance.Update("DefaultPortalSkin", hostSkinCombo.SelectedValue, false); HostController.Instance.Update("DefaultAdminSkin", editSkinCombo.SelectedValue, false); HostController.Instance.Update("DefaultPortalContainer", hostContainerCombo.SelectedValue, false); HostController.Instance.Update("DefaultAdminContainer", editContainerCombo.SelectedValue, false); HostController.Instance.Update("jQueryDebug", chkJQueryDebugVersion.Checked ? "Y" : "N", false); HostController.Instance.Update("jQueryHosted", chkJQueryUseHosted.Checked ? "Y" : "N", false); HostController.Instance.Update("jQueryUrl", txtJQueryHostedUrl.Text.Trim(), false); HostController.Instance.Update("jQueryMigrateUrl", txtJQueryMigrateHostedUrl.Text.Trim(), false); HostController.Instance.Update("jQueryUIUrl", txtJQueryUIHostedUrl.Text.Trim(), false); HostController.Instance.Update("EnableMsAjaxCDN", chkMsAjaxCdn.Checked ? "Y" : "N", false); HostController.Instance.Update("EnableTelerikCDN", chkTelerikCdn.Checked ? "Y" : "N", false); HostController.Instance.Update("CDNEnabled", chkEnableCDN.Checked ? "Y" : "N", false); HostController.Instance.Update("TelerikCDNBasicUrl", txtTelerikBasicUrl.Text, false); HostController.Instance.Update("TelerikCDNSecureUrl", txtTelerikSecureUrl.Text, false); HostController.Instance.Update("AsyncTimeout", txtAsyncTimeout.Text, false); HostController.Instance.Update(ClientResourceSettings.EnableCompositeFilesKey, chkCrmEnableCompositeFiles.Checked.ToString(CultureInfo.InvariantCulture)); HostController.Instance.Update(ClientResourceSettings.MinifyCssKey, chkCrmMinifyCss.Checked.ToString(CultureInfo.InvariantCulture)); HostController.Instance.Update(ClientResourceSettings.MinifyJsKey, chkCrmMinifyJs.Checked.ToString(CultureInfo.InvariantCulture)); HostController.Instance.Update("EnableBannedList", chkBannedList.Checked ? "Y" : "N", false); HostController.Instance.Update("EnableStrengthMeter", chkStrengthMeter.Checked ? "Y" : "N", false); HostController.Instance.Update("EnableIPChecking", chkIPChecking.Checked ? "Y" : "N", false); HostController.Instance.Update("EnablePasswordHistory", chkEnablePasswordHistory.Checked ? "Y" : "N", false); HostController.Instance.Update("MembershipResetLinkValidity", txtResetLinkValidity.Text, false); HostController.Instance.Update("MembershipNumberPasswords", txtNumberPasswords.Text, false); FriendlyUrlsExtensionControl.SaveAction(-1, -1, -1); UpdateSchedule(); UpdateSearchIndexConfiguration(); // TODO: Remove after refactor: this code/functionality has been copied to ..\AdvancedSettings\SmtpServerSettings.aspx) var redirectUrl = Request.RawUrl; if (smtpWarning && redirectUrl.IndexOf("smtpwarning=true", StringComparison.InvariantCultureIgnoreCase) == -1) { redirectUrl = string.Format("{0}{1}smtpwarning=true", redirectUrl, redirectUrl.Contains("?") ? "&" : "?"); } Response.Redirect(redirectUrl, true); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } finally { //TODO: this is temporary until the AUM Caching is moved into the core. //DataCache.ClearHostCache(false); DataCache.ClearCache(); } } }
private void ClearRoleGroupCache(int portalId) { DataCache.ClearCache(this.GetRoleGroupsCacheKey(portalId)); }
internal virtual void RemoveNotificationTypeCache() { DataCache.ClearCache("NotificationTypes:"); }
/// <summary> /// Updates the news entry w/o associated entities. /// </summary> /// <param name="newsEntry">News entry.</param> public void UpdateNewsEntry(NewsEntryInfo newsEntry) { NewsDataProvider.Instance.Update(newsEntry); DataCache.ClearCache(NewsCacheKeyPrefix); }
public void ClearBannerCache() { DataCache.ClearCache("Banners:"); }
protected void ClearCache_Click(object sender, EventArgs e) { //DataCache.RemoveCache("UrlRuleConfig"); DataCache.ClearCache(); ShowCache(); }