Exemplo n.º 1
0
        public void Run(ITaskOutput output, NameValueCollection metaData)
        {
            foreach (var step in _postInstallationSteps)
            {
                IInstallerLoggingService logging = new SitecoreInstallerLoggingService();

                try
                {
                    step.Run(output, metaData);
                    logging.Log <PostInstallationStep>($"Executed: {step.GetType().FullName}");
                }
                catch (Exception ex)
                {
                    logging.Log <PostInstallationStep>(ex, step.GetType().FullName);

                    throw;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The uCommerce post installation step.
        /// </summary>
        /// <remarks>
        /// There is a race condition between upgrading the database and upgrading the binaries. :-(
        ///
        /// Upgrade the database first, and the old binaries might not work with the new database.
        /// Upgrade the binaries first, and the new binaries might not work with the old database.
        ///
        /// We have one observation indicating a failed installation because the new binaries was
        /// activated before the database scripts were done, resulting in a broken system.
        ///
        /// The problem is probably going to grow, as more database migrations are added.
        ///
        /// We have chosen to upgrade the database first.
        /// This is because the database upgrade takes a long time in the clean scenario, but is
        /// relatively faster in upgrade scenarios.
        ///
        /// So for clean installs there are no old binaries, so the race condition is void.
        /// - Jesper
        /// </remarks>
        public PostInstallationStep()
        {
            var sitecoreInstallerLoggingService = new SitecoreInstallerLoggingService();
            IDatabaseAvailabilityService sitefinityDatabaseAvailabilityService = new SitecoreDatabaseAvailabilityService();
            var installationConnectionStringLocator = new SitecoreInstallationConnectionStringLocator();
            var runtimeVersionChecker  = new RuntimeVersionChecker(installationConnectionStringLocator, sitecoreInstallerLoggingService);
            var updateService          = new UpdateService(installationConnectionStringLocator, runtimeVersionChecker, sitefinityDatabaseAvailabilityService);
            var sitecoreVersionChecker = new SitecoreVersionChecker();

            _postInstallationSteps = new List <IPostStep>();

            _postInstallationSteps.Add(new SitecorePreRequisitesChecker());
            _postInstallationSteps.Add(new InitializeObjectFactory());
            _postInstallationSteps.Add(new InstallDatabase("~/sitecore modules/Shell/ucommerce/install"));
            _postInstallationSteps.Add(new InstallDatabaseSitecore("~/sitecore modules/Shell/ucommerce/install"));
            _postInstallationSteps.Add(new UpdateUCommerceAssemblyVersionInDatabase(updateService, runtimeVersionChecker, sitecoreInstallerLoggingService));

            _postInstallationSteps.Add(new CopyFile(sourceVirtualPath: "~/web.config", targetVirtualPath: "~/web.config.{DateTime.Now.Ticks}.backup"));
            _postInstallationSteps.Add(new SitecoreWebconfigMerger(sitecoreVersionChecker));
            _postInstallationSteps.Add(new SeperateConfigSectionInNewFile("configuration/sitecore/settings", "~/web.config", "~/App_Config/Include/.Sitecore.Settings.config"));
            _postInstallationSteps.Add(new MoveDirectory("~/sitecore modules/shell/ucommerce/install/binaries", "~/bin/uCommerce", overwriteTarget: true));

            _postInstallationSteps.Add(new DeleteFile("~/bin/ucommerce/UCommerce.Installer.dll"));

            // Remove old UCommerce.Transactions.Payment.dll from /bin since payment methods have been moved to Apps.
            _postInstallationSteps.Add(new DeleteFile("~/bin/UCommerce.Transactions.Payments.dll"));
            // Remove ServiceStack folder
            _postInstallationSteps.Add(new UCommerce.Sitecore.Installer.Steps.DeleteDirectory("~/sitecore modules/Shell/Ucommerce/Apps/ServiceStack"));
            // Enable ExchangeRateAPICurrencyConversion app
            _postInstallationSteps.Add(new MoveDirectory(
                                           "~/sitecore modules/Shell/Ucommerce/Apps/ExchangeRateAPICurrencyConversion.disabled",
                                           "~/sitecore modules/Shell/Ucommerce/Apps/ExchangeRateAPICurrencyConversion", true));

            // Remove Catalogs app since it was moved into Core
            _postInstallationSteps.Add(new Steps.DeleteDirectory("~/sitecore modules/Shell/Ucommerce/Apps/Catalogs"));
            _postInstallationSteps.Add(new Steps.DeleteDirectory("~/sitecore modules/Shell/Ucommerce/Apps/Catalogs.disabled"));

            // Enable Sanitization app
            _postInstallationSteps.Add(new MoveDirectory(
                                           "~/sitecore modules/Shell/Ucommerce/Apps/Sanitization.disabled",
                                           "~/sitecore modules/Shell/Ucommerce/Apps/Sanitization", true));

            //Clean up unused configuration since payment integration has move to apps
            _postInstallationSteps.Add(new DeleteFile("~/sitecore modules/shell/ucommerce/Configuration/Payments.config"));

            _postInstallationSteps.Add(new MoveUcommerceBinaries());
            _postInstallationSteps.Add(new MoveResourceFiles());

            ComposeConfiguration();
            ComposePipelineConfiguration();
            _postInstallationSteps.Add(new RenameConfigDefaultFilesToConfigFilesStep("~/sitecore modules/Shell/uCommerce/Apps", false));
            _postInstallationSteps.Add(new MoveDirectoryIfTargetExist("~/sitecore modules/Shell/uCommerce/Apps/SimpleInventory.disabled", "~/sitecore modules/Shell/uCommerce/Apps/SimpleInventory"));
            _postInstallationSteps.Add(new MoveDirectoryIfTargetExist("~/sitecore modules/Shell/uCommerce/Apps/Acquire and Cancel Payments.disabled", "~/sitecore modules/Shell/uCommerce/Apps/Acquire and Cancel Payments"));
            _postInstallationSteps.Add(new MoveDirectoryIfTargetExist("~/sitecore modules/shell/uCommerce/Apps/RavenDB30.disabled", "~/sitecore modules/shell/uCommerce/Apps/RavenDB30"));

            _postInstallationSteps.Add(new MoveDirectory("~/sitecore modules/shell/uCommerce/Apps/RavenDB25.disabled", "~/sitecore modules/shell/uCommerce/Apps/RavenDB25", true));
            //Create back up and remove old files
            RemovedRenamedPipelines();

            _postInstallationSteps.Add(new CreateApplicationShortcuts());
            _postInstallationSteps.Add(new CreateSpeakApplicationIfSupported(sitecoreVersionChecker));

            // Move sitecore config includes into the right path
            ComposeMoveSitecoreConfigIncludes(sitecoreVersionChecker);

            _postInstallationSteps.Add(new MigrateIdTableValues());
        }