private void RunSetup() { #region setup Cynthia-core if (!schemaHasBeenCreated) { if (canAlterSchema) { CreateInitialSchema("Cynthia-core"); schemaHasBeenCreated = DatabaseHelper.SchemaHasBeenCreated(); if (schemaHasBeenCreated) { //recheck needSchemaUpgrade = CSetup.UpgradeIsNeeded(); } } } if ( (schemaHasBeenCreated) && (needSchemaUpgrade) && (canAlterSchema) ) { needSchemaUpgrade = UpgradeSchema("Cynthia-core"); } if (!CoreSystemIsReady()) { return; } existingSiteCount = DatabaseHelper.ExistingSiteCount(); if (existingSiteCount == 0) { CreateSiteAndAdminUser(); } // look for new features or settings to install SetupFeatures("Cynthia-core"); #endregion #region setup other applications // install other apps String pathToApplicationsFolder = HttpContext.Current.Server.MapPath( "~/Setup/applications/"); if (!Directory.Exists(pathToApplicationsFolder)) { WritePageContent( pathToApplicationsFolder + " " + SetupResource.ScriptFolderNotFoundAddendum, false); return; } DirectoryInfo appRootFolder = new DirectoryInfo(pathToApplicationsFolder); DirectoryInfo[] appFolders = appRootFolder.GetDirectories(); foreach (DirectoryInfo appFolder in appFolders) { if ( (!string.Equals(appFolder.Name, "Cynthia-core", StringComparison.InvariantCultureIgnoreCase)) && (appFolder.Name.ToLower() != ".svn") && (appFolder.Name.ToLower() != "_svn") ) { CreateInitialSchema(appFolder.Name); UpgradeSchema(appFolder.Name); SetupFeatures(appFolder.Name); } } #endregion WritePageContent(SetupResource.EnsuringFeaturesInAdminSites, true); ModuleDefinition.EnsureInstallationInAdminSites(); SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings(); if (siteSettings != null) { if (PageSettings.GetCountOfPages(siteSettings.SiteId) == 0) { WritePageContent(SetupResource.CreatingDefaultContent); //SetupContentPages(siteSettings); CSetup.SetupDefaultContentPages(siteSettings); } try { int userCount = SiteUser.UserCount(siteSettings.SiteId); if (userCount == 0) { CSetup.EnsureRolesAndAdminUser(siteSettings); } } catch (Exception ex) { log.Error("EnsureAdminUserAndRoles", ex); } CSetup.EnsureSkins(siteSettings.SiteId); } // in case control type controlsrc, regex or sort changed on the definition // update instance properties to match ThreadPool.QueueUserWorkItem(new WaitCallback(SyncDefinitions), null); //ModuleDefinition.SyncDefinitions(); SiteSettings.EnsureExpandoSettings(); CSetup.EnsureAdditionalSiteFolders(); }