public override SitecoreDeployCommandArguments Execute(SitecoreDeployCommandArguments args)
        {
            Assert.ArgumentNotNull(args, nameof(args));

            args.Result = "";

            if (args.Context.ContainsKey("arg"))
            {
                var indexName = args.Context["arg"];
                var index     = Sitecore.ContentSearch.ContentSearchManager.GetIndex(indexName);

                index.Rebuild(Sitecore.ContentSearch.IndexingOptions.ForcedIndexing);

                args.Result = $"SitecoreDeploy: Rebuilt index with name '{indexName}'";

                return(args);
            }

            foreach (var index in Sitecore.ContentSearch.ContentSearchManager.Indexes)
            {
                index.Rebuild(Sitecore.ContentSearch.IndexingOptions.ForcedIndexing);

                args.Result += $"SitecoreDeploy: Rebuilt index with name '{index.Name}'\r\n";
            }

            return(args);
        }
Exemple #2
0
        public override SitecoreDeployCommandArguments Execute(SitecoreDeployCommandArguments args)
        {
            Assert.ArgumentNotNull(args, nameof(args));

            args.Result = "";

            if (args.Context.ContainsKey("arg"))
            {
                var databaseName = args.Context["arg"];
                Sitecore.Globals.LinkDatabase.Rebuild(Sitecore.Configuration.Factory.GetDatabase(databaseName));

                args.Result = $"SitecoreDeploy: Rebuilt link database for '{databaseName}'";

                return(args);
            }

            Sitecore.Globals.LinkDatabase.Rebuild(Sitecore.Configuration.Factory.GetDatabase("core"));
            args.Result += "SitecoreDeploy: Rebuilt link database for 'core'";

            Sitecore.Globals.LinkDatabase.Rebuild(Sitecore.Configuration.Factory.GetDatabase("master"));
            args.Result += "SitecoreDeploy: Rebuilt link database for 'master'";

            Sitecore.Globals.LinkDatabase.Rebuild(Sitecore.Configuration.Factory.GetDatabase("web"));
            args.Result += "SitecoreDeploy: Rebuilt link database for 'web'";

            return(args);
        }
        public override SitecoreDeployCommandArguments Execute(SitecoreDeployCommandArguments args)
        {
            Assert.ArgumentNotNull(args, nameof(args));

            args.Result = "";

            DeployAll().Wait();

            args.Result = "SitecoreDeploy: DeployMarketingDefinitions completed";

            return(args);
        }
Exemple #4
0
        public override SitecoreDeployCommandArguments Execute(SitecoreDeployCommandArguments args)
        {
            Assert.ArgumentNotNull(args, nameof(args));

            args.Result = "";

            var master    = Database.GetDatabase("master");
            var web       = Database.GetDatabase("web");
            var targets   = new[] { web };
            var mode      = (args["arg"] ?? "smart").ToLowerInvariant();
            var languages = LanguageManager.GetLanguages(master).ToArray();

            switch (mode)
            {
            case "smart":
            {
                PublishingLog.Info("DeployService.PublishService Started Smart Publish");
                PublishManager.PublishSmart(master, targets, languages);
                JobsCount.TasksPublishings.Increment();
                args.Result = "SitecoreDeploy: Started Smart Publish";
                break;
            }

            case "full":
            {
                PublishingLog.Info("DeployService.PublishService Started Full Publish");
                foreach (var l in languages)
                {
                    PublishManager.Publish(new[]
                                           { new PublishOptions(master, web, PublishMode.Full, l, DateTime.Now) });
                    JobsCount.TasksPublishings.Increment();
                    args.Result += $"SitecoreDeploy: Started Full Publish for '{l}'\r\n";
                }

                break;
            }

            case "incremental":
            {
                PublishingLog.Info("DeployService.PublishService Started Incremental Publish");
                PublishManager.PublishIncremental(master, targets, languages);
                JobsCount.TasksPublishings.Increment();
                args.Result = "SitecoreDeploy: Started Incremental Publish";
                break;
            }

            default: throw new ArgumentException($"unknown mode '{mode}'");
            }

            return(args);
        }