Full Publish – Sitecore Publishing

Content authors update content regularly to make their site up to date. Once the changes completed, they must have to publish the content to push the latest changes on production or live website.

We have multiple options available to publish content from master (edit mode) to web (live mode).

Full Publish

Publish entire database/content/website (entire publishable content regardless of whether it has changed or not) is considered as a full publish. It is very costly in terms of performance. How much it will take time, it depends on the size of the content/website. It transfers entire publishable content from master to the web database. It does not check the content is modified or not. It simply copy items from master database and paste them into web database. So, it is most expensive publishing.

Its not recommended to perform full publish activity in day to day activity.

Below are the scenarios when you can opt full publish option:

  • When you are not sure about what all changes made by you or your team
  • when you think your site content is not consistent between master and web
  • First time you need to publish your entire website

Tracking full publish

As per my knowledge, Sitecore does not have any dedicated even for this. But we can track it using publish:end or publish:complete event. This event get fire after completing your publishing activity. So whenever content authors publish any content, these events fire once. So we can use any of these events.

Next thing is how can we know that content author did full publish or not. We can use PublishMode to check this.

PublishMode is an enum and its value can be either of the following:

  • Full = 1
  • Incremental = 2
  • SingleItem = 3
  • Smart = 4

Create a patch file to capture publish:end event.

<configuration xmlns:patch=”http://www.sitecore.net/xmlconfig/”&gt;
<sitecore>
<events>
<event name=”publish:end”>
<handler type=”SC.CMS.Extenstions.Events.PublishEvents, SC.CMS.Extenstions” method=”onPublishEnd” />
</event>
</events>
</sitecore>
</configuration>

Create a class file to track event:

public void onPublishEnd(object sender, EventArgs args)
{

var sitecoreArgs = args as SitecoreEventArgs;

if (sitecoreArgs == null) return;

var publisher = sitecoreArgs.Parameters[0] as Publisher;
if (publisher == null) return;

PublishOptions publishOptions = publisher.Options;

if (publishOptions.Mode == PublishMode.Full)
{

//Do whatever you want to do:

}

}

Why do you need to track full publish activity

As you know we should ignore this activity as you can. Following are the possible scenario where we might need to track full publish:

  • Client may want to perform this expensive activity only by admin or few specific users
  • Client may want to sent an email to a DL whenever such activity get invoked to watch/monitor the website performance

 

Thanks for your time 🙂

One thought on “Full Publish – Sitecore Publishing

Leave a comment