Exemplo n.º 1
0
    /// <summary>
    /// Sets connection string, inits application and finalizes the database data (macro signatures, time zones, license).
    /// </summary>
    private void FinalizeDBInstallation()
    {
        SetAppConnectionString();

        UpdateMacroSignatures();

        // Recalculate time zone daylight saving start and end.
        TimeZoneInfoProvider.GenerateTimeZoneRules();

        CheckLicense();
    }
Exemplo n.º 2
0
    /// <summary>
    /// Procedures which automatically imports the upgrade export package with all WebParts, Widgets, Reports and TimeZones.
    /// </summary>
    private static void UpgradeImportPackage()
    {
        // Import
        try
        {
            RequestStockHelper.Remove("CurrentDomain", true);

            var importSettings = new SiteImportSettings(MembershipContext.AuthenticatedUser)
            {
                DefaultProcessObjectType = ProcessObjectEnum.All,
                SourceFilePath           = mUpgradePackagePath,
                WebsitePath = mWebsitePath
            };

            using (var context = new CMSActionContext())
            {
                context.DisableLogging();
                context.CreateVersion  = false;
                context.LogIntegration = false;

                ImportProvider.ImportObjectsData(importSettings);

                // Regenerate time zones
                TimeZoneInfoProvider.GenerateTimeZoneRules();

                // Delete the files for separable modules which are not install and therefore not needed
                DeleteWebPartsOfUninstalledModules();

                ImportMetaFiles(Path.Combine(mWebsitePath, "App_Data\\CMSTemp\\Upgrade"));
            }
        }
        catch (Exception ex)
        {
            EventLogProvider.LogException(EVENT_LOG_INFO, "Upgrade", ex);
        }
        finally
        {
            try
            {
                RefreshMacroSignatures();

                EventLogProvider.LogInformation(EVENT_LOG_INFO, "Upgrade - Finish");
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException(EVENT_LOG_INFO, "Upgrade", ex);
            }
        }
    }
    private static void Upgrade60Import()
    {
        EventLogProvider evp = new EventLogProvider();

        // Import
        try
        {
            RequestStockHelper.Remove("CurrentDomain", true);

            SiteImportSettings importSettings = new SiteImportSettings(CMSContext.CurrentUser)
            {
                DefaultProcessObjectType = ProcessObjectEnum.All,
                SourceFilePath           = mUpgradePackagePath,
                WebsitePath = mWebsitePath
            };

            ImportProvider.ImportObjectsData(importSettings);

            // Regenerate time zones
            TimeZoneInfoProvider.GenerateTimeZoneRules();

            #region "Separability"

            String        webPartsPath = mWebsitePath + "CMSWebParts\\";
            List <String> files        = new List <string>();
            // Create list of files to remove
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.BIZFORM))
            {
                files.AddRange(GetAllFiles(webPartsPath + "BizForms"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.BLOGS))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Blogs"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Community"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ECOMMERCE))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Ecommerce"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.EVENTMANAGER))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Events"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Forums"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MEDIALIBRARY))
            {
                files.AddRange(GetAllFiles(webPartsPath + "MediaLibrary"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MESSAGEBOARD))
            {
                files.AddRange(GetAllFiles(webPartsPath + "MessageBoards"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MESSAGING))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Messaging"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.NEWSLETTER))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Newsletters"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.NOTIFICATIONS))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Notifications"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING))
            {
                files.AddRange(GetAllFiles(webPartsPath + "OnlineMarketing"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.POLLS))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Polls"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.PROJECTMANAGEMENT))
            {
                files.AddRange(GetAllFiles(webPartsPath + "ProjectManagement"));
            }
            if (!ModuleEntry.IsModuleLoaded(ModuleEntry.REPORTING))
            {
                files.AddRange(GetAllFiles(webPartsPath + "Reporting"));
            }

            // Remove webparts for separated modules
            foreach (String file in files)
            {
                try
                {
                    File.Delete(file);
                }
                catch (Exception ex)
                {
                    evp.LogEvent("Upgrade to 6.0", "Upgrade", ex);
                }
            }

            #endregion

            evp.LogEvent("I", DateTime.Now, "Upgrade to 6.0", "Upgrade - Finish");
        }
        catch (Exception ex)
        {
            evp.LogEvent("Upgrade to 6.0", "Upgrade", ex);
        }
    }