Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish-Item Cmdlet - recurse not working and no audit log #244

Closed
chrislewisdev2 opened this issue Oct 30, 2014 · 2 comments
Closed

Publish-Item Cmdlet - recurse not working and no audit log #244

chrislewisdev2 opened this issue Oct 30, 2014 · 2 comments
Labels
area-commands Involves functions and cmdlets. improvement Extra sugar and spice.
Milestone

Comments

@chrislewisdev2
Copy link

There are two problems I can see with the Publish-Item cmdlet

  1. The recurse param doesn’t seem to work
  2. There is no audit log of the publish

Diagnosis:
If you amend the following line : PublishItemPipeline.Run(item.ID, options);
to return a PublishItemResult object, you can then interrogate this to find the outcome of the PublishOperation (e.g. None, Skipped, Created, Updated, Deleted).
This is good because it gives some more verbose feedback, and you can see scenarios where publishing will be skipped (e.g. due to its workflow being unable to publish or publishing restrictions). However, despite the Deep argument being set, I was unable to get any scenario working where child items are published, even if you explicitly set RootItem in the PublishOptions object. Furthermore, there is no audit log of the publish so I was unable to tell truly how many items were being published. Nor, does running the cmdlet seem to trigger the publish events listed here: http://sdn.sitecore.net/articles/api/using%20events.aspx (which I proved by wiring up publish:begin to the powershell event interceptor - very nice feature by the way).

So I started to assume the wrong API call is being made. I isolated the code in Sitecore.Kernel which I think manages both audit logging AND recursive behaviour in publish operations and it can be found in PublishManager. I’m not sure if it’s correct to invoke this rather than PublishItemPipeline (people with more Sitecore experience could advise). However, I've made this change locally and tested it and now not only do I see audit logs with the publish count but I also have child items being published.

I'll issued a pull request with my change.

@AdamNaj AdamNaj added this to the 2.7.5 milestone Nov 2, 2014
@AdamNaj AdamNaj added area-commands Involves functions and cmdlets. improvement Extra sugar and spice. labels Nov 2, 2014
@reedyd
Copy link

reedyd commented Apr 2, 2015

Has publish-item been improved by Sitecore OTB?

@mattmcgovern
Copy link

I'm having trouble getting the -RepublishAll to work. It's not recognized as a parameter. My PSVersion is 4.0. Any ideas? I've used both the -Item and the -Path parameters to no avail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-commands Involves functions and cmdlets. improvement Extra sugar and spice.
Projects
None yet
Development

No branches or pull requests

4 participants