I have a custom item:saving
event handler which contains some specific logic when a user user makes a change to an item. This works fine but when we create a content package from a different environment and then install it on another environment the item:saved
and item:saving
events are fired during the package installation. We only want the code to run when the save actions are done by the user and not during package install time, since in theory those actions were already carried out on the server we are packaging from.
We are already checking if the Items are being Published, since that causes as similar item:saving
event to be raised.
protected void OnItemSaving(object sender, EventArgs args)
{
Assert.ArgumentNotNull(sender, "sender");
Assert.ArgumentNotNull((object)args, "args");
if (PublishHelper.IsPublishing())
return;
Item obj = Event.ExtractParameter(args, 0) as Item;
if (obj == null)
return;
this.DoCustomLogic(obj);
}
Is there a similar helper or how can I check if this save event is raised as a result of a package being installed?