1

When I perform a Site Publish, there are 3 options - Incremental publish, Smart publish & Republish.

I'm capturing the PublishMode in a custom Handler and the results are:

For Incremental publish - Incremental
For Smart publish - Full
For Republish - Full

I'm expecting that the PublishMode would be Smart for the Smart publish instead of Full. Is that correct?

Using v10.3

patch.config:

<pipelines>
  <publish>
    <processor type="MyCode.Handlers.AuditPublish, MyCode"/>
  </publish>
</pipelines>

AuditPublish.cs

public class AuditPublish:PublishProcessor
    {
        public override void Process(PublishContext context)
        {
            var mode = context.PublishOptions.Mode.ToString();
        }
    }

2 Answers 2

4

You should be careful with making too many assumptions around the PublishingAPI, it has undergone a lot of changes in recent months and years.

Anyway, that said. "Full" and "Smart" are both "Full Publishes", but the "compareRevisions" flag will be false for a "Full" publish, and true for a "Smart" publish.

3

If you decompile the Sitecore.Kernel dll there are 5 enums of PublishMode in the code Sitecore.Publishing.PublishMode.

  1. Unknown - Unknown mode.

  2. Full - Re-publishes everything.

  3. Incremental - Every item change generates a record in list (f.e. PublishingQueue table).

  4. SingleItem - Publishes single item.

  5. Smart - Publishes items that have different revisions in source and target.

Now if you check PublishOptions class it has several costructor and one of them is setting the mode like.

public PublishOptions(Database sourceDatabase, Database targetDatabase, PublishMode mode, Language language, DateTime publishDate, string userName, Replacer replacer)
{
   if (this.mode == PublishMode.Smart)
   {
       this.mode = PublishMode.Full;
       compareRevisions = true;
   }
}

That's the only reason you see this behavior and it is expected as per code.

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.