public override IPagesStorageProviderV30 GetProvider() { PagesStorageProvider prov = new PagesStorageProvider(); prov.Init(MockHost(), ""); return(prov); }
/// <summary> /// Performs all needed startup operations. /// </summary> public static void Startup() { // Load Host Host.Instance = new Host(); // Load config ISettingsStorageProviderV30 ssp = ProviderLoader.LoadSettingsStorageProvider(WebConfigurationManager.AppSettings["SettingsStorageProvider"]); ssp.Init(Host.Instance, GetSettingsStorageProviderConfiguration()); Collectors.SettingsProvider = ssp; Settings.CanOverridePublicDirectory = false; if (!(ssp is SettingsStorageProvider)) { // Update DLLs from public\Plugins UpdateDllsIntoSettingsProvider(ssp, ProviderLoader.SettingsStorageProviderAssemblyName); } if (ssp.IsFirstApplicationStart()) { if (ssp.GetMetaDataItem(MetaDataItem.AccountActivationMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.AccountActivationMessage, null, Defaults.AccountActivationMessageContent); } if (ssp.GetMetaDataItem(MetaDataItem.EditNotice, null) == "") { ssp.SetMetaDataItem(MetaDataItem.EditNotice, null, Defaults.EditNoticeContent); } if (ssp.GetMetaDataItem(MetaDataItem.Footer, null) == "") { ssp.SetMetaDataItem(MetaDataItem.Footer, null, Defaults.FooterContent); } if (ssp.GetMetaDataItem(MetaDataItem.Header, null) == "") { ssp.SetMetaDataItem(MetaDataItem.Header, null, Defaults.HeaderContent); } if (ssp.GetMetaDataItem(MetaDataItem.PasswordResetProcedureMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.PasswordResetProcedureMessage, null, Defaults.PasswordResetProcedureMessageContent); } if (ssp.GetMetaDataItem(MetaDataItem.Sidebar, null) == "") { ssp.SetMetaDataItem(MetaDataItem.Sidebar, null, Defaults.SidebarContent); } if (ssp.GetMetaDataItem(MetaDataItem.PageChangeMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.PageChangeMessage, null, Defaults.PageChangeMessage); } if (ssp.GetMetaDataItem(MetaDataItem.DiscussionChangeMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.DiscussionChangeMessage, null, Defaults.DiscussionChangeMessage); } if (ssp.GetMetaDataItem(MetaDataItem.ApproveDraftMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.ApproveDraftMessage, null, Defaults.ApproveDraftMessage); } } MimeTypes.Init(); // Load Providers Collectors.FileNames = new System.Collections.Generic.Dictionary <string, string>(10); Collectors.UsersProviderCollector = new ProviderCollector <IUsersStorageProviderV30>(); Collectors.PagesProviderCollector = new ProviderCollector <IPagesStorageProviderV30>(); Collectors.FilesProviderCollector = new ProviderCollector <IFilesStorageProviderV30>(); Collectors.FormatterProviderCollector = new ProviderCollector <IFormatterProviderV30>(); Collectors.CacheProviderCollector = new ProviderCollector <ICacheProviderV30>(); Collectors.DisabledUsersProviderCollector = new ProviderCollector <IUsersStorageProviderV30>(); Collectors.DisabledPagesProviderCollector = new ProviderCollector <IPagesStorageProviderV30>(); Collectors.DisabledFilesProviderCollector = new ProviderCollector <IFilesStorageProviderV30>(); Collectors.DisabledFormatterProviderCollector = new ProviderCollector <IFormatterProviderV30>(); Collectors.DisabledCacheProviderCollector = new ProviderCollector <ICacheProviderV30>(); // Load built-in providers var providers = new IProviderV30[] { new FilesStorageProvider(), new UsersStorageProvider(), new Footnotes() }; foreach (var provider in providers) { var isDisabled = ProviderLoader.IsDisabled(provider.GetType().FullName); if (!isDisabled) { provider.Init(Host.Instance, ""); Log.LogEntry("Provider " + provider.Information.Name + " loaded (Enabled)", EntryType.General, Log.SystemUsername); } else { Log.LogEntry("Provider " + provider.Information.Name + " loaded (Disabled)", EntryType.General, Log.SystemUsername); } if (provider is IUsersStorageProviderV30) { (isDisabled ? Collectors.DisabledUsersProviderCollector : Collectors.UsersProviderCollector).AddProvider(provider as IUsersStorageProviderV30); } else if (provider is IPagesStorageProviderV30) { (isDisabled ? Collectors.DisabledPagesProviderCollector : Collectors.PagesProviderCollector).AddProvider(provider as IPagesStorageProviderV30); } else if (provider is IFilesStorageProviderV30) { (isDisabled ? Collectors.DisabledFilesProviderCollector : Collectors.FilesProviderCollector).AddProvider(provider as IFilesStorageProviderV30); } else if (provider is IFormatterProviderV30) { (isDisabled ? Collectors.DisabledFormatterProviderCollector : Collectors.FormatterProviderCollector).AddProvider(provider as IFormatterProviderV30); } else if (provider is ICacheProviderV30) { (isDisabled ? Collectors.DisabledCacheProviderCollector : Collectors.CacheProviderCollector).AddProvider(provider as ICacheProviderV30); } } // Load Users (pages storage providers might need access to users/groups data for upgrading from 2.0 to 3.0) ProviderLoader.FullLoad(true, false, false, false, false); //Users.Instance = new Users(); bool groupsCreated = VerifyAndCreateDefaultGroups(); PagesStorageProvider p = new PagesStorageProvider(); if (!ProviderLoader.IsDisabled(p.GetType().FullName)) { p.Init(Host.Instance, ""); Collectors.PagesProviderCollector.AddProvider(p); Log.LogEntry("Provider " + p.Information.Name + " loaded (Enabled)", EntryType.General, Log.SystemUsername); } else { Collectors.DisabledPagesProviderCollector.AddProvider(p); Log.LogEntry("Provider " + p.Information.Name + " loaded (Disabled)", EntryType.General, Log.SystemUsername); } CacheProvider c = new CacheProvider(); if (!ProviderLoader.IsDisabled(c.GetType().FullName)) { c.Init(Host.Instance, ""); Collectors.CacheProviderCollector.AddProvider(c); Log.LogEntry("Provider " + c.Information.Name + " loaded (Enabled)", EntryType.General, Log.SystemUsername); } else { Collectors.DisabledCacheProviderCollector.AddProvider(c); Log.LogEntry("Provider " + c.Information.Name + " loaded (Disabled)", EntryType.General, Log.SystemUsername); } // Load all other providers ProviderLoader.FullLoad(false, true, true, true, true); if (groupsCreated) { // It is necessary to set default permissions for file management UserGroup administratorsGroup = Users.FindUserGroup(Settings.AdministratorsGroup); UserGroup anonymousGroup = Users.FindUserGroup(Settings.AnonymousGroup); UserGroup usersGroup = Users.FindUserGroup(Settings.UsersGroup); SetAdministratorsGroupDefaultPermissions(administratorsGroup); SetUsersGroupDefaultPermissions(usersGroup); SetAnonymousGroupDefaultPermissions(anonymousGroup); } // Init cache //Cache.Instance = new Cache(Collectors.CacheProviderCollector.GetProvider(Settings.DefaultCacheProvider)); if (Collectors.CacheProviderCollector.GetProvider(Settings.DefaultCacheProvider) == null) { Log.LogEntry("Default Cache Provider was not loaded, backing to integrated provider", EntryType.Error, Log.SystemUsername); Settings.DefaultCacheProvider = typeof(CacheProvider).FullName; Collectors.TryEnable(Settings.DefaultCacheProvider); } // Create the Main Page, if needed if (Pages.FindPage(Settings.DefaultPage) == null) { CreateMainPage(); } Log.LogEntry("ScrewTurn Wiki is ready", EntryType.General, Log.SystemUsername); System.Threading.ThreadPool.QueueUserWorkItem(state => { using (((WindowsIdentity)state).Impersonate()) { if ((DateTime.Now - Settings.LastPageIndexing).TotalDays > 7) { Settings.LastPageIndexing = DateTime.Now; System.Threading.Thread.Sleep(10000); using (MemoryStream ms = new MemoryStream()) { using (StreamWriter wr = new System.IO.StreamWriter(ms)) { System.Web.HttpContext.Current = new System.Web.HttpContext(new System.Web.Hosting.SimpleWorkerRequest("", "", wr)); foreach (var provider in Collectors.PagesProviderCollector.AllProviders) { if (!provider.ReadOnly) { Log.LogEntry("Starting automatic rebuilding index for provider: " + provider.Information.Name, EntryType.General, Log.SystemUsername); provider.RebuildIndex(); Log.LogEntry("Finished automatic rebuilding index for provider: " + provider.Information.Name, EntryType.General, Log.SystemUsername); } } } } Pages.RebuildPageLinks(Pages.GetPages(null)); foreach (ScrewTurn.Wiki.PluginFramework.NamespaceInfo nspace in Pages.GetNamespaces()) { Pages.RebuildPageLinks(Pages.GetPages(nspace)); } } } }, WindowsIdentity.GetCurrent()); }
public void Init_Upgrade() { string testDir = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), Guid.NewGuid().ToString()); Directory.CreateDirectory(testDir); MockRepository mocks = new MockRepository(); IHostV30 host = mocks.DynamicMock <IHostV30>(); Expect.Call(host.GetSettingValue(SettingName.PublicDirectory)).Return(testDir).Repeat.AtLeastOnce(); Expect.Call(host.UpgradePageStatusToAcl(null, 'L')).IgnoreArguments().Repeat.Twice().Return(true); mocks.Replay(host); string file = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Pages.cs"); string categoriesFile = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Categories.cs"); string navPathsFile = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "NavigationPaths.cs"); string directory = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Pages"); string messagesDirectory = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Messages"); Directory.CreateDirectory(directory); Directory.CreateDirectory(messagesDirectory); // Structure (Keywords and Description are new in v3) // Page Title // Username|DateTime[|Comment] --- Comment is optional // ##PAGE## // Content... File.WriteAllText(Path.Combine(directory, "Page1.cs"), "Title1\r\nSYSTEM|2008/10/30 20:20:20|Comment\r\n##PAGE##\r\nContent..."); File.WriteAllText(Path.Combine(directory, "Page2.cs"), "Title2\r\nSYSTEM|2008/10/30 20:20:20\r\n##PAGE\r\nContent. [[Page.3]] [Page.3|Link to update]."); File.WriteAllText(Path.Combine(directory, "Page.3.cs"), "Title3\r\nSYSTEM|2008/10/30 20:20:20|Comment\r\n##PAGE\r\nContent..."); // ID|Username|Subject|DateTime|ParentID|Body File.WriteAllText(Path.Combine(messagesDirectory, "Page.3.cs"), "0|User|Hello|2008/10/30 21:21:21|-1|Blah\r\n"); // Structure // [Namespace.]PageName|PageFile|Status|DateTime File.WriteAllText(file, "Page1|Page1.cs|NORMAL|2008/10/30 20:20:20\r\nPage2|Page2.cs|PUBLIC\r\nPage.3|Page.3.cs|LOCKED"); File.WriteAllText(categoriesFile, "Cat1|Page.3\r\nCat.2|Page1|Page2\r\n"); File.WriteAllText(navPathsFile, "Path1|Page1|Page.3\r\nPath2|Page2\r\n"); PagesStorageProvider prov = new PagesStorageProvider(); prov.Init(host, ""); PageInfo[] pages = prov.GetPages(null); Assert.AreEqual(3, pages.Length, "Wrong page count"); Assert.AreEqual("Page1", pages[0].FullName, "Wrong name"); Assert.AreEqual("Page2", pages[1].FullName, "Wrong name"); Assert.AreEqual("Page_3", pages[2].FullName, "Wrong name"); //Assert.IsFalse(prov.GetContent(pages[1]).Content.Contains("Page.3"), "Content should not contain 'Page.3'"); //Assert.IsTrue(prov.GetContent(pages[1]).Content.Contains("Page_3"), "Content should contain 'Page_3'"); Message[] messages = prov.GetMessages(pages[2]); Assert.AreEqual(1, messages.Length, "Wrong message count"); Assert.AreEqual("Hello", messages[0].Subject, "Wrong subject"); CategoryInfo[] categories = prov.GetCategories(null); Assert.AreEqual(2, categories.Length, "Wrong category count"); Assert.AreEqual("Cat1", categories[0].FullName, "Wrong name"); Assert.AreEqual(1, categories[0].Pages.Length, "Wrong page count"); Assert.AreEqual("Page_3", categories[0].Pages[0], "Wrong page"); Assert.AreEqual("Cat_2", categories[1].FullName, "Wrong name"); Assert.AreEqual(2, categories[1].Pages.Length, "Wrong page count"); Assert.AreEqual("Page1", categories[1].Pages[0], "Wrong page"); Assert.AreEqual("Page2", categories[1].Pages[1], "Wrong page"); NavigationPath[] navPaths = prov.GetNavigationPaths(null); Assert.AreEqual(2, navPaths.Length, "Wrong nav path count"); Assert.AreEqual("Path1", navPaths[0].FullName, "Wrong name"); Assert.AreEqual(2, navPaths[0].Pages.Length, "Wrong page count"); Assert.AreEqual("Page1", navPaths[0].Pages[0], "Wrong page"); Assert.AreEqual("Page_3", navPaths[0].Pages[1], "Wrong page"); Assert.AreEqual(1, navPaths[1].Pages.Length, "Wrong page count"); Assert.AreEqual("Page2", navPaths[1].Pages[0], "Wrong page"); mocks.Verify(host); // Simulate another startup - upgrade not needed anymore mocks.BackToRecord(host); Expect.Call(host.GetSettingValue(SettingName.PublicDirectory)).Return(testDir).Repeat.AtLeastOnce(); Expect.Call(host.UpgradePageStatusToAcl(null, 'L')).IgnoreArguments().Repeat.Times(0).Return(false); mocks.Replay(host); prov = new PagesStorageProvider(); prov.Init(host, ""); mocks.Verify(host); Directory.Delete(testDir, true); }
public void Init_Upgrade() { string testDir = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), Guid.NewGuid().ToString()); Directory.CreateDirectory(testDir); MockRepository mocks = new MockRepository(); IHostV30 host = mocks.DynamicMock<IHostV30>(); Expect.Call(host.GetSettingValue(SettingName.PublicDirectory)).Return(testDir).Repeat.AtLeastOnce(); Expect.Call(host.UpgradePageStatusToAcl(null, 'L')).IgnoreArguments().Repeat.Twice().Return(true); mocks.Replay(host); string file = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Pages.cs"); string categoriesFile = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Categories.cs"); string navPathsFile = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "NavigationPaths.cs"); string directory = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Pages"); string messagesDirectory = Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), "Messages"); Directory.CreateDirectory(directory); Directory.CreateDirectory(messagesDirectory); // Structure (Keywords and Description are new in v3) // Page Title // Username|DateTime[|Comment] --- Comment is optional // ##PAGE## // Content... File.WriteAllText(Path.Combine(directory, "Page1.cs"), "Title1\r\nSYSTEM|2008/10/30 20:20:20|Comment\r\n##PAGE##\r\nContent..."); File.WriteAllText(Path.Combine(directory, "Page2.cs"), "Title2\r\nSYSTEM|2008/10/30 20:20:20\r\n##PAGE\r\nContent. [[Page.3]] [Page.3|Link to update]."); File.WriteAllText(Path.Combine(directory, "Page.3.cs"), "Title3\r\nSYSTEM|2008/10/30 20:20:20|Comment\r\n##PAGE\r\nContent..."); // ID|Username|Subject|DateTime|ParentID|Body File.WriteAllText(Path.Combine(messagesDirectory, "Page.3.cs"), "0|User|Hello|2008/10/30 21:21:21|-1|Blah\r\n"); // Structure // [Namespace.]PageName|PageFile|Status|DateTime File.WriteAllText(file, "Page1|Page1.cs|NORMAL|2008/10/30 20:20:20\r\nPage2|Page2.cs|PUBLIC\r\nPage.3|Page.3.cs|LOCKED"); File.WriteAllText(categoriesFile, "Cat1|Page.3\r\nCat.2|Page1|Page2\r\n"); File.WriteAllText(navPathsFile, "Path1|Page1|Page.3\r\nPath2|Page2\r\n"); PagesStorageProvider prov = new PagesStorageProvider(); prov.Init(host, ""); PageInfo[] pages = prov.GetPages(null); Assert.AreEqual(3, pages.Length, "Wrong page count"); Assert.AreEqual("Page1", pages[0].FullName, "Wrong name"); Assert.AreEqual("Page2", pages[1].FullName, "Wrong name"); Assert.AreEqual("Page_3", pages[2].FullName, "Wrong name"); //Assert.IsFalse(prov.GetContent(pages[1]).Content.Contains("Page.3"), "Content should not contain 'Page.3'"); //Assert.IsTrue(prov.GetContent(pages[1]).Content.Contains("Page_3"), "Content should contain 'Page_3'"); Message[] messages = prov.GetMessages(pages[2]); Assert.AreEqual(1, messages.Length, "Wrong message count"); Assert.AreEqual("Hello", messages[0].Subject, "Wrong subject"); CategoryInfo[] categories = prov.GetCategories(null); Assert.AreEqual(2, categories.Length, "Wrong category count"); Assert.AreEqual("Cat1", categories[0].FullName, "Wrong name"); Assert.AreEqual(1, categories[0].Pages.Length, "Wrong page count"); Assert.AreEqual("Page_3", categories[0].Pages[0], "Wrong page"); Assert.AreEqual("Cat_2", categories[1].FullName, "Wrong name"); Assert.AreEqual(2, categories[1].Pages.Length, "Wrong page count"); Assert.AreEqual("Page1", categories[1].Pages[0], "Wrong page"); Assert.AreEqual("Page2", categories[1].Pages[1], "Wrong page"); NavigationPath[] navPaths = prov.GetNavigationPaths(null); Assert.AreEqual(2, navPaths.Length, "Wrong nav path count"); Assert.AreEqual("Path1", navPaths[0].FullName, "Wrong name"); Assert.AreEqual(2, navPaths[0].Pages.Length, "Wrong page count"); Assert.AreEqual("Page1", navPaths[0].Pages[0], "Wrong page"); Assert.AreEqual("Page_3", navPaths[0].Pages[1], "Wrong page"); Assert.AreEqual(1, navPaths[1].Pages.Length, "Wrong page count"); Assert.AreEqual("Page2", navPaths[1].Pages[0], "Wrong page"); mocks.Verify(host); // Simulate another startup - upgrade not needed anymore mocks.BackToRecord(host); Expect.Call(host.GetSettingValue(SettingName.PublicDirectory)).Return(testDir).Repeat.AtLeastOnce(); Expect.Call(host.UpgradePageStatusToAcl(null, 'L')).IgnoreArguments().Repeat.Times(0).Return(false); mocks.Replay(host); prov = new PagesStorageProvider(); prov.Init(host, ""); mocks.Verify(host); Directory.Delete(testDir, true); }
public override IPagesStorageProviderV30 GetProvider() { PagesStorageProvider prov = new PagesStorageProvider(); prov.Init(MockHost(), ""); return prov; }
/// <summary> /// Performs all needed startup operations. /// </summary> public static void Startup() { // Load Host Host.Instance = new Host(); // Load config ISettingsStorageProviderV30 ssp = ProviderLoader.LoadSettingsStorageProvider(WebConfigurationManager.AppSettings["SettingsStorageProvider"]); ssp.Init(Host.Instance, GetSettingsStorageProviderConfiguration()); Collectors.SettingsProvider = ssp; if (!(ssp is SettingsStorageProvider)) { // Update DLLs from public\Plugins UpdateDllsIntoSettingsProvider(ssp, ProviderLoader.SettingsStorageProviderAssemblyName); } if (ssp.IsFirstApplicationStart()) { if (ssp.GetMetaDataItem(MetaDataItem.AccountActivationMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.AccountActivationMessage, null, Defaults.AccountActivationMessageContent); } if (ssp.GetMetaDataItem(MetaDataItem.EditNotice, null) == "") { ssp.SetMetaDataItem(MetaDataItem.EditNotice, null, Defaults.EditNoticeContent); } if (ssp.GetMetaDataItem(MetaDataItem.Footer, null) == "") { ssp.SetMetaDataItem(MetaDataItem.Footer, null, Defaults.FooterContent); } if (ssp.GetMetaDataItem(MetaDataItem.Header, null) == "") { ssp.SetMetaDataItem(MetaDataItem.Header, null, Defaults.HeaderContent); } if (ssp.GetMetaDataItem(MetaDataItem.PasswordResetProcedureMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.PasswordResetProcedureMessage, null, Defaults.PasswordResetProcedureMessageContent); } if (ssp.GetMetaDataItem(MetaDataItem.Sidebar, null) == "") { ssp.SetMetaDataItem(MetaDataItem.Sidebar, null, Defaults.SidebarContent); } if (ssp.GetMetaDataItem(MetaDataItem.PageChangeMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.PageChangeMessage, null, Defaults.PageChangeMessage); } if (ssp.GetMetaDataItem(MetaDataItem.DiscussionChangeMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.DiscussionChangeMessage, null, Defaults.DiscussionChangeMessage); } if (ssp.GetMetaDataItem(MetaDataItem.ApproveDraftMessage, null) == "") { ssp.SetMetaDataItem(MetaDataItem.ApproveDraftMessage, null, Defaults.ApproveDraftMessage); } } // Load config IIndexDirectoryProviderV30 idp = ProviderLoader.LoadIndexDirectoryProvider(WebConfigurationManager.AppSettings["IndexDirectoryProvider"]); idp.Init(Host.Instance, GetSettingsStorageProviderConfiguration()); Collectors.IndexDirectoryProvider = idp; MimeTypes.Init(); // Load Providers Collectors.FileNames = new System.Collections.Generic.Dictionary <string, string>(10); Collectors.UsersProviderCollector = new ProviderCollector <IUsersStorageProviderV30>(); Collectors.PagesProviderCollector = new ProviderCollector <IPagesStorageProviderV30>(); Collectors.FilesProviderCollector = new ProviderCollector <IFilesStorageProviderV30>(); Collectors.FormatterProviderCollector = new ProviderCollector <IFormatterProviderV30>(); Collectors.CacheProviderCollector = new ProviderCollector <ICacheProviderV30>(); Collectors.DisabledUsersProviderCollector = new ProviderCollector <IUsersStorageProviderV30>(); Collectors.DisabledPagesProviderCollector = new ProviderCollector <IPagesStorageProviderV30>(); Collectors.DisabledFilesProviderCollector = new ProviderCollector <IFilesStorageProviderV30>(); Collectors.DisabledFormatterProviderCollector = new ProviderCollector <IFormatterProviderV30>(); Collectors.DisabledCacheProviderCollector = new ProviderCollector <ICacheProviderV30>(); // Load built-in providers // Files storage providers have to be loaded BEFORE users storage providers in order to properly set permissions FilesStorageProvider f = new FilesStorageProvider(); if (!ProviderLoader.IsDisabled(f.GetType().FullName)) { f.Init(Host.Instance, ""); Collectors.FilesProviderCollector.AddProvider(f); Log.LogEntry("Provider " + f.Information.Name + " loaded (Enabled)", EntryType.General, Log.SystemUsername); } else { Collectors.DisabledFilesProviderCollector.AddProvider(f); Log.LogEntry("Provider " + f.Information.Name + " loaded (Disabled)", EntryType.General, Log.SystemUsername); } UsersStorageProvider u = new UsersStorageProvider(); if (!ProviderLoader.IsDisabled(u.GetType().FullName)) { u.Init(Host.Instance, ""); Collectors.UsersProviderCollector.AddProvider(u); Log.LogEntry("Provider " + u.Information.Name + " loaded (Enabled)", EntryType.General, Log.SystemUsername); } else { Collectors.DisabledUsersProviderCollector.AddProvider(u); Log.LogEntry("Provider " + u.Information.Name + " loaded (Disabled)", EntryType.General, Log.SystemUsername); } // Load Users (pages storage providers might need access to users/groups data for upgrading from 2.0 to 3.0) ProviderLoader.FullLoad(true, false, false, false, false); //Users.Instance = new Users(); bool groupsCreated = VerifyAndCreateDefaultGroups(); PagesStorageProvider p = new PagesStorageProvider(); if (!ProviderLoader.IsDisabled(p.GetType().FullName)) { p.Init(Host.Instance, ""); Collectors.PagesProviderCollector.AddProvider(p); Log.LogEntry("Provider " + p.Information.Name + " loaded (Enabled)", EntryType.General, Log.SystemUsername); } else { Collectors.DisabledPagesProviderCollector.AddProvider(p); Log.LogEntry("Provider " + p.Information.Name + " loaded (Disabled)", EntryType.General, Log.SystemUsername); } CacheProvider c = new CacheProvider(); if (!ProviderLoader.IsDisabled(c.GetType().FullName)) { c.Init(Host.Instance, ""); Collectors.CacheProviderCollector.AddProvider(c); Log.LogEntry("Provider " + c.Information.Name + " loaded (Enabled)", EntryType.General, Log.SystemUsername); } else { Collectors.DisabledCacheProviderCollector.AddProvider(c); Log.LogEntry("Provider " + c.Information.Name + " loaded (Disabled)", EntryType.General, Log.SystemUsername); } // Load all other providers ProviderLoader.FullLoad(false, true, true, true, true); if (groupsCreated) { // It is necessary to set default permissions for file management UserGroup administratorsGroup = Users.FindUserGroup(Settings.AdministratorsGroup); UserGroup anonymousGroup = Users.FindUserGroup(Settings.AnonymousGroup); UserGroup usersGroup = Users.FindUserGroup(Settings.UsersGroup); SetAdministratorsGroupDefaultPermissions(administratorsGroup); SetUsersGroupDefaultPermissions(usersGroup); SetAnonymousGroupDefaultPermissions(anonymousGroup); } // Init cache //Cache.Instance = new Cache(Collectors.CacheProviderCollector.GetProvider(Settings.DefaultCacheProvider)); if (Collectors.CacheProviderCollector.GetProvider(Settings.DefaultCacheProvider) == null) { Log.LogEntry("Default Cache Provider was not loaded, backing to integrated provider", EntryType.Error, Log.SystemUsername); Settings.DefaultCacheProvider = typeof(CacheProvider).FullName; Collectors.TryEnable(Settings.DefaultCacheProvider); } // Create the Main Page, if needed if (Pages.FindPage(Settings.DefaultPage) == null) { CreateMainPage(); } Log.LogEntry("ScrewTurn Wiki is ready", EntryType.General, Log.SystemUsername); System.Threading.ThreadPool.QueueUserWorkItem(ignored => { SearchClass.RebuildIndex(); }); }