-
Notifications
You must be signed in to change notification settings - Fork 2
How does publishing work
Publishing is the process of moving publishable content from the work-in-progress database to the publishing target.
Item is publishable when both points are true:
A) Is either in final workflow state or does not have any workflow assigned:
B) Does not have any publishing restrictions that prevent an item from being published:
Publishing mode is a name for a logic that must find item changes in the whole database.
There are 3 modes by default.
Smart mode compares Revision field value between the source and target databases.
The field value is changed to a new random guid value whenever an item is changed.
Having different revisions for the same item in different databases indicates an item change.
Drawback: whole item tree must be enumerated - meaning all items will sooner or later be loaded (slow with tons of content)
Incremental mode uses PublishQueue table from source database.
Each item modification in source database results in a new row being added to PublishQueue table:
Incremental publish picks only new rows (not published previously) for publishing processing.
Once publishing is finished, rows are marked as published to the specific publishing target so that same data is not published twice.
This is achieved by saving last published row ID to Properties table:
Publish everything no matter what. Most expensive mode.
Each publishing operation requires a set of steps:
- Ensure vital system items present in publishing target (f.e. languages, templates)
- Figure out the scope of changes
- Ensure caches are up-to-date
- Process each publishing candidate
A set of steps for each publishing candidate:
- Raise publishing-related events
- Check security
- Transform virtual items (clones) to real ones
- Figure out the exact action (publish/skip/remove)
- Add related item to processing
- Update publishing statistics
A lot of logic needs to be executed - a suitable place to use pipeline design pattern:
publish
pipeline shall be used for Publish
operation in general
publishItem
pipeline shall be used to process each publishing candidate
Only ONE publish operation is allowed to be executed to the specific target at once to prevent concurrent modifications (spoiling data).
If you see initializing
message, 99 % there is another publishing being executed, so your one is forced to wait:
Only ONE CM must be configured to perform publish.
All CM instances must have Publishing.PublishingInstance
setting pointing to one Sitecore instance.
As a result, publish operation would be executed by the specific instance thanks to Event Queue magic.