public void Process(UnicornSyncEndPipelineArgs args)
        {
            Assert.IsNotNullOrEmpty(PublishTriggerItemId, "Must set PublishTriggerItemId parameter.");

            if (_targetDatabases == null || _targetDatabases.Count == 0)
            {
                return;
            }

            var dbs     = _targetDatabases.Select(Factory.GetDatabase).ToArray();
            var trigger = Factory.GetDatabase("master").GetItem(PublishTriggerItemId);

            if (!ManualPublishQueueHandler.HasItemsToPublish)
            {
                return;
            }

            Assert.IsTrue(dbs.Length > 0, "No valid databases specified to publish to.");
            Assert.IsNotNull(trigger, "Invalid trigger item ID");

            args.Console.ReportStatus(string.Empty);
            args.Console.ReportStatus("[P] Auto-publishing of synced items is beginning.");
            Log.Info("Unicorn: initiated synchronous publishing of synced items.", this);

            if (ManualPublishQueueHandler.PublishQueuedItems(trigger, dbs, args.Console))
            {
                Log.Info("Unicorn: publishing of synced items is complete.", this);
            }
        }
        public void Process(UnicornSyncEndPipelineArgs args)
        {
            Assert.IsNotNullOrEmpty(PublishTriggerItemId, "Must set PublishTriggerItemId parameter.");

            if (_targetDatabases == null || _targetDatabases.Count == 0)
            {
                return;
            }

            if (!ManualPublishQueueHandler.HasItemsToPublish)
            {
                return;
            }

            // this occurs prior to the SerializationComplete event, which clears caches
            // if this is not done here, old content can be published that is out of date
            // particularly unversioned fields
            CacheManager.ClearAllCaches();

            var dbs     = _targetDatabases.Select(Factory.GetDatabase).ToArray();
            var trigger = Factory.GetDatabase("master").GetItem(PublishTriggerItemId);

            Assert.IsTrue(dbs.Length > 0, "No valid databases specified to publish to.");
            Assert.IsNotNull(trigger, "Invalid trigger item ID");

            args.Logger.Info(string.Empty);
            args.Logger.Info("[P] Auto-publishing of synced items is beginning.");
            Log.Info("Unicorn: initiated synchronous publishing of synced items.", this);

            if (ManualPublishQueueHandler.PublishQueuedItems(trigger, dbs, args.Logger))
            {
                Log.Info("Unicorn: publishing of synced items is complete.", this);
            }
        }
Exemplo n.º 3
0
        public void Process(UnicornSyncEndPipelineArgs args)
        {
            Assert.IsNotNullOrEmpty(PublishTriggerItemId, "Must set PublishTriggerItemId parameter.");

            if (_targetDatabases == null || _targetDatabases.Count == 0)
            {
                return;
            }

            var dbs     = _targetDatabases.Select(Factory.GetDatabase).ToArray();
            var trigger = Factory.GetDatabase("master").GetItem(PublishTriggerItemId);

            Assert.IsTrue(dbs.Length > 0, "No valid databases specified to publish to.");
            Assert.IsNotNull(trigger, "Invalid trigger item ID");

            if (ManualPublishQueueHandler.PublishQueuedItems(trigger, dbs))
            {
                Log.Info("Unicorn: initiated publishing of synced items.", this);
            }
        }
Exemplo n.º 4
0
        public void Process(UnicornSyncEndPipelineArgs args)
        {
            Assert.IsNotNullOrEmpty(PublishTriggerItemId, "Must set PublishTriggerItemId parameter.");

            if (_targetDatabases == null || _targetDatabases.Count == 0)
            {
                return;
            }

            if (!string.IsNullOrWhiteSpace(HttpContext.Current.Request.QueryString["publishDbs"]))
            {
                List <string> dbNames = HttpContext.Current.Request.QueryString["publishDbs"].Split(',').ToList();
                dbNames.ForEach(AddTargetDatabase);
            }

            var dbs = _targetDatabases.Select(Factory.GetDatabase).ToArray();

            string[] deepPublish = PublishTriggerItemId.Split(',');

            if (HttpContext.Current.Request.QueryString["fullPublish"] == "true")
            {
                foreach (string path in deepPublish)
                {
                    var extractPath = path.Split(':');
                    var trigger     = Factory.GetDatabase(extractPath[0]).GetItem(extractPath[1]);
                    ManualPublishQueueHandler.AddItemToPublish(trigger.ID, extractPath[0]);
                }
            }


            Assert.IsTrue(dbs.Length > 0, "No valid databases specified to publish to.");

            if (ManualPublishQueueHandler.PublishQueuedItems(dbs))
            {
                Log.Info("Unicorn: initiated publishing of synced items.", this);
            }
        }