Skip to content

Instantly share code, notes, and snippets.

@mskutta
Last active August 29, 2016 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mskutta/09bad804674c2f6b195b8e98373d2a80 to your computer and use it in GitHub Desktop.
Save mskutta/09bad804674c2f6b195b8e98373d2a80 to your computer and use it in GitHub Desktop.
public class EvaluateResult : PublishItemProcessor
{
public override void Process(PublishItemContext context)
{
Assert.ArgumentNotNull(context, "context");
// We want to rely on smart publishing so we don't send unnecessary data. Deletes are a weird sceneiro.
// If a Republish is performed, we need the delete actions to come through. We cant rely on the Result.Operation for this.
if ((context.Action != PublishAction.DeleteTargetItem || context.PublishOptions.CompareRevisions) &&
(context.Result.Operation == PublishOperation.Skipped ||
context.Result.Operation == PublishOperation.None))
return;
// Note on Deletes... The Operation of delete will only come though once for one of the published languages.
// The other languages will have a result of none.
// Note on HideVersion = true... The operation of a smart publish will always be PublishOperation.Updated. The causes unnecessary processing.
// VersionToPublish is the item being published.
// Note: For deletes the VersionToPublish is the parent
var item = context.VersionToPublish
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment